Hey, here's a crazy idea, let's die we try to generate some code that
Dave Rolsky [Fri, 20 Feb 2009 17:09:13 +0000 (17:09 +0000)]
don't work.

lib/Class/MOP/Method/Generated.pm

index cbcc356..dcb2721 100644 (file)
@@ -49,6 +49,8 @@ sub initialize_body {
 sub _eval_closure {
     # my ($self, $captures, $sub_body) = @_;
     my $__captures = $_[1];
+
+    local $@;
     eval join(
         "\n",
         (
@@ -65,6 +67,7 @@ sub _eval_closure {
         ),
         $_[2]
     );
+    die $@ if $@;
 }
 
 sub _add_line_directive {