X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FDevel-REPL.git;a=blobdiff_plain;f=lib%2FDevel%2FREPL%2FPlugin%2FLexEnv.pm;h=71134f9453cb164a7b30c954cd81b7595d379d1e;hp=f78fb018169f6650f4ae6c8514ee7acbe0a814f4;hb=4d33251a9f6d375aaafd8aa274743c68dec8f720;hpb=950232b2d6e2398c5f804c58e2bedf1e98fd7151 diff --git a/lib/Devel/REPL/Plugin/LexEnv.pm b/lib/Devel/REPL/Plugin/LexEnv.pm index f78fb01..71134f9 100644 --- a/lib/Devel/REPL/Plugin/LexEnv.pm +++ b/lib/Devel/REPL/Plugin/LexEnv.pm @@ -17,7 +17,11 @@ around 'mangle_line' => sub { my ($self, @rest) = @_; my $line = $self->$orig(@rest); my $lp = $self->lexical_environment; - return join('', map { "my $_;\n" } keys %{$lp->get_context('_')}).$line; + # Collate my declarations for all LP context vars then add ''; + # so an empty statement doesn't return anything (with a no warnings + # to prevent "Useless use ..." warning) + return join('', map { "my $_;\n" } keys %{$lp->get_context('_')}) + .qq{{ no warnings 'void'; ''; }\n}.$line; }; around 'execute' => sub {