Last active
December 11, 2015 07:38
-
-
Save logie17/4567292 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/perl | |
package Foo; | |
use Moose; | |
use Test::More; | |
has foo => ( is => 'rw'); | |
has bar => ( is => 'ro', writer => 'bar' ); | |
has baz => ( is => 'ro', writer => 'set_baz'); | |
my $obj = Foo->new; | |
$obj->foo; | |
$obj->foo('test'); | |
is $obj->foo, ('test'); | |
$obj->bar('test'); | |
is $obj->bar, undef; | |
$obj->set_baz('test'); | |
is $obj->baz, 'test'; | |
$obj->set_baz('foo'); | |
$obj->set_baz; | |
is $obj->baz, undef; | |
done_testing; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment