Front page | perl.perl5.porters |
Postings from November 1999
[ID 19991118.012] Anonymous glob breaks when assigned through
From:
mjd
Date:
November 18, 1999 22:00
Subject:
[ID 19991118.012] Anonymous glob breaks when assigned through
Message ID:
19991119060135.8519.qmail@plover.com
This is a bug report for perl from mjd@plover.com,
generated with the help of perlbug 1.26 running under perl 5.00502.
-----------------------------------------------------------------
[Please enter your report here]
#!/usr/bin/perl
$x = \*F;
print "$x\n";
*{$x} = sub {};
print "$x\n";
print *$x, "\n";
print "-------------------------\n";
$y = \do { local *F };
print "$y\n";
*{$y} = sub {};
print "$y\n";
print *$y, "\n";
I want these two sections of code to do the same thing. I make a glob
reference. Then I try to assign a subroutine to the CODE part of the
glob. If the reference is to a glob like *F, it works as it should.
But if the reference is to a fake glob, as in the second section, the
assignment turns the globref into a scalar ref.
The output of the program is:
GLOB(0x81308a4)
GLOB(0x81308a4)
*main::F
-------------------------
GLOB(0x812a23c)
SCALAR(0x812a23c)
Not a GLOB reference at /tmp/oops.pl line 15.
I want it to be:
GLOB(0x81308a4)
GLOB(0x81308a4)
*main::F
-------------------------
GLOB(0x812a23c)
GLOB(0x812a23c)
*main::F
The behavior is the same under perl 5.005_02, _55, _56, _57, _61, and _62.
[Please do not change anything below this line]
-----------------------------------------------------------------
---
This perlbug was built using Perl 5.00502 - Sun Oct 18 04:25:09 CDT 1998
It is being executed now by Perl 5.00556 - Wed May 19 22:26:34 EDT 1999.
Site configuration information for perl 5.00502:
Configured by root at Sun Oct 18 04:25:09 CDT 1998.
Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration:
Platform:
osname=linux, osvers=2.0.35, archname=i586-linux
uname='linux darkstar 2.0.35 #10 tue oct 13 18:04:13 cdt 1998 i586 unknown '
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
Compiler:
cc='cc', optimize='-O2', gccversion=2.7.2.3
cppflags='-Dbool=char -DHAS_BOOL -I/usr/local/include'
ccflags ='-Dbool=char -DHAS_BOOL -I/usr/local/include'
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
alignbytes=4, usemymalloc=n, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /shlib /lib /usr/lib
libs=-lndbm -lgdbm -ldbm -ldb -ldl -lm -lc
libc=/lib/libc.so.5.4.46, 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'
Locally applied patches:
---
@INC for perl 5.00502:
/usr/lib/perl5/5.00502/i586-linux
/usr/lib/perl5/5.00502
/usr/lib/perl5/site_perl/5.005/i586-linux
/usr/lib/perl5/site_perl/5.005
.
---
Environment for perl 5.00502:
HOME=/home/mjd
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH=/lib:/usr/lib:/usr/X11R6/lib
LOGDIR (unset)
PATH=/home/mjd/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11/bin:/usr/games:/sbin:/usr/sbin:/usr/local/bin/X11:/usr/local/bin/mh:/data/mysql/bin:/home/mjd/TPI/bin:/usr/local/mysql/bin
PERL_BADLANG (unset)
SHELL=/bin/bash