-=pod
+package Moose::Manual::Delegation;
+
+# ABSTRACT: Attribute delegation
-=head1 NAME
+__END__
-Moose::Manual::Delegation - Attribute delegation
+=pod
=head1 WHAT IS DELEGATION?
mapping. You probably won't need this version often (if ever). See the
L<Moose> docs for more details on exactly how this works.
-=head1 NATIVE TRAIT DELEGATION
+=head1 NATIVE DELEGATION
-The Native Traits feature allows standard Perl data structures to be treated
-as if they were objects for the purposes of delegation.
+Native delegations allow you to delegate to standard Perl data structures as
+if they were objects.
has 'queue' => (
traits => ['Array'],
},
)
-By providing the C<Array> trait to the C<traits> parameter you tell Moose that
-you would like to use the set of Array helpers. Moose will then create
-C<add_item> and C<next_item> methods that "just works". Behind the scenes
-C<add_item> is something like
+The C<Array> trait in the C<traits> parameter tells Moose that you would like
+to use the set of Array helpers. Moose will then create C<add_item> and
+C<next_item> methods that "just work". Behind the scenes C<add_item> is
+something like
sub add_item {
my ($self, @items) = @_;
push @{ $self->queue }, @items;
}
-Moose includes the following native traits:
+Moose includes the following traits for native delegation:
=over 4
call C<< $spider->request->header('UserAgent', 'MyClient') >> behind the
scenes.
-Note that with currying, the currying always start with the first parameter to
+Note that with currying, the currying always starts with the first parameter to
a method (C<$_[0]>). Any arguments you pass to the delegation come after the
curried arguments.
will throw a runtime error if the attribute does not contain an
object.
-=head1 AUTHOR
-
-Dave Rolsky E<lt>autarch@urth.orgE<gt>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2009 by Infinity Interactive, Inc.
-
-L<http://www.iinteractive.com>
-
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
=cut