From: Dave Rolsky Date: Tue, 23 Mar 2010 03:28:32 +0000 (-0500) Subject: Tweak BUILD docs and fix bizarro code style in example. X-Git-Tag: 1.02~20 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3eb64847b584e8b34c4f13996908e904207b6191;p=gitmo%2FMoose.git Tweak BUILD docs and fix bizarro code style in example. --- diff --git a/lib/Moose/Manual/Construction.pod b/lib/Moose/Manual/Construction.pod index bc6f39f..2aec3c9 100644 --- a/lib/Moose/Manual/Construction.pod +++ b/lib/Moose/Manual/Construction.pod @@ -94,23 +94,21 @@ object creation. } -As C is called with the original hashref passed to new (or the -results of your C, if you have overridden the default -C.) it can also use be used to create a custom constructor -using parameters that weren't consumed by attributes. This can be -useful if you need to venture beyond what the default initialization -behavior and coercions can accomplish. +The C method is called with the hash reference of the parameters passed +to the constructor (after munging by C). This gives you a chance to +do something with parameters that do not represent object attributes. sub BUILD { my $self = shift; - my $params_hashref = shift; + my $args = shift; - $self->addFriend( My::User->new($params_hashref->{friendId}, - $params_hashref->{activationCode}) ); + $self->add_friend( + My::User->new( + user_id => $args->{user_id}, + ) + ); } - - =head3 BUILD and parent classes The interaction between multiple C methods in an inheritance