correct captures assignment in quote_sub
[gitmo/Moo.git] / lib / Sub / Quote.pm
index bd75a3a..8016b06 100644 (file)
@@ -59,7 +59,7 @@ sub quote_sub {
     (ref($_[-1]) eq 'HASH' and ref($_[-2]) eq 'HASH')
       ? pop
       : {};
-  my $captures = pop if ref($_[-1]) eq 'HASH';
+  my $captures = ref($_[-1]) eq 'HASH' ? pop : undef;
   undef($captures) if $captures && !keys %$captures;
   my $code = pop;
   my $name = $_[0];