correct captures assignment in quote_sub
[gitmo/Moo.git] / lib / Sub / Quote.pm
index 9b3d53a..8016b06 100644 (file)
@@ -9,7 +9,7 @@ use B 'perlstring';
 use Scalar::Util qw(weaken);
 use base qw(Exporter);
 
-our $VERSION = '1.003000';
+our $VERSION = '1.003001';
 $VERSION = eval $VERSION;
 
 our @EXPORT = qw(quote_sub unquote_sub quoted_from_sub);
@@ -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];
@@ -121,6 +121,7 @@ sub CLONE {
 }
 
 1;
+__END__
 
 =head1 NAME
 
@@ -290,3 +291,5 @@ See L<Moo> for authors.
 =head1 COPYRIGHT AND LICENSE
 
 See L<Moo> for the copyright and license.
+
+=cut