I need an explanation of this one liner. Is this only calling the set() method? Or something else?
Thanks for the help!
has 'shape' =>
( is => 'rw' );
The object is using MooseX::FollowPBP.
This is basic Moose syntax. has
is a Moose keyword that defines an attribute in your class. The attributes name is shape, and it is
r
ead-w
rite.
It's documented in multiple places.
has $name|@$names => %options
This will install an attribute of a given
$name
into the current class. If the first parameter is an array reference, it will create an attribute for every$name
in the list. The%options
will be passed to the constructor for Moose::Meta::Attribute (which inherits from Class::MOP::Attribute), so the full documentation for the valid options can be found there.
The MooseX::FollowPBP has nothing to do with it directly. It just changes the behavior of Moose, to turn the default accessor $obj->shape
into $obj->get_shape
and $obj->set_shape
, following the suggestion of Damian Conway in his book Perl Best Practices.