$x->{foo} ) $x->foo() ) $x = new Bar( foo=> 1 ) )
has 'attributename'; # Optional Attribute
has 'attributename' => (
# properties
isa => 'str',
is => 'str',
required => bool ,
coerce => bool,
does => 'str',
weak_ref => bool,
lazy => bool,
auto_deref => bool,
trigger => sub { },
handles => HANDLER,
metaclass => 'metaclass',
traits => [ 'str', 'str', 'str' ,]
builder => 'str',
default => DEFAULT,
initializer => 'str',
clearer => 'str',
predicate => 'str',
lazy_build => bool
);
has [qw( foo bar )]; # List of optional attributes
has [qw( foo bar )] => ( # Easy way to create many items that are identical
# properties, as above
required => 1
);
attributename : The Name of the attribute that will appear on the class instances.
properties :
isa :is :
'ro' : Read Only'rw' : Read Writerequired :
0 : Not Required1 : Required Construction Parameter. Value may never be set to undef.coerce :does : weak_ref :lazy : auto_deref: trigger : handles :