package foo;

use Moose;

has <-->

About

  1. Creates an object property ( $x->{foo} )
  2. Creates accessors ( $x->foo() )
  3. 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