New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File-scope 'my' array is non-empty, but debugger says it's empty #1097
Comments
From rmiller@rmiller1.idx.comThe following two-line file illustrates the problem: my @res = ("A\n"); Running this with "perl -w" or "perl -w -d" produces the expected output Perl Info
|
From [Unknown Contact. See original ticket]Rich Miller writes:
More datapoints: DB<1> print @res DB<2> eval 'print @res' Something fishy... eval '...' does not see it, but eval q(eval '...') can Ilya |
From @tamiasOn Thu, Jan 27, 2000 at 06:31:01PM -0500, Ilya Zakharevich wrote:
This is probably the problem: [...]/lib/perl5/5.00503> grep \@res perl5db.pl Ronald |
From [Unknown Contact. See original ticket]On Thu, Jan 27, 2000 at 06:37:49PM -0500, Ronald J Kimball wrote:
Thanks!!! I was going to go mad... Inline Patch--- ./lib/perl5db.pl~ Tue Nov 30 22:47:10 1999
+++ ./lib/perl5db.pl Thu Jan 27 18:55:55 2000
@@ -1254,11 +1254,11 @@ sub save {
# The following takes its argument via $evalarg to preserve current @_
sub eval {
- my @res;
+ local @res; # 'my' would make it visible from user code
{
- my $otrace = $trace;
- my $osingle = $single;
- my $od = $^D;
+ local $otrace = $trace;
+ local $osingle = $single;
+ local $od = $^D;
@res = eval "$usercontext $evalarg;\n"; # '\n' for nice recursive debug
$trace = $otrace;
$single = $osingle;
Enjoy,
Ilya |
Migrated from rt.perl.org#2051 (status was 'resolved')
Searchable as RT2051$
The text was updated successfully, but these errors were encountered: