protect against empty string in PV
[p5sagit/Eval-WithLexicals.git] / lib / Eval / WithLexicals.pm
index 79fba31..0f9c2fa 100644 (file)
@@ -131,7 +131,7 @@ sub _eval_do {
 
   sub capture_list {
     my $pad_capture = \&Eval::WithLexicals::Cage::pad_capture;
-    my @names = grep defined && $_ ne '&', map $_->PV, grep $_->can('PV'),
+    my @names = grep defined && length && $_ ne '&', map $_->PV, grep $_->can('PV'),
       svref_2object($pad_capture)->OUTSIDE->PADLIST->ARRAYelt(0)->ARRAY;
     $Eval::WithLexicals::current_code .=
       '+{ '.join(', ', map "'$_' => \\$_", @names).' };'