Moose::Micro - succinctly specify Moose attributes
version 0.002
package MyClass; use Moose::Micro 'foo $bar @baz; %!quux';
Moose::Micro makes it easy to declare Moose attributes without a lot of typing.
The argument to use Moose::Micro is a list of attribute names, which is split on whitespace. Any attributes named before the (optional) semicolon are required; any after it are not.
use Moose::Micro
Sigils are optional, and impose the following type constraints:
@: ArrayRef
@
%: HashRef
%
$: anything under Defined that isn't one of the above
$
No sigil means no type constraint.
Following the sigil or prefixing the attribute name with ! makes the attribute 'private'; that is, the generated accessor will start with _, e.g.:
!
_
!foo $!bar
If your class has a method named _build_$attribute, lazy_build => 1 is added to the attribute definition.
_build_$attribute
lazy_build => 1
All attributes are declared is => 'rw'.
is => 'rw'
There is no way to specify many options, like default, builder, handles, etc.
These are all internals that you probably don't care about. They'll be documented when they're stable.
Moose
Hans Dieter Pearcey <hdp@cpan.org>
This software is copyright (c) 2009 by Hans Dieter Pearcey. This is free software; you can redistribute it and/or modify it under the same terms as perl itself.
To install Moose::Micro, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Moose::Micro
CPAN shell
perl -MCPAN -e shell install Moose::Micro
For more information on module installation, please visit the detailed CPAN module installation guide.