From: Arthur Axel 'fREW' Schmidt Date: Thu, 26 Apr 2012 00:23:24 +0000 (-0500) Subject: fix horrible BUILDARGS example X-Git-Tag: v0.091000~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMoo.git;a=commitdiff_plain;h=f2eac33e10951b37b5d3ec6b83d81c469fcf0289 fix horrible BUILDARGS example --- diff --git a/lib/Moo.pm b/lib/Moo.pm index 1f6300d..9d746e1 100644 --- a/lib/Moo.pm +++ b/lib/Moo.pm @@ -203,13 +203,12 @@ or =head2 BUILDARGS - around BUILDARGS => sub { - my $orig = shift; + sub BUILDARGS { my ( $class, @args ) = @_; unshift @args, "attr1" if @args % 2 == 1; - return $class->$orig(@args); + return { @args }; }; Foo::Bar->new( 3 ); @@ -478,7 +477,7 @@ No support for C, C, C, or C - override can be handled by around albeit with a little more typing, and the author considers augment to be a bad idea. -The C method is not provided by default. The author suggests loading +The C method is not provided by default. The author suggests loading L into C (via C for example) and using C<$obj-E$::Dwarn()> instead.