The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Moose::Micro - succinctly specify Moose attributes

VERSION

version 0.002

SYNOPSIS

  package MyClass;
  use Moose::Micro 'foo $bar @baz; %!quux';

DESCRIPTION

Moose::Micro makes it easy to declare Moose attributes without a lot of typing.

SYNTAX

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.

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.

LIMITATIONS

All attributes are declared is => 'rw'.

There is no way to specify many options, like default, builder, handles, etc.

METHODS

These are all internals that you probably don't care about. They'll be documented when they're stable.

attribute_list

attribute_args

type_constraint_for

unimport

SEE ALSO

Moose

AUTHOR

  Hans Dieter Pearcey <hdp@cpan.org>

COPYRIGHT AND LICENSE

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.