Subject: | peek_my pulls in outer lexicals and package vars |
-----------
SYSTEM INFO
-----------
perl $ perl -V
Summary of my perl5 (revision 5 version 8 subversion 1) configuration:
Platform:
osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
uname=''
config_args='undef'
hint=recommended, useposix=true, d_sigaction=undef
usethreads=undef use5005threads=undef useithreads=define usemultiplicity=def
ine
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
...
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_
CONTEXT PERL_IMPLICIT_SYS
Locally applied patches:
ActivePerl Build 807
Built under MSWin32
Compiled at Oct 29 2003 19:31:41
%ENV:
PERLDOC_PAGER="less"
@INC:
c:/Perl/lib
c:/Perl/site/lib
.
-----------
EXPLANATION
-----------
I'm trying to get the lexicals one level up, but I also get the
lexicals at the top-level. top-level 'my' variables keep their
values, top-level 'our' ones don't. I'm going to have a look at
the .xs to see if I can find something, but I'd appreciate a
quick patch, or getting steered the right way. I notice this
problem with the new 'y' command in perl5db as well.
Thanks,
Eric
Here's the code that repros:
================== 8-< ==========================
#!/usr/bin/env perl
#
# Show how upper variables seek into the stack-frame being investigated
use strict;
use PadWalker;
use Data::Dumper;
sub f2 {
my $h = PadWalker::peek_my(1);
print Dumper $h;
}
our @garray = qw(these values will be dropped but the var shouldnt show);
my $topLevelValue = "this gets pulled down (incorrectly)";
$Fish::Bait = "this doesn't show up";
$main::otherVar = "does this?";
sub f1 {
my $scalar = "this also shows up";
my @array = qw(these values will show up);
&f2;
}
sub f0a {
my $f0a_var = "this doesn't get pulled down (correctly)";
&f1;
}
f0a;