develooper Front page | perl.perl5.porters | Postings from July 2000

[ID 20000725.005] Debugger thinks closure variable isn't there

Peter Scott
July 25, 2000 18:44
[ID 20000725.005] Debugger thinks closure variable isn't there
Message ID:
I strongly suspect a bug around here, but exactly where I dunno.

Step through this in the debugger:

#!/usr/bin/perl -wd

   my $x = 'yyy';

   sub foo {
     print "\$x quite okay here\n";
     if (1) {
       print "\$x = $x\n";

main::(./foo:4):    my $x = 'yyy';
   DB<1> c foo
main::foo(./foo:7):     print "\$x quite okay here\n";
   DB<2> p $x
   DB<3> n
$x quite okay here
main::foo(./foo:8):     if (1) {
   DB<3> p $x
Use of uninitialized value in print at (eval 
18)[/usr/lib/perl5/5.6.0/] line 2.
# *** Say what??? ***
   DB<4> n
main::foo(./foo:9):       print "\$x = $x\n";
   DB<4> p $x

Also happens in 5.005_03.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
     osname=linux, osvers=2.2.14-5.0, archname=i586-linux
     uname='linux 2.2.14-5.0 #1 tue mar 7 20:53:41 est 2000 i586 
unknown '
     hint=recommended, useposix=true, d_sigaction=define
     usethreads=undef use5005threads=undef useithreads=undef 
     useperlio=undef d_sfio=undef uselargefiles=define
     use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
     cc='cc', optimize='-g', gccversion=egcs-2.91.66 19990314/Linux 
(egcs-1.1.2 release)
     cppflags='-DDEBUGGING -fno-strict-aliasing'
     ccflags ='-DDEBUGGING -fno-strict-aliasing -D_LARGEFILE_SOURCE 
     stdchar='char', d_stdstdio=define, usevfork=false
     intsize=4, longsize=4, ptrsize=4, doublesize=8
     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
     ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', 
     alignbytes=4, usemymalloc=n, prototype=define
   Linker and Libraries:
     ld='cc', ldflags =' -L/usr/local/lib'
     libpth=/usr/local/lib /lib /usr/lib
     libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
     libc=/lib/, so=so, useshrplib=false, libperl=libperl.a
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
     cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Characteristics of this binary (from libperl):
   Compile-time options: DEBUGGING USE_LARGE_FILES
   Built under linux
   Compiled at May  3 2000 12:54:39
     . Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About