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
attributename: The Name of the attribute that will appear on the class instances.properties:isa:is:'ro': Read Only'rw': Read Write
required:0: Not Required1: Required Construction Parameter. Value may never be set to undef.
coerce:does:weak_ref:lazy:auto_deref:trigger:handles:
Showing changes from previous revision. Removed | Added
