Front page | perl.perl5.porters |
Postings from October 2003
[perl #24234] irrelevant data in uninit warning when <$fh> is used
Thread Next
From:
Stas Bekman
Date:
October 18, 2003 15:30
Subject:
[perl #24234] irrelevant data in uninit warning when <$fh> is used
Message ID:
rt-24234-66136.10.4127024438181@rt.perl.org
# New Ticket Created by Stas Bekman
# Please include the string: [perl #24234]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=24234 >
This is a bug report for perl from stas@stason.org,
generated with the help of perlbug 1.34 running under perl v5.8.1.
-----------------------------------------------------------------
[Please enter your report here]
The following script:
use warnings;
use strict;
my $whatever = <DATA>;
my $a;
print "$a";
__DATA__
foo
bar
produces the warning:
Use of uninitialized value in string at /tmp/data line 7, <DATA> line 1.
which should produce:
Use of uninitialized value in string at /tmp/data line 7
as the string '<DATA> line 1' is totally irrelevant to this warning.
This problem is reproducable with perl 5.005_03 .. bleadperl
Steve Hay, who discovered this problem has mentioned that the
"perldata" manpage says:
"The filehandle is left open pointing to the contents after
__DATA__. It is the program's responsibility to close DATA when it is
done reading from it"
which I doubt has any relevance to this case, because it's perfectly
possible that the DATA filehandle gets rewound and used again as the
following example shows:
use warnings;
use strict;
my $pos = tell DATA;
print <DATA>;
my $a;
print "$a";
seek DATA, $pos, 0;
print <DATA>;
__DATA__
foo
Now imagine a function that could be called more than once and which
will want to read different parts of DATA, using tell/seek to move
around it. Advising on closing the data filehandle doesn't really work
here.
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=core
severity=low
---
Site configuration information for perl v5.8.1:
Configured by stas at Thu Sep 25 19:12:52 PDT 2003.
Summary of my perl5 (revision 5.0 version 8 subversion 1) configuration:
Platform:
osname=linux, osvers=2.4.21-0.18mdkcustom, archname=i686-linux
uname='linux rabbit.stason.org 2.4.21-0.18mdkcustom #6 mon jun 16
16:26:34 est 2003 i686 unknown unknown gnulinux '
config_args='-des -Dprefix=/home/stas/perl/5.8.1 -Doptimize=-g
-Duseshrplib -Dusedevel'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='-g',
cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include
-I/usr/include/gdbm'
ccversion='', gccversion='3.3.1 (Mandrake Linux 9.2 3.3.1-2mdk)',
gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
libc=/lib/libc-2.3.2.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.3.2'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic
-Wl,-rpath,/home/stas/perl/5.8.1/lib/5.8.1/i686-linux/CORE'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
Locally applied patches:
---
@INC for perl v5.8.1:
/home/stas/perl/5.8.1/lib/5.8.1/i686-linux
/home/stas/perl/5.8.1/lib/5.8.1
/home/stas/perl/5.8.1/lib/site_perl/5.8.1/i686-linux
/home/stas/perl/5.8.1/lib/site_perl/5.8.1
/home/stas/perl/5.8.1/lib/site_perl
.
---
Environment for perl v5.8.1:
HOME=/home/stas
LANG=en_AU
LANGUAGE=en_AU:en_US:en
LC_ADDRESS=en_AU
LC_COLLATE=en_AU
LC_CTYPE=en_AU
LC_IDENTIFICATION=en_AU
LC_MEASUREMENT=en_AU
LC_MESSAGES=en_AU
LC_MONETARY=en_AU
LC_NAME=en_AU
LC_NUMERIC=en_AU
LC_PAPER=en_AU
LC_TELEPHONE=en_AU
LC_TIME=en_AU
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/usr//bin:/bin:/usr/bin:.:/usr/local/bin:/usr/X11R6/bin:/usr/games:/home/stas/bin:/home/stas/bin:/usr/local/bin:/usr/X11R6/bin:/usr/java/j2re1.4.0/bin/
PERLDOC_PAGER=less -R
PERL_BADLANG (unset)
SHELL=/bin/tcsh
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Thread Next
-
[perl #24234] irrelevant data in uninit warning when <$fh> is used
by Stas Bekman