When declaring an attribute, you can declare a metaclass or a set of
traits for the attribute:
- use Moose::AttributeHelpers;
-
has 'mapping' => (
metaclass => 'Hash',
is => 'ro',
This option only works if your attribute is explicitly typed as an
C<ArrayRef> or C<HashRef>.
-However, we recommend that you use L<MooseX::AttributeHelpers> for
-these types of attributes, which gives you much more control over how
+However, we recommend that you use L<Moose::Meta::Attribute::Native> traits
+for these types of attributes, which gives you much more control over how
they are accessed and manipulated.
=head2 Initializer
Don't know what we're talking about? That's fine.
-=head2 Use L<MooseX::AttributeHelpers> instead of C<auto_deref>
+=head2 Use L<Moose::Meta::Attribute::Native> traits instead of C<auto_deref>
The C<auto_deref> feature is a bit troublesome. Directly exposing a
complex attribute is ugly. Instead, consider using
-L<MooseX::AttributeHelpers> to define an API that exposes those pieces
-of functionality that need exposing. Then you can expose just the
-functionality that you want.
+L<Moose::Meta::Attribute::Native> traits to define an API that exposes only
+necessary pieces of functionality.
=head2 Always call C<inner> in the most specific subclass
=head1 L<MooseX::AttributeHelpers>
-If you only look at one extension, it should be this one. It provides
-the equivalent of delegation for all of Perl's native data types, such
-as array reference, hash references, numbers, strings, etc.
-
-This lets you create I<much> cleaner and fluent APIs.
-
- package User;
-
- use Moose;
- use MooseX::AttributeHelpers;
-
- has '_orders' => (
- metaclass => 'Collection::Array',
- is => 'ro',
- isa => 'ArrayRef',
- default => sub { [] },
- provides => {
- push => 'add_order',
- shift => 'next_order',
- elements => 'orders',
- },
- );
-
-Instead of directly exposing an array reference, we have three
-well-named, easy to use methods.
+The functionality of this MooseX module has been moved into Moose core.
+See L<Moose::Meta::Attribute::Native>.
=head1 L<Moose::Autobox>