Enlightened Perl Organization
/kent/moose/has
package foo;
use Moose;
has <-->
About
- Creates an object property (
$x->{foo} )
- Creates accessors (
$x->foo() )
- Governs construction parameters (
$x = new Bar( foo=> 1 ) )
Synopsis
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
);
Parameters
Revised on 2009-01-09 at 08:12:04 by kent\n