Even better, include the code that failed to compile in the error.
Dave Rolsky [Fri, 20 Feb 2009 17:11:43 +0000 (17:11 +0000)]
lib/Class/MOP/Method/Generated.pm

index dcb2721..9392cb9 100644 (file)
@@ -51,7 +51,7 @@ sub _eval_closure {
     my $__captures = $_[1];
 
     local $@;
-    eval join(
+    my $code = join(
         "\n",
         (
             map {
@@ -67,7 +67,9 @@ sub _eval_closure {
         ),
         $_[2]
     );
-    die $@ if $@;
+    eval $code;
+
+    die "$@\n$code" if $@;
 }
 
 sub _add_line_directive {