Make sure we always local-ize $@ and $SIG{__DIE__} for code evals.
[gitmo/Class-MOP.git] / lib / Class / MOP / Method / Constructor.pm
index 14a3c80..c30e0f4 100644 (file)
@@ -136,11 +136,11 @@ sub _generate_constructor_method_inline {
     $source .= ";\n" . '}';
     warn $source if $self->options->{debug};
 
-    my $code = $self->_eval_closure(
+    my ( $code, $e ) = $self->_eval_closure(
         $close_over,
         $source
     );
-    confess "Could not eval the constructor :\n\n$source\n\nbecause :\n\n$@" if $@;
+    confess "Could not eval the constructor :\n\n$source\n\nbecause :\n\n$e" if $e;
 
     return $code;
 }