X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-Singleton.git;a=blobdiff_plain;f=lib%2FMooseX%2FSingleton%2FMeta%2FMethod%2FConstructor.pm;h=01ea6f4be80d4ed5ad1dbaf887c75e8256808490;hp=f1daddef77875264c6cf562f7a4dfb67a3470c7e;hb=ade9ece08d09a5a858e7978a970831f0f65ac3a4;hpb=0659620ac9154d588fcf54708cbb6c548f194480 diff --git a/lib/MooseX/Singleton/Meta/Method/Constructor.pm b/lib/MooseX/Singleton/Meta/Method/Constructor.pm index f1dadde..01ea6f4 100644 --- a/lib/MooseX/Singleton/Meta/Method/Constructor.pm +++ b/lib/MooseX/Singleton/Meta/Method/Constructor.pm @@ -43,7 +43,7 @@ sub _initialize_body { defined $_ ? $_->_compiled_type_constraint : undef; } @type_constraints; - my $code = $self->_compile_code( + my ( $code, $e ) = $self->_compile_code( code => $source, environment => { '$meta' => \$self, @@ -51,7 +51,10 @@ sub _initialize_body { '@type_constraints' => \@type_constraints, '@type_constraint_bodies' => \@type_constraint_bodies, }, - ) or $self->throw_error("Could not eval the constructor :\n\n$source\n\nbecause :\n\n$@", error => $@, data => $source ); + ); + + $self->throw_error("Could not eval the constructor :\n\n$source\n\nbecause :\n\n$e", error => $e, data => $source ) + if $e; $self->{'body'} = $code; }