From: Florian Ragwitz Date: Thu, 28 May 2009 23:12:26 +0000 (+0200) Subject: Don't rely on BUILD returning the instance. X-Git-Tag: 0.00900~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c7120a5c62a269910ad42ae778910257ccf84fdc;p=gitmo%2FMooseX-Emulate-Class-Accessor-Fast.git Don't rely on BUILD returning the instance. --- diff --git a/lib/MooseX/Emulate/Class/Accessor/Fast.pm b/lib/MooseX/Emulate/Class/Accessor/Fast.pm index 6700a6b..64df919 100644 --- a/lib/MooseX/Emulate/Class/Accessor/Fast.pm +++ b/lib/MooseX/Emulate/Class/Accessor/Fast.pm @@ -76,15 +76,13 @@ my $locate_metaclass = sub { || Moose::Meta::Class->initialize($class); }; -sub BUILD { - shift; -} +sub BUILD { } around 'BUILD' => sub { my $orig = shift; my $self = shift; my %args = %{ $_[0] }; - $self = $self->$orig(\%args); + $self->$orig(\%args); my @extra = grep { !exists($self->{$_}) } keys %args; @{$self}{@extra} = @args{@extra}; return $self;