use Moo::Role ();
use Sub::Quote;
-our $VERSION = '1.002000'; # 1.2.0
+our $VERSION = '1.003001'; # 1.3.1
$VERSION = eval $VERSION;
has lexicals => (is => 'rw', default => quote_sub q{ {} });
isa => sub {
my ($val) = @_;
die "Invalid context type $val - should be list, scalar or void"
- unless $valid_contexts{$val};
+ unless $valid_contexts{$val};
},
);
}
${capture_code}
sub Eval::WithLexicals::Cage::grab_captures {
no warnings 'closure'; no strict 'vars';
- package Eval::WithLexicals::VarScope;!;
+ package! # hide from PAUSE
+ .q! Eval::WithLexicals::VarScope;!;
# rest is appended by Eval::WithLexicals::Util::capture_list, called
# during parsing by the BEGIN block from capture_code.
}
{
- package Eval::WithLexicals::Util;
+ package # hide from PAUSE
+ Eval::WithLexicals::Util;
use B qw(svref_2object);
sub capture_list {
my $pad_capture = \&Eval::WithLexicals::Cage::pad_capture;
- my @names = grep $_ ne '&', map $_->PV, grep $_->isa('B::PV'),
+ my @names = grep defined && $_ ne '&', map $_->PV, grep $_->can('PV'),
svref_2object($pad_capture)->OUTSIDE->PADLIST->ARRAYelt(0)->ARRAY;
$Eval::WithLexicals::current_code .=
'+{ '.join(', ', map "'$_' => \\$_", @names).' };'
}
}
+1;
+__END__
+
=head1 NAME
Eval::WithLexicals - pure perl eval with persistent lexical variables
David Leadbeater <dgl@dgl.cx>
+haarg - Graham Knop (cpan:HAARG) <haarg@cpan.org>
+
=head1 COPYRIGHT
Copyright (c) 2010 the Eval::WithLexicals L</AUTHOR> and L</CONTRIBUTORS>
as perl itself.
=cut
-
-1;