Subject: | eval does not handle well subroutines in lexical scope |
Date: | Tue, 20 Mar 2018 05:59:04 +0000 (UTC) |
To: | bug-eval-withlexicals [...] rt.cpan.org |
From: | Bernhard Bodenstorfer <bodenstorfer [...] yahoo.co.uk> |
Environment:
Observed in Eval::WithLexicals
our $VERSION = '1.003006'; # v1.3.6
perl -v
v5.26.1
Fedora Linux
4.15.9-300.fc27.i686
--------------------------------------------------------------------------------
Bug description:
The attached Perl file evalmysub.pl calls Eval::WithLexicals' eval function on a code string defining a function in lexical scope with my sub ...
This call succeeds.
But the following call which accesses a variable results in an error:
capture key should start with @, % or $
see attached error.txt
The error goes away if a fresh Eval::WithLexicals handle is created and used or if the procedure is defined without my.
The work-around is to define a lexical reference to an anonymous function.
Message body is not shown because sender requested not to inline it.
Message body is not shown because sender requested not to inline it.
Message body is not shown because sender requested not to inline it.