Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.9k stars 541 forks source link

SPUG: Dup'ing STDIN from DATA? broken in 5.7.0 #3580

Closed p5pRT closed 16 years ago

p5pRT commented 23 years ago

Migrated from rt.perl.org#6065 (status was 'resolved')

Searchable as RT6065$

p5pRT commented 23 years ago

From dcd@tc.fluke.com

The DUP'ing of DATA has been discussed in the Seattle Perl Users Group email list spug-list@​pm.org .

the following 2 scripts require the line that matches /tell/ before they print their 3 lines of output. (my question is why is the tell(DATA) required in 5.7.0   in these cases)

--- begin script1 #! /usr/bin/perl -w

if ($] > 5.006) { tell(DATA) || die "tell​:$!"; } @​ARGV = '\<&DATA';

while (\<>) { print }

__DATA__ one little two little three little indians --- end script1

--- begin script2 #! /usr/bin/perl -pw

INIT { if ($] > 5.006) { tell(DATA) || die "tell​:$!"; } } BEGIN { @​ARGV = '\<&DATA' }

s/little/big/; s/indian/idiot/;

__DATA__ one little two little three little indians --- end script2

Perl Info ``` Flags: category=core severity=medium This perlbug was built using Perl v5.7.0 - Fri Jan 12 16:03:35 PST 2001 It is being executed now by Perl v5.7.0 - Tue Mar 6 08:55:03 PST 2001. Site configuration information for perl v5.7.0: Configured by dcd at Tue Mar 6 08:55:03 PST 2001. Summary of my perl5 (revision 5.0 version 7 subversion 0) configuration: Platform: osname=linux, osvers=2.4.3-pre2, archname=i686-linux uname='linux dd 2.4.3-pre2 #1 mon mar 5 08:49:56 pst 2001 i686 ' config_args='-Dinstallusrbinperl -Dusedevel -Doptimize=-O3 -g -de -Dcf_email=dcd@tc.fluke.com' 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 Compiler: cc='cc', ccflags ='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O3 -g', cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='egcs-2.91.66.1 19990314/Linux (egcs-1.1.2 release)', 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=4 alignbytes=4, usemymalloc=n, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lgdbm -ldbm -ldb -ldl -lm -lc perllibs=-ldl -lm -lc libc=/lib/libc.so.5.4.44, 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: DEVEL8403 @INC for perl v5.7.0: /usr/local/lib/perl5/5.7.0/i686-linux /usr/local/lib/perl5/5.7.0 /usr/local/lib/perl5/site_perl/5.7.0/i686-linux /usr/local/lib/perl5/site_perl/5.7.0 /usr/local/lib/perl5/site_perl . Environment for perl v5.7.0: HOME=/home/dcd LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/home/dcd/bin:/sbin:/usr/local/bin:/bin:/usr/bin:/usr/X11/bin:/usr/games:/usr/local/samba:/home/hobbes/tools/scripts:/home/hobbes/tools/linux:/usr0/hobbes/tools/scripts:/usr0/dcd/bin:/apps/general/bin:/usr/public PERL_BADLANG (unset) SHELL=/bin/bash ```
p5pRT commented 16 years ago

From p5p@spam.wizbit.be

On Fri Mar 16 05​:08​:35 2001\, dcd@​tc.fluke.com wrote​:

----------------------------------------------------------------- [Please enter your report here]

The DUP'ing of DATA has been discussed in the Seattle Perl Users Group email list spug-list@​pm.org .

the following 2 scripts require the line that matches /tell/ before they print their 3 lines of output. (my question is why is the tell(DATA) required in 5.7.0 in these cases)

--- begin script1 #! /usr/bin/perl -w

if ($] > 5.006) { tell(DATA) || die "tell​:$!"; } @​ARGV = '\<&DATA';

while (\<>) { print }

__DATA__ one little two little three little indians --- end script1

--- begin script2 #! /usr/bin/perl -pw

INIT { if ($] > 5.006) { tell(DATA) || die "tell​:$!"; } } BEGIN { @​ARGV = '\<&DATA' }

s/little/big/; s/indian/idiot/;

__DATA__ one little two little three little indians --- end script2

$ cat script1.pl #! /usr/bin/perl -w

@​ARGV = '\<&DATA';

while (\<>) { print }

__DATA__ one little two little three little indians __END__

perl-5.7.0 script1.pl one little two little three little indians (note​: the perl-5.7.0 in the report is different then the one I used to test. The one in the report is DEVEL8403 which was blead at the time)

perl-5.7.3 script1.pl # No perl-5.7.1 or perl-5.7.2 installed. (no output)

perl-5.8.0 script1.pl one little two little three little indians

$ cat script2.pl #! /usr/bin/perl -pw

BEGIN { @​ARGV = '\<&DATA' }

s/little/big/; s/indian/idiot/;

__DATA__ one little two little three little indians __END__

perl-5.7.0 script2.pl one big two big three big idiots

(note​: the perl-5.7.0 in the report is different then the one I used to test. The one in the report is DEVEL8403 which was blead at the time)

perl-5.7.3 script2.pl # No perl-5.7.1 or perl-5.7.2 installed. (no output)

perl-5.8.0 script1.pl one big two big three big idiots

p5pRT commented 16 years ago

p5p@spam.wizbit.be - Status changed from 'open' to 'resolved'