bump the version so I can make svn Moose require this version
[gitmo/Class-MOP.git] / lib / Class / MOP / Method / Generated.pm
index 9475c92..3466747 100644 (file)
@@ -6,7 +6,7 @@ use warnings;
 
 use Carp 'confess';
 
-our $VERSION   = '0.75';
+our $VERSION   = '0.78';
 $VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
@@ -49,15 +49,29 @@ sub initialize_body {
 sub _eval_closure {
     # my ($self, $captures, $sub_body) = @_;
     my $__captures = $_[1];
-    eval join(
+
+    local $@;
+    my $code = join(
         "\n",
-        (map {
-            /^([\@\%\$])/
-                or die "capture key should start with \@, \% or \$: $_";
-            q!my !.$_.q! = !.$1.q!{$__captures->{'!.$_.q!'}};!;
-        } keys %$__captures),
+        (
+            map {
+                /^([\@\%\$])/
+                    or die "capture key should start with \@, \% or \$: $_";
+                q[my ]
+                . $_ . q[ = ]
+                . $1
+                . q[{$__captures->{']
+                . $_
+                . q['}};];
+            } keys %$__captures
+        ),
         $_[2]
     );
+    my $sub = eval $code;
+
+    die "$@\n$code" if $@;
+
+    return $sub;
 }
 
 sub _add_line_directive {