cleanup require usage so we don't trample on $@ and tweak the DEMOLISH code slightly
[gitmo/Role-Tiny.git] / lib / Sub / Quote.pm
index 337815f..f75f79d 100644 (file)
@@ -90,8 +90,11 @@ sub _unquote_all_outstanding {
     $ENV{SUB_QUOTE_DEBUG} && warn $assembled_code;
   }
   $assembled_code .= "\n1;";
-  unless (_clean_eval $assembled_code, \@assembled_captures) {
-    die "Eval went very, very wrong:\n\n${debug_code}\n\n$@";
+  {
+    local $@;
+    unless (_clean_eval $assembled_code, \@assembled_captures) {
+      die "Eval went very, very wrong:\n\n${debug_code}\n\n$@";
+    }
   }
   $ENV{SUB_QUOTE_DEBUG} && warn $debug_code;
   %QUOTE_OUTSTANDING = ();
@@ -173,7 +176,7 @@ This package provides performant ways to generate subroutines from strings.
 
 =head2 quote_sub
 
- my $coderef = quote_sub 'Foo:bar', q{ print $x++ . "\n" }, { '$x' => \0 };
+ my $coderef = quote_sub 'Foo::bar', q{ print $x++ . "\n" }, { '$x' => \0 };
 
 Arguments: ?$name, $code, ?\%captures, ?\%options