X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMooseX%2FSingleton%2FRole%2FMeta%2FMethod%2FConstructor.pm;fp=lib%2FMooseX%2FSingleton%2FRole%2FMeta%2FMethod%2FConstructor.pm;h=650764f4902b6a4c2e07df3fd86f948ade1c9e21;hb=4793015bed7acd4be4ae858065f04f96df8c268c;hp=0521977dbddad007d7b73f71e65fc1dc983a2b23;hpb=01c3d7c185403d4e3be6732eb7804c0bcea4da4a;p=gitmo%2FMooseX-Singleton.git diff --git a/lib/MooseX/Singleton/Role/Meta/Method/Constructor.pm b/lib/MooseX/Singleton/Role/Meta/Method/Constructor.pm index 0521977..650764f 100644 --- a/lib/MooseX/Singleton/Role/Meta/Method/Constructor.pm +++ b/lib/MooseX/Singleton/Role/Meta/Method/Constructor.pm @@ -48,11 +48,14 @@ override _initialize_body => sub { = map { defined $_ ? $_->_compiled_type_constraint : undef; } @type_constraints; + my $defaults = [map { $_->default } @$attrs]; + my ( $code, $e ) = $self->_compile_code( code => $source, environment => { '$meta' => \$self, '$attrs' => \$attrs, + '$defaults' => \$defaults, '@type_constraints' => \@type_constraints, '@type_constraint_bodies' => \@type_constraint_bodies, },