MooseX::HasDefaults - default "is" to "ro" or "rw" for all attributes
package Person; use Moose; use MooseX::HasDefaults::RO; has name => ( isa => 'Str', ); has age => ( is => 'rw', isa => 'Int', documentation => "Changes most years", );
The module MooseX::HasDefaults::RO defaults is to ro.
is
ro
The module MooseX::HasDefaults::RW defaults is to rw.
rw
If you pass a specific value to any has's is, that overrides the default. If you do not want an accessor, pass is => undef.
has
is => undef
Shawn M Moore, sartak@gmail.com
sartak@gmail.com
This requires its users to be MOP savvy, and is a bit too much typing for the common case of defaulting is.
This solves a similar need by letting users create sugar functions. But people like has.
Copyright 2009 Infinity Interactive
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install MooseX::HasDefaults, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MooseX::HasDefaults
CPAN shell
perl -MCPAN -e shell install MooseX::HasDefaults
For more information on module installation, please visit the detailed CPAN module installation guide.