Example:
~ $ re.pl
$ { my $abc = 10 ; $abc }
10
$ $abc
10
$
Is this a documented gotcha?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This appears to be a bug in Lexical::Persistence, which Devel::REPL uses to manage the lexical environment persisting across multiple
evals.Here’s a demonstration of the bug without Devel::REPL. This code incorrectly produces the value of
$abc, 10, even though it’s in an inner scope.I’ve reported a bug against the module, we’ll see what happens!
It’s also worth noting that Matt Trout (the primary author of Devel::REPL)’s new lexical persistence module, Eval::WithLexicals does not suffer from this problem:
produces
10as expected, then the second eval throws the expectedGlobal symbol "$abc" requires explicit package nameerror.