From: Shawn M Moore Date: Sun, 23 Aug 2009 22:40:36 +0000 (-0400) Subject: Further delegation manual cleanup X-Git-Tag: 0.89_01~5^2~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2636603457e822770fd07455d0be899be60a848f;p=gitmo%2FMoose.git Further delegation manual cleanup --- diff --git a/lib/Moose/Manual/Delegation.pod b/lib/Moose/Manual/Delegation.pod index 752917f..fd155f1 100644 --- a/lib/Moose/Manual/Delegation.pod +++ b/lib/Moose/Manual/Delegation.pod @@ -118,9 +118,11 @@ scenes C is something like sub add_item { my ($self, @items) = @_; + for my $item (@items) { $Item_TC->validate($item); } + push @{ $self->queue }, @items; } @@ -131,22 +133,23 @@ L. =head1 CURRYING Currying is a way of creating a method or function from another method or -function with one of the parameters pre-defined. Moose provides the ability to +function with some of the parameters pre-defined. Moose provides the ability to curry methods when creating delegates. package Spider; use Moose; has request => ( - is => 'ro' - isa => 'HTTP::Request', + is => 'ro' + isa => 'HTTP::Request', handles => { - set_user_agent => [ header => 'UserAgent'], + set_user_agent => [ header => 'UserAgent' ], } ) -With this definition calling C<$spider->set_user_agent('MyClient')> will -behind the scenes call C<$spider->request->header('UserAgent', 'MyClient')>. +With this definition calling C<< $spider->set_user_agent('MyClient') >> will +behind the scenes call +C<< $spider->request->header('UserAgent', 'MyClient') >>. =head1 MISSING ATTRIBUTES