X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FStrictConstructor%2FTrait%2FMethod%2FConstructor.pm;h=219e044b55630d4a87e3f5bc8db866a5595eae3b;hb=HEAD;hp=0ceec121a4402da7c22c70b606785d503da6a9ba;hpb=714128ef886ae4a37d5aefe6910a7581150ec149;p=gitmo%2FMooseX-StrictConstructor.git diff --git a/lib/MooseX/StrictConstructor/Trait/Method/Constructor.pm b/lib/MooseX/StrictConstructor/Trait/Method/Constructor.pm index 0ceec12..219e044 100644 --- a/lib/MooseX/StrictConstructor/Trait/Method/Constructor.pm +++ b/lib/MooseX/StrictConstructor/Trait/Method/Constructor.pm @@ -6,19 +6,17 @@ use namespace::autoclean; use B (); -around '_generate_BUILDALL' => sub { +around _generate_BUILDALL => sub { my $orig = shift; my $self = shift; my $source = $self->$orig(); $source .= ";\n" if $source; - my @attrs = ( - '__INSTANCE__ => 1,', - map { B::perlstring($_) . ' => 1,' } - grep {defined} - map { $_->init_arg() } @{ $self->_attributes() } - ); + my @attrs = '__INSTANCE__ => 1,'; + push @attrs, map { B::perlstring($_) . ' => 1,' } + grep { defined } + map { $_->init_arg() } @{ $self->_attributes() }; $source .= <<"EOF"; my \%attrs = (@attrs); @@ -31,7 +29,7 @@ if (\@bad) { EOF return $source; -}; +} if $Moose::VERSION < 1.9900; 1;