Perl / perl5

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

Looking for pointer to aid for updating older perl code #1164

Closed p5pRT closed 20 years ago

p5pRT commented 24 years ago

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

Searchable as RT2131$

p5pRT commented 24 years ago

From lvirden@cas.org

Created by lvirden@cas.org

This is a bug report for perl from lvirden@​cas.org\, generated with the help of perlbug 1.27 running under perl v5.5.650.

----------------------------------------------------------------- After installing this latest version of perl\, I find that scripts which invoke perl -e "eval{require 5.003};" to determine whether or no the interpreter can support the features they require get this error​: syntax error at -e line 1\, near "require 5.5" Execution of -e aborted due to compilation errors.

Is there a change that all these scripts can make so that regardless of the version of perl\, they can make this determination?

Perl Info ``` Site configuration information for perl v5.5.650: Configured by lwv26 at Thu Feb 10 08:35:00 EST 2000. Summary of my perl5 (revision 5.0 version 5 subversion 650) configuration: Platform: osname=solaris, osvers=2.6, archname=sun4-solaris uname='sunos lwv26awu 5.6 generic_105181-16 sun4u sparc sunw,ultra-5_10 ' config_args='' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usesocks=undef useperlio=undef d_sfio=undef use64bits=undef uselargefiles=define usemultiplicity=undef Compiler: cc='cc', optimize='-g', gccversion= cppflags='-DDEBUGGING -I/projects/gnu/sparc-sun-solaris2.6/include -I/vol/lwv26ldatae/include -I/usr/include -I/usr/ccs/include' ccflags ='-DDEBUGGING -I/projects/gnu/sparc-sun-solaris2.6/include -I/vol/lwv26ldatae/include -I/usr/include -I/usr/ccs/include -DUSE_LONG_LONG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' stdchar='unsigned char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 alignbytes=8, usemymalloc=y, prototype=define Linker and Libraries: ld='cc', ldflags ='-L/projects/gnu/sparc-sun-solaris2.6/lib -L/vol/lwv26ldatae/lib -L/usr/lib -L/usr/ccs/lib -R/projects/gnu/sparc-sun-solaris2.6/lib:/vol/lwv26ldatae/lib:/usr/lib:/usr/ccs/lib ' libpth=/projects/gnu/sparc-sun-solaris2.6/lib /vol/lwv26ldatae/lib /usr/lib /usr/ccs/lib libs=-lsocket -lnsl -lgdbm -ldb -ldl -lm -lc -lcrypt -lsec libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' cccdlflags='-KPIC', lddlflags='-G -L/projects/gnu/sparc-sun-solaris2.6/lib -L/vol/lwv26ldatae/lib -L/usr/lib -L/usr/ccs/lib -R/projects/gnu/sparc-sun-solaris2.6/lib:/vol/lwv26ldatae/lib:/usr/lib:/usr/ccs/lib' Locally applied patches: @INC for perl v5.5.650: /home/lwv26/lib/perl5/ /projects/sprs_lwv/lib/perl5/ /vol/lwv26ldatae/lib/perl5/5.5.650/sun4-solaris /vol/lwv26ldatae/lib/perl5/5.5.650 /vol/lwv26ldatae/lib/perl5/site_perl/5.5.650/sun4-solaris /vol/lwv26ldatae/lib/perl5/site_perl/5.5.650 /vol/lwv26ldatae/lib/perl5/site_perl . Environment for perl v5.5.650: HOME=/home/lwv26 LANG=C LANGUAGE (unset) LD_LIBRARY_PATH=/lprod/cas/lib:/usr/dt/lib:/usr/openwin/lib:/usr/lib:/vol/ora_client/product/7.3.4/lib LOGDIR (unset) PATH=/opt/SUNWspro/bin:/ldatae/bin:/projects/sprs_lwv/sol26/bin:/projects/sprs_lwv/sol26/bin/mime:/projects/sprs_lwv/sol2/bin:/projects/sprs_lwv/bin:/projects/sprs_lwv/bin/mime:/home/lwv26/bin/D.news:/usr/perl5/bin:/projects/gnu/sparc-sun-solaris2.6/bin:/usr/tcl82/sun4/bin:/usr/tcl82/bin:/projects/xopsrc/sun4/bin:/projects/xopsrc/bin:/usr/atria/bin:/projects/intranet/bin:/projects/clearcase/bin:/vol/tclsrcsol/TclPro1.3/solaris-sparc/bin:/ldata2/teTeX/bin/sparc-sun-solaris2.6:/vol/adobe/Acrobat3/bin:/ldata/bin:/home/lwv26/bin/D.aws:/home/lwv26/bin/sol2:/home/lwv26/bin/D.frontend:/home/lwv26/bin/D.ksh:/cas/test/bin/sun4:/projects/sprs_lwv/bin/sol2:/usr/java1.2/bin:/home/lwv26/bin/sun4:/lprod/cas/bin:/usr/local/bin:/usr/dt/bin:/usr/openwin/bin:/bin:/cas/bin/sun4:/cas/abin/sun4:/cas/X11/sun4/bin:/usr/ccs/bin:/uprod/bin:/usr/sbin:/cas/tools/bin/sun4:/cas/X11/sun4/tools/bin:/usr/ucb:/home/lwv26/bin:/cas/tools/pdbin/sun4:/home/lwv26/bin/D.mistypes:/home/lwv26/bin/D.toys:/home/lwv! 26/bin/D.tools:/projects/npd/npdweb/bin-sol2:/vol/ora_client/product/7.3.4/bin PERL5LIB=/home/lwv26/lib/perl5/:/projects/sprs_lwv/lib/perl5/: PERLDOC=-t PERLLIB=/home/lwv26/lib/perl:/projects/sprs_lwv/lib/perl: PERL_BADLANG (unset) SHELL=/bin/ksh ```
p5pRT commented 24 years ago

From @gsar

On Thu\, 10 Feb 2000 09​:23​:09 EST\, "Larry W. Virden" wrote​:

After installing this latest version of perl\, I find that scripts which invoke perl -e "eval{require 5.003};" to determine whether or no the interpreter can support the features they require get this error​: syntax error at -e line 1\, near "require 5.5" Execution of -e aborted due to compilation errors.

Is there a change that all these scripts can make so that regardless of the version of perl\, they can make this determination?

Nope\, you wouldn't have to change a thing. Looks like a bug to me.

Sarathy gsar@​ActiveState.com

p5pRT commented 24 years ago

From @gsar

On Thu\, 10 Feb 2000 09​:23​:09 EST\, "Larry W. Virden" wrote​:

This is a bug report for perl from lvirden@​cas.org\, generated with the help of perlbug 1.27 running under perl v5.5.650. [...] After installing this latest version of perl\, I find that scripts which invoke perl -e "eval{require 5.003};" to determine whether or no the interpreter can support the features they require get this error​: syntax error at -e line 1\, near "require 5.5" Execution of -e aborted due to compilation errors.

Here's a fix.

Sarathy gsar@​ActiveState.com

Inline Patch ```diff -----------------------------------8<----------------------------------- Change 5061 by gsar@auger on 2000/02/10 19:17:09 longstanding bug in parsing "require VERSION", could reallocate current line and not know it; exposed by change#5004; manifested as parse failure of C<{require 5.003}> Affected files ... ... //depot/perl/t/comp/require.t#9 edit ... //depot/perl/t/comp/use.t#8 edit ... //depot/perl/toke.c#195 edit Differences ... ==== //depot/perl/t/comp/require.t#9 (xtext) ==== Index: perl/t/comp/require.t --- perl/t/comp/require.t.~1~ Thu Feb 10 11:17:15 2000 +++ perl/t/comp/require.t Thu Feb 10 11:17:15 2000 @@ -7,7 +7,7 @@ # don't make this lexical $i = 1; -print "1..16\n"; +print "1..20\n"; sub do_require { %INC = (); @@ -23,6 +23,24 @@ close REQ; } +eval {require 5.005}; +print "# $@\nnot " if $@; +print "ok ",$i++,"\n"; + +eval { require 5.005 }; +print "# $@\nnot " if $@; +print "ok ",$i++,"\n"; + +eval { require 5.005; }; +print "# $@\nnot " if $@; +print "ok ",$i++,"\n"; + +eval { + require 5.005 +}; +print "# $@\nnot " if $@; +print "ok ",$i++,"\n"; + # new style version numbers eval { require v5.5.630; }; ==== //depot/perl/t/comp/use.t#8 (xtext) ==== Index: perl/t/comp/use.t --- perl/t/comp/use.t.~1~ Thu Feb 10 11:17:15 2000 +++ perl/t/comp/use.t Thu Feb 10 11:17:15 2000 @@ -5,9 +5,15 @@ unshift @INC, '../lib'; } -print "1..14\n"; +print "1..15\n"; my $i = 1; +eval "use 5.000"; # implicit semicolon +if ($@) { + print STDERR $@,"\n"; + print "not "; +} +print "ok ",$i++,"\n"; eval "use 5.000;"; if ($@) { ==== //depot/perl/toke.c#195 (text) ==== Index: perl/toke.c --- perl/toke.c.~1~ Thu Feb 10 11:17:15 2000 +++ perl/toke.c Thu Feb 10 11:17:15 2000 @@ -825,7 +825,7 @@ if (*d == 'v') d++; for (; isDIGIT(*d) || *d == '_' || *d == '.'; d++); - if ((*d == ';' || isSPACE(*d)) && *(skipspace(d)) != ',') { + if (*d == ';' || isSPACE(*d) || *d == '}' || !*d) { s = scan_num(s); /* real VERSION number -- GBARR */ version = yylval.opval; End of Patch. ```