moose

Common attribute idioms

Custom accessors

# public reader, private writer
has 'bar' => (reader => 'get_bar', writer => '_set_bar');
# private accessor
has 'baz' => (accessor => '_baz');
# custom writer with code-ref
has 'foo' => (writer => { 'set_foo' => \&_my_custom_foo_setter });

Custom constructor args

has 'bar' => (..., init_arg => '-bar');

Foo->new(-bar => 100); # bar attribute is set
Foo->new(bar => 100); # bar attribute is *not* set  
s | << | >> | i