diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-05-15 08:39:14 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-05-15 08:39:14 +0000 |
commit | 16ad5aca1f5177638c984f3315f96c0cd2f10334 (patch) | |
tree | 9df74b62e1f5396d43f119b6065dca88c3bd7ff7 | |
parent | 2e117952781c322d29321f4d0b7193f45488d1cb (diff) | |
parent | ec5f161023cc5696391a8f74e39775a6aaaa1bbb (diff) | |
download | perl-16ad5aca1f5177638c984f3315f96c0cd2f10334.tar.gz |
Integrate mainline.
p4raw-id: //depot/perlio@10111
-rw-r--r-- | Changes | 368 | ||||
-rwxr-xr-x | Configure | 15 | ||||
-rw-r--r-- | INSTALL | 20 | ||||
-rw-r--r-- | MANIFEST | 4 | ||||
-rw-r--r-- | Makefile.SH | 20 | ||||
-rw-r--r-- | Todo | 86 | ||||
-rw-r--r-- | Todo-5.6 | 183 | ||||
-rw-r--r-- | embed.h | 16 | ||||
-rwxr-xr-x | embed.pl | 4 | ||||
-rw-r--r-- | ext/B/B.xs | 17 | ||||
-rw-r--r-- | ext/B/B/Debug.pm | 11 | ||||
-rw-r--r-- | ext/B/B/Deparse.pm | 234 | ||||
-rw-r--r-- | ext/B/O.pm | 15 | ||||
-rw-r--r-- | ext/POSIX/hints/uts.pl | 9 | ||||
-rw-r--r-- | ext/re/re.pm | 1 | ||||
-rw-r--r-- | hints/hpux.sh | 16 | ||||
-rw-r--r-- | hints/uts.sh | 24 | ||||
-rw-r--r-- | hv.c | 8 | ||||
-rw-r--r-- | lib/AutoSplit.pm | 12 | ||||
-rw-r--r-- | lib/Class/Struct.pm | 14 | ||||
-rw-r--r-- | lib/ExtUtils/MM_Unix.pm | 2 | ||||
-rw-r--r-- | lib/Pod/Html.pm | 2 | ||||
-rw-r--r-- | mg.c | 2 | ||||
-rw-r--r-- | op.c | 49 | ||||
-rw-r--r-- | patchlevel.h | 2 | ||||
-rw-r--r-- | perl.h | 11 | ||||
-rw-r--r-- | pod/perlfaq1.pod | 4 | ||||
-rw-r--r-- | pod/perlfunc.pod | 18 | ||||
-rw-r--r-- | pod/perltodo.pod | 963 | ||||
-rw-r--r-- | pp.c | 9 | ||||
-rw-r--r-- | pp_ctl.c | 5 | ||||
-rw-r--r-- | proto.h | 4 | ||||
-rw-r--r-- | regcomp.c | 38 | ||||
-rw-r--r-- | run.c | 2 | ||||
-rwxr-xr-x | t/TEST | 57 | ||||
-rw-r--r-- | t/TestInit.pm | 3 | ||||
-rw-r--r-- | t/camel-III/vstring.t | 37 | ||||
-rwxr-xr-x | t/cmd/for.t | 13 | ||||
-rw-r--r-- | t/harness | 2 | ||||
-rw-r--r-- | t/lib/class-struct.t | 12 | ||||
-rwxr-xr-x | t/lib/filefind.t | 33 | ||||
-rwxr-xr-x | t/lib/glob-basic.t | 3 | ||||
-rw-r--r-- | t/lib/io_scalar.t | 15 | ||||
-rw-r--r-- | t/lib/md5-file.t | 2 | ||||
-rwxr-xr-x | t/op/append.t | 29 | ||||
-rwxr-xr-x | t/op/method.t | 5 | ||||
-rwxr-xr-x | t/op/pat.t | 2 | ||||
-rwxr-xr-x | t/op/regexp.t | 2 | ||||
-rwxr-xr-x | t/op/tr.t | 8 | ||||
-rwxr-xr-x | t/op/ver.t | 128 |
50 files changed, 1431 insertions, 1108 deletions
@@ -31,6 +31,374 @@ or any other branch. Version v5.7.1 Development release working toward v5.8 -------------- ____________________________________________________________________________ +[ 10104] By: jhi on 2001/05/14 18:09:07 + Log: Retract #10094. + Branch: perl + ! lib/Pod/Text.pm +____________________________________________________________________________ +[ 10103] By: jhi on 2001/05/14 15:20:58 + Log: Integrate change #10100 from maintperl. + + PL_last_in_gv may not be a GV if it was a stale filehandle (fix for + bug ID 20010514.027) + Branch: perl + !> mg.c pp_ctl.c +____________________________________________________________________________ +[ 10102] By: jhi on 2001/05/14 15:19:21 + Log: Document the deprecatedness of suidperl. + Branch: perl + ! INSTALL pod/perlfaq1.pod +____________________________________________________________________________ +[ 10101] By: jhi on 2001/05/14 14:54:31 + Log: Subject: Re: [ID 20010514.022] Makemaker a bit too prefix-happy + From: Ronald J Kimball <rjk@linguist.Thayer.dartmouth.edu> + Date: Mon, 14 May 2001 09:38:59 -0400 + Message-ID: <20010514093859.A1479715@linguist.thayer.dartmouth.edu> + Branch: perl + ! lib/ExtUtils/MM_Unix.pm +____________________________________________________________________________ +[ 10100] By: gsar on 2001/05/14 14:43:50 + Log: PL_last_in_gv may not be a GV if it was a stale filehandle (fix for + bug ID 20010514.027) + + TODO: this needs a testsuite addition + Branch: maint-5.6/perl + ! mg.c pp_ctl.c +____________________________________________________________________________ +[ 10099] By: jhi on 2001/05/14 13:42:38 + Log: More DWIMminess for Class::Struct: calling the array or hash + accessors only with one argument, an array or a hash reference, + sets the underlying array or hash. This mirrors nicely also + the usage in the constructor. + From Bernd Sokolowsky <ulmo@garozzo.franken.de>, via Damian Conway. + Branch: perl + ! lib/Class/Struct.pm t/lib/class-struct.t +____________________________________________________________________________ +[ 10098] By: jhi on 2001/05/14 13:10:34 + Log: Reference cmp'ing should go through the whole stringification + process shebang, as pointed out by Sarathy in #10091. + Branch: perl + ! pp.c +____________________________________________________________________________ +[ 10097] By: jhi on 2001/05/14 12:54:31 + Log: Subject: Re: [LONG] Cleaning up Todo/Todo-5.6/perltodo + From: Simon Cozens <simon@netthink.co.uk> + Date: Sat, 12 May 2001 16:36:27 +0100 + Message-ID: <20010512163627.A5522@netthink.co.uk> + + with some additions salvaged from Todo and Todo-5.6 before + retiring them. + Branch: perl + - Todo Todo-5.6 + ! MANIFEST pod/perltodo.pod +____________________________________________________________________________ +[ 10096] By: jhi on 2001/05/14 12:37:01 + Log: Subject: [ID 20010514.025] _SVID3 in <sys/statvfs.h> + From: "Golubev I. N." <gin@mo.msk.ru> + Date: Mon, 07 May 2001 14:33:34 (GMT) + Message-Id: <02453af6b23e63-gin@mo.msk.ru> + Branch: perl + ! perl.h +____________________________________________________________________________ +[ 10095] By: jhi on 2001/05/14 12:34:24 + Log: Subject: [ID 20010514.022] Makemaker a bit too prefix-happy + From: "Todd C. Miller" <Todd.Miller@courtesan.com> + Date: Mon, 7 May 2001 09:35:57 -0600 (MDT) + Message-Id: <200105071535.f47FZvf27235@xerxes.courtesan.com> + Branch: perl + ! lib/ExtUtils/MM_Unix.pm +____________________________________________________________________________ +[ 10094] By: jhi on 2001/05/14 12:32:44 + Log: (Retracted by #10104.) + + Subject: [PATCH bleadperl Pod::Text] avoid overquoting [Was: rand(0) is rand(1)] + From: barries <barries@slaysys.com> + Date: Sat, 12 May 2001 01:28:10 -0400 + Message-ID: <20010512012810.B26358@jester.slaysys.com> + Branch: perl + ! lib/Pod/Text.pm +____________________________________________________________________________ +[ 10093] By: jhi on 2001/05/14 12:30:38 + Log: Subject: [PATCH] Incorrect line numbers in AutoSplit + From: Mike Guy <mjtg@cam.ac.uk> + Date: Sat, 12 May 2001 19:24:33 +0100 + Message-Id: <E14ye49-0006Fn-00@libra.cus.cam.ac.uk> + Branch: perl + ! lib/AutoSplit.pm +____________________________________________________________________________ +[ 10092] By: jhi on 2001/05/14 12:29:21 + Log: Yet another HP-UX hints tweak from Merijn. + Branch: perl + ! hints/hpux.sh +____________________________________________________________________________ +[ 10091] By: gsar on 2001/05/14 04:38:32 + Log: $ref1 == $ref2 behaves unpredictably on platforms where NV_PRESERVES_UV + isn't defined (changes#9366,9368,9370 from mainline without the + pp_scmp() change) + Branch: maint-5.6/perl + ! pp.c pp.h pp_hot.c +____________________________________________________________________________ +[ 10090] By: jhi on 2001/05/12 13:39:43 + Log: The sorting seems to happen now automatically. + Branch: perl + ! t/lib/glob-basic.t +____________________________________________________________________________ +[ 10089] By: jhi on 2001/05/12 03:38:15 + Log: Subject: Re: [PATCH perlfunc.pod] split on an empty string + From: Benjamin Sugars <bsugars@canoe.ca> + Date: Fri, 11 May 2001 11:36:04 -0400 (EDT) + Message-ID: <Pine.LNX.4.21.0105111131540.1804-100000@marmot.rim.canoe.ca> + Branch: perl + ! pod/perlfunc.pod +____________________________________________________________________________ +[ 10088] By: jhi on 2001/05/12 03:37:00 + Log: Subject: Re: undef(&foo) does not work for XS functions + From: Doug MacEachern <dougm@covalent.net> + Date: Fri, 11 May 2001 16:52:29 -0700 (PDT) + Message-ID: <Pine.LNX.4.21.0105111647240.4478-100000@mako.covalent.net> + Branch: perl + ! op.c +____________________________________________________________________________ +[ 10087] By: jhi on 2001/05/12 03:35:58 + Log: Subject: [PATCH: perl@10086] fixup t/op/append.t for UTF-EBCDIC + From: Peter Prymmer <pvhp@forte.com> + Date: Fri, 11 May 2001 17:38:43 -0700 (PDT) + Message-ID: <Pine.OSF.4.10.10105111736190.73589-100000@aspara.forte.com> + Branch: perl + ! t/op/append.t +____________________________________________________________________________ +[ 10086] By: jhi on 2001/05/11 14:23:08 + Log: Update Changes. + Branch: perl + ! Changes patchlevel.h +____________________________________________________________________________ +[ 10085] By: jhi on 2001/05/11 14:08:20 + Log: Remove the 'asciir' re subpragma. Should instead implement + the 'physical vs logical' range scheme: + + \xAA-\xCC is a native physical range, you want that range of + codepoints in your native encoding. In EBCDIC the codepoints + in the gaps (between i-j and r-s) should be included. + + \x{AA}-\x{CC} is a physical Unicode range, you want that range of + codepoints in Unicode. + + a-z is a logical range, you want that range of 'logical' codepoints + in your native encoding. In EBCDIC the codepoints in the gaps + (between i-j and r-s) should not be included. + + Mixed cases (a-\xAA, etc) should either be errors, or maybe + the 'logical' endpoints should be converted to native/Unicode + codepoints, and the range handled as a physical range. + + 'Logical endpoints' are to be recognized only in the A-Z, a-z, + and 0-9 ranges. Probably a warning should be given for mixed + cases like A-z or a-9 (since such expressions are encoding + dependent), with a recommendation to use physical ranges. + Branch: perl + ! ext/re/re.pm perl.h regcomp.c regcomp.h t/op/pat.t + ! t/op/regexp.t +____________________________________________________________________________ +[ 10084] By: jhi on 2001/05/11 13:56:16 + Log: Make the test to cleanup the test directory tree + both before and after the testing so that we always + have a clean slate to work with. + Branch: perl + ! t/lib/filefind.t +____________________________________________________________________________ +[ 10083] By: jhi on 2001/05/11 13:46:30 + Log: Subject: Re: [PATCH perlfunc.pod] split on an empty string + From: Jon Eveland <jweveland@yahoo.com> + Date: Fri, 11 May 2001 07:36:28 -0700 (PDT) + Message-ID: <20010511143628.24225.qmail@web10402.mail.yahoo.com> + Branch: perl + ! pod/perlfunc.pod +____________________________________________________________________________ +[ 10082] By: jhi on 2001/05/11 13:45:06 + Log: Merge the camel-III/vstring.t with op/ver.t. + Branch: perl + - t/camel-III/vstring.t + ! MANIFEST t/TEST t/harness t/op/ver.t +____________________________________________________________________________ +[ 10081] By: jhi on 2001/05/11 13:15:55 + Log: Add test.deparse make target. + Branch: perl + ! Makefile.SH +____________________________________________________________________________ +[ 10080] By: jhi on 2001/05/11 12:52:49 + Log: Subject: [PATCH B::Deparse] $foo->bar(0) + From: Robin Houston <robin@kitsite.com> + Date: Fri, 11 May 2001 12:02:22 +0100 + Message-ID: <20010511120222.A11529@penderel> + Branch: perl + ! ext/B/B/Deparse.pm t/op/method.t +____________________________________________________________________________ +[ 10079] By: jhi on 2001/05/11 01:59:06 + Log: A nicely working combination for UTS from Hal Morris. + Branch: perl + + ext/POSIX/hints/uts.pl + ! MANIFEST hints/uts.sh +____________________________________________________________________________ +[ 10078] By: jhi on 2001/05/11 01:15:04 + Log: i_ieeefp=undef for UTS. + Branch: perl + ! hints/uts.sh +____________________________________________________________________________ +[ 10077] By: jhi on 2001/05/10 22:42:35 + Log: Subject: RE: rand(0) is rand(1) + From: Larry Shatzer <lshatzer@islanddata.com> + Date: Thu, 10 May 2001 11:09:27 -0700 + Message-ID: <95CD90709D74D4118F4600D0B79E8BC9995027@mail.islanddata.com> + Branch: perl + ! pod/perlfunc.pod +____________________________________________________________________________ +[ 10076] By: jhi on 2001/05/10 22:36:50 + Log: Subject: [patch] make op_{clear,null} public + From: Doug MacEachern <dougm@covalent.net> + Date: Thu, 10 May 2001 15:54:09 -0700 (PDT) + Message-ID: <Pine.LNX.4.21.0105101546510.2962-100000@mako.covalent.net> + Branch: perl + ! embed.h embed.pl op.c proto.h +____________________________________________________________________________ +[ 10075] By: jhi on 2001/05/10 22:28:36 + Log: Subject: [PATCH B.xs] Extend tr/\0-\377/blah/c support + From: Robin Houston <robin@kitsite.com> + Date: Thu, 10 May 2001 18:54:59 +0100 + Message-ID: <20010510185459.A5995@penderel> + Branch: perl + ! ext/B/B.xs ext/B/B/Deparse.pm t/op/tr.t +____________________________________________________________________________ +[ 10074] By: jhi on 2001/05/10 22:23:41 + Log: Subject: [PATCH B::Deparse] t/op/64bitint.t + From: Robin Houston <robin@kitsite.com> + Date: Thu, 10 May 2001 12:56:39 +0100 + Message-ID: <20010510125639.A2119@penderel> + Branch: perl + ! ext/B/B/Deparse.pm +____________________________________________________________________________ +[ 10073] By: jhi on 2001/05/10 14:26:01 + Log: Retract #10070, not ready yet. + Branch: perl + ! ext/B/B/Deparse.pm +____________________________________________________________________________ +[ 10072] By: jhi on 2001/05/10 13:40:24 + Log: The metaconfig unit change for #10071. + Branch: metaconfig + ! U/modified/mallocsrc.U +____________________________________________________________________________ +[ 10071] By: jhi on 2001/05/10 13:39:57 + Log: The #9525+#9526 didn't allow for overriding usemymalloc. + Branch: perl + ! Configure +____________________________________________________________________________ +[ 10070] By: jhi on 2001/05/10 13:18:42 + Log: (Retracted by #10073) + + Subject: Re: [PATCH t/TEST] B::Deparse tester + From: Hugo <hv@crypt.compulink.co.uk> + Date: Thu, 10 May 2001 05:48:09 +0100 + Message-Id: <200105100448.FAA13584@crypt.compulink.co.uk> + Branch: perl + ! ext/B/B/Deparse.pm +____________________________________________________________________________ +[ 10069] By: jhi on 2001/05/10 12:24:06 + Log: Add a for(func()) test. + Branch: perl + ! t/cmd/for.t +____________________________________________________________________________ +[ 10068] By: jhi on 2001/05/10 12:16:00 + Log: Subject: [PATCH B::Deparse] our() lists and foreach loops + From: Robin Houston <robin@kitsite.com> + Date: Thu, 10 May 2001 13:50:08 +0100 + Message-ID: <20010510135008.A2454@penderel> + Branch: perl + ! ext/B/B/Deparse.pm +____________________________________________________________________________ +[ 10067] By: jhi on 2001/05/10 01:45:03 + Log: A thinko in #10065. + Branch: perl + ! hv.c +____________________________________________________________________________ +[ 10066] By: jhi on 2001/05/10 01:33:12 + Log: Subject: [PATCH B::Deparse] Fix tr///ansliteration + From: Robin Houston <robin@kitsite.com> + Date: Thu, 10 May 2001 02:10:34 +0100 + Message-ID: <20010510021034.A19421@penderel> + Branch: perl + ! ext/B/B.xs ext/B/B/Deparse.pm +____________________________________________________________________________ +[ 10065] By: jhi on 2001/05/10 01:30:43 + Log: Subject: [patch] make hv_fetch{_ent} SvGMAGICAL aware + From: Doug MacEachern <dougm@covalent.net> + Date: Mon, 7 May 2001 09:50:58 -0700 (PDT) + Message-ID: <Pine.LNX.4.21.0105070947060.23808-100000@mako.covalent.net> + Branch: perl + ! hv.c +____________________________________________________________________________ +[ 10064] By: jhi on 2001/05/09 23:13:29 + Log: One more workaround for the UTS compiler from Hal Morris. + Branch: perl + ! perl.h +____________________________________________________________________________ +[ 10063] By: jhi on 2001/05/09 23:09:53 + Log: Subject: [PATCH B::Debug] Show string for PVOP, and referent for RV + From: Robin Houston <robin@kitsite.com> + Date: Thu, 10 May 2001 01:02:08 +0100 + Message-ID: <20010510010208.A18200@penderel> + Branch: perl + ! ext/B/B/Debug.pm +____________________________________________________________________________ +[ 10062] By: jhi on 2001/05/09 23:06:25 + Log: Subject: [PATCH] Simplify deb_curcv() a bit + From: Benjamin Sugars <bsugars@canoe.ca> + Date: Wed, 9 May 2001 18:14:34 -0400 (EDT) + Message-ID: <Pine.LNX.4.21.0105091811340.1160-100000@marmot.rim.canoe.ca> + Branch: perl + ! run.c +____________________________________________________________________________ +[ 10061] By: jhi on 2001/05/09 23:05:28 + Log: Subject: [PATCH] Additional test case for PerlIO::Scalar + From: Benjamin Sugars <bsugars@canoe.ca> + Date: Wed, 9 May 2001 18:03:45 -0400 (EDT) + Message-ID: <Pine.LNX.4.21.0105091758220.1160-100000@marmot.rim.canoe.ca> + Branch: perl + ! t/lib/io_scalar.t +____________________________________________________________________________ +[ 10060] By: jhi on 2001/05/09 23:04:38 + Log: Subject: [PATCH: perl@10022] update md5sum for MD5.xs on IBM-1047 + From: Peter Prymmer <pvhp@forte.com> + Date: Wed, 9 May 2001 12:08:02 -0700 (PDT) + Message-ID: <Pine.OSF.4.10.10105091205250.455254-100000@aspara.forte.com> + Branch: perl + ! t/lib/md5-file.t +____________________________________________________________________________ +[ 10059] By: jhi on 2001/05/09 23:03:52 + Log: Subject: [PATCH t/TEST] B::Deparse tester + From: Robin Houston <robin@kitsite.com> + Date: Wed, 9 May 2001 19:17:50 +0100 + Message-ID: <20010509191750.A16940@penderel> + Branch: perl + ! ext/B/O.pm t/TEST +____________________________________________________________________________ +[ 10058] By: jhi on 2001/05/09 23:02:56 + Log: Subject: [PATCH] Pod::Html -- fixes extra gaps in raw text + From: Jeff Pinyan <jeffp@crusoe.net> + Date: Wed, 9 May 2001 14:36:25 -0400 (EDT) + Message-ID: <Pine.GSO.4.21.0105091430420.357-100000@crusoe.crusoe.net> + Branch: perl + ! lib/Pod/Html.pm +____________________________________________________________________________ +[ 10057] By: nick on 2001/05/09 18:37:56 + Log: Integrate mainline. + Branch: perlio + !> Changes epoc/epocish.h ext/PerlIO/Scalar/Scalar.xs + !> hints/hpux.sh lib/Pod/Html.pm patchlevel.h perlio.c +____________________________________________________________________________ +[ 10056] By: jhi on 2001/05/09 16:44:44 + Log: Update Changes. + Branch: perl + ! Changes patchlevel.h +____________________________________________________________________________ [ 10055] By: jhi on 2001/05/09 16:26:47 Log: Integrate perlio. Branch: perl @@ -20,7 +20,7 @@ # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $ # -# Generated on Tue May 8 22:11:56 EET DST 2001 [metaconfig 3.0 PL70] +# Generated on Thu May 10 17:37:57 EET DST 2001 [metaconfig 3.0 PL70] # (with additional metaconfig patches by perlbug@perl.org) cat >c1$$ <<EOF @@ -6280,12 +6280,13 @@ eval $inhdr : determine which malloc to compile in echo " " case "$usemymalloc" in -''|[yY]*|true|$define) dflt='y' ;; -*) dflt='n' ;; -esac -case "$ptrsize" in -4) ;; -*) dflt='n' ;; +[yY]*|true|$define) dflt='y' ;; +[nN]*|false|$undef) dflt='n' ;; +*) case "$ptrsize" in + 4) dflt='y' ;; + *) dflt='n' ;; + esac + ;; esac rp="Do you wish to attempt to use the malloc that comes with $package?" . ./myread @@ -1414,6 +1414,26 @@ Study also how other non-UNIX ports have solved problems. =back +=head1 suidperl + +suiperl is an optional component, which is built or installed by default. +From perlfaq1: + + On some systems, setuid and setgid scripts (scripts written + in the C shell, Bourne shell, or Perl, for example, with the + set user or group ID permissions enabled) are insecure due to + a race condition in the kernel. For those systems, Perl versions + 5 and 4 attempt to work around this vulnerability with an optional + component, a special program named suidperl, also known as sperl. + This program attempts to emulate the set-user-ID and set-group-ID + features of the kernel. + +Because of the buggy history of suidperl, and the difficulty +of properly security auditing as large and complex piece of +software as Perl, we cannot recommend using suidperl and the feature +should be considered deprecated. +Instead use for example 'sudo': http://www.courtesan.com/sudo/ + =head1 make depend This will look for all the includes. The output is stored in makefile. @@ -60,8 +60,6 @@ README.vmesa Notes about VM/ESA port README.vms Notes about installing the VMS port README.vos Notes about Stratus VOS port README.win32 Notes about Win32 port -Todo The Wishlist -Todo-5.6 What needs doing before/during the 5.6.x release cycle Todo.micro The Wishlist for microperl XSUB.h Include file for extension subroutines apollo/netinet/in.h Apollo DomainOS port: C header file frontend @@ -414,6 +412,7 @@ ext/POSIX/hints/next_3.pl Hint for POSIX for named architecture ext/POSIX/hints/openbsd.pl Hint for POSIX for named architecture ext/POSIX/hints/sunos_4.pl Hint for POSIX for named architecture ext/POSIX/hints/svr4.pl Hint for POSIX for named architecture +ext/POSIX/hints/uts.pl Hint for POSIX for named architecture ext/POSIX/typemap POSIX extension interface types ext/PerlIO/Scalar/Makefile.PL PerlIO layer for scalars ext/PerlIO/Scalar/Scalar.pm PerlIO layer for scalars @@ -1409,7 +1408,6 @@ t/base/lex.t See if lexical items work t/base/pat.t See if pattern matching works t/base/rs.t See if record-read works t/base/term.t See if various terms work -t/camel-III/vstring.t See if Camel 3rd edition is lying. t/cmd/elsif.t See if else-if works t/cmd/for.t See if for loops work t/cmd/mod.t See if statement modifiers work diff --git a/Makefile.SH b/Makefile.SH index 051884d739..c3b1548a24 100644 --- a/Makefile.SH +++ b/Makefile.SH @@ -878,18 +878,18 @@ test_prep: miniperl ./perl$(EXE_EXT) preplibrary utilities $(dynamic_ext) $(nonx PERL=./perl $(MAKE) _test_prep _test_tty: - cd t && $(LDLIBPTH) $(PERL_DEBUG) $(PERL) TEST $(UTF8) </dev/tty + cd t && $(LDLIBPTH) $(PERL_DEBUG) $(PERL) TEST $(TEST_ARGS) </dev/tty _test_notty: - cd t && $(LDLIBPTH) $(PERL_DEBUG) PERL_SKIP_TTY_TEST=1 $(PERL) TEST $(UTF8) + cd t && $(LDLIBPTH) $(PERL_DEBUG) PERL_SKIP_TTY_TEST=1 $(PERL) TEST $(TEST_ARGS) # The second branch is for testing without a tty or controlling terminal, # see t/op/stat.t _test: if (true </dev/tty) >/dev/null 2>&1; then \ - $(MAKE) _test_tty; \ + $(MAKE) TEST_ARGS=$(TEST_ARGS) _test_tty ; \ else \ - $(MAKE) _test_notty; \ + $(MAKE) TEST_ARGS=$(TEST_ARGS) _test_notty ; \ fi @echo "Ran tests" > t/rantests @@ -903,7 +903,7 @@ test_notty: test_prep PERL=./perl $(MAKE) _test_notty utest ucheck: test_prep - PERL=./perl UTF8=-utf8 $(MAKE) _test + PERL=./perl TEST_ARGS=-utf8 $(MAKE) _test test-prep: test_prep @@ -920,11 +920,19 @@ test.third check.third: test_prep.third perl.third PERL=./perl.third PERL_DEBUG=PERL_3LOG=1 $(MAKE) _test utest.third ucheck.third: test_prep.third perl.third - PERL=./perl.third PERL_DEBUG=PERL_3LOG=1UTF=-utf8 $(MAKE) _test + PERL=./perl.third PERL_DEBUG=PERL_3LOG=1 TEST_ARGS=-utf8 $(MAKE) _test test_notty.third: test_prep.third perl.third PERL=./perl.third $(MAKE) PERL_DEBUG=PERL_3LOG=1 _test_notty +# Targets for Deparse testing. + +test.deparse: test_prep + PERL=./perl TEST_ARGS=-deparse $(MAKE) _test + +test_notty.deparse: test_prep + PERL=./perl TEST_ARGS=-deparse $(MAKE) _test_notty + # Can't depend on lib/Config.pm because that might be where miniperl # is crashing. minitest: miniperl lib/re.pm @@ -1,86 +0,0 @@ -Always check out the latest perl5-porters discussions on these subjects -before embarking on an implementation tour. - -Bugs - remove recursion in regular expression engine - fix memory leaks during compile failures - -Tie Modules - VecArray Implement array using vec() - SubstrArray Implement array using substr() - VirtualArray Implement array using a file - ShiftSplice Defines shift et al in terms of splice method - -Would be nice to have - pack "(stuff)*", "(stuff)?", "(stuff)+", "(stuff)4", ... - contiguous bitfields in pack/unpack - lexperl - bundled perl preprocessor/macro facility - this would solve many of the syntactic nice-to-haves - use posix calls internally where possible - gettimeofday (possibly best left for a module?) - format BOTTOM - -i rename file only when successfully changed - all ARGV input should act like <> - report HANDLE [formats]. - support in perlmain to rerun debugger - regression tests using __DIE__ hook - lexically scoped functions: my sub foo { ... } - the basic concept is easy and sound, - the difficulties begin with self-referential - and mutually referential lexical subs: how to - declare the subs? - lexically scoped typeglobs? (lexical I/O handles work now) - wantlvalue? more generalized want()/caller()? - named prototypes: sub foo ($foo, @bar) { ... } ? - regression/sanity tests for suidperl - iterators/lazy evaluation/continuations/first/ - first_defined/short-circuiting grep/?? - This is a very thorny and hotly debated subject, - tread carefully and do your homework first - generalise Errno way of extracting cpp symbols and use that in - Errno, Fcntl, POSIX (ExtUtils::CppSymbol?) - the _r-problem: for all the {set,get,end}*() system database - calls (and a couple more: readdir, *rand*, crypt, *time, - tmpnam) there are in many systems the _r versions - to be used in re-entrant (=multithreaded) code - Icky things: the _r API is not standardized and - the _r-forms require per-thread data to store their state - cross-compilation support - host vs target: compile in the host, get the executable to - the target, get the possible input files to the target, - execute in the target (and do not assume a UNIXish shell - in the target! e.g. no command redirection can be assumed), - get possible output files back to to host. this needs to work - both during Configure and during the build. You cannot assume - shared filesystems between the host and the target (you may need - e.g. ftp), executing the target executable may involve e.g. rsh - a way to make << and >> to shift bitvectors instead of numbers - -Possible pragmas - debugger - optimize (use less qw[memory cpu]) - -Optimizations - constant function cache - switch structures - foreach(reverse...) - cache eval tree (unless lexical outer scope used (mark in &compiling?)) - rcatmaybe - shrink opcode tables via multiple implementations selected in peep - cache hash value? (Not a win, according to Guido) - optimize away @_ where possible - tail recursion removal - "one pass" global destruction - rewrite regexp parser for better integrated optimization - LRU cache of regexp: foreach $pat (@pats) { foo() if /$pat/ } - -Vague possibilities - ref function in list context? - make tr/// return histogram in list context? - loop control on do{} et al - explicit switch statements - compile to real threaded code - structured types - autocroak? - modifiable $1 et al diff --git a/Todo-5.6 b/Todo-5.6 deleted file mode 100644 index 3fe111157e..0000000000 --- a/Todo-5.6 +++ /dev/null @@ -1,183 +0,0 @@ -Unicode support - finish byte <-> utf8 and localencoding <-> utf8 conversions - add support for I/O disciplines - - a way to set default disciplines for all handle constructors: - use open IN => ":any", OUT => ":utf8", SYS => ":utf16" - eliminate need for "use utf8;" - autoload byte.pm when byte:: is seen by the parser - make \uXXXX (and \u{XXXX}?) where XXXX are hex digits - to work similarly to Unicode tech reports and Java - notation \uXXXX (and already existing \x{XXXX))? - more than four hexdigits? make also \U+XXXX work? - overloadable regex assertions? e.g. in Thai \b cannot - be deduced by any simple character class boundary rules, - word boundaries must algorithmically computed - - see ext/Encode/Todo for notes and references about proper detection - of malformed UTF-8 - - SCSU? http://www.unicode.org/unicode/reports/tr6/ - Collation? http://www.unicode.org/unicode/reports/tr10/ - Normalization? http://www.unicode.org/unicode/reports/tr15/ - EBCDIC? http://www.unicode.org/unicode/reports/tr16/ - Regexes? http://www.unicode.org/unicode/reports/tr18/ - Case Mappings? http://www.unicode.org/unicode/reports/tr21/ - - See also "Locales", "Regexen", and "Miscellaneous". - -Multi-threading - support "use Thread;" under useithreads - add mechanism to: - - create new interpreter in a different thread - - exchange data between interpreters/threads - - share namespaces between interpreters/threads - work out consistent semantics for exit/die in threads - support for externally created threads? - Thread::Pool? - -Compiler - auto-produce executable - typed lexicals should affect B::CC::load_pad - workarounds to help Win32 - END blocks need saving in compiled output - _AUTOLOAD prodding - fix comppadlist (names in comppad_name can have fake SvCUR - from where newASSIGNOP steals the field) - -Namespace cleanup - CPP-space: restrict what we export from headers when !PERL_CORE - header-space: move into CORE/perl/? - API-space: complete the list of things that constitute public api - -Configure - make configuring+building away from source directory work (VPATH et al) - this is related to: cross-compilation configuring (see Todo) - _r support (see Todo for mode detailed description) - POSIX 1003.1 1996 Edition support--realtime stuff: - POSIX semaphores, message queues, shared memory, realtime clocks, - timers, signals (the metaconfig units mostly already exist for these) - PREFERABLY AS AN EXTENSION - UNIX98 support: reader-writer locks, realtime/asynchronous IO - PREFERABLY AS AN EXTENSION - IPv6 support: see RFC2292, RFC2553 - PREFERABLY AS AN EXTENSION - there already is Socket6 in CPAN - -Long doubles - figure out where the PV->NV->PV conversion gets it wrong at least - in AIX and Tru64 (V5.0 and onwards) when using long doubles: see the - regexp tricks we had to insert to t/comp/use.t and t/lib/bigfltpm.t, - (?:9|8999\d+) and the like. - -64-bit support - Configure probe for quad_t, uquad_t, and (argh) u_quad_t, they might - be in some systems the only thing working as quadtype and uquadtype. - more pain: long_long, u_long_long. - -Locales - deprecate traditional/legacy locales? - How do locales work across packages? - figure out how to support Unicode locales - suggestion: integrate the IBM Classes for Unicode (ICU) - http://oss.software.ibm.com/developerworks/opensource/icu/project/ - ICU is "portable, open-source Unicode library with: - charset-independent locales (with multiple locales - simultaneously supported in same thread; character - conversions; formatting/parsing for numbers, currencies, - date/time and messages; message catalogs (resources); - transliteration, collation, normalization, and text - boundaries (grapheme, word, line-break))". - Check out also the Locale Converter: - http://alphaworks.ibm.com/tech/localeconverter - There is also the iconv interface, either from XPG4 or GNU (glibc). - iconv is about character set conversions. - Either ICU or iconv would be valuable to get integrated - into Perl, Configure already probes for libiconv and <iconv.h>. - -Regexen - make RE engine thread-safe - a way to do full character set arithmetics: now one can do - addition, negate a whole class, and negate certain subclasses - (e.g. \D, [:^digit:]), but a more generic way to add/subtract/ - intersect characters/classes, like described in the Unicode technical - report on Regular Expression Guidelines, - http://www.unicode.org/unicode/reports/tr18/ - (amusingly, the TR notes that difference and intersection - can be done using "Perl-style look-ahead") - difference syntax? maybe [[:alpha:][^abc]] meaning - "all alphabetic expect a, b, and c"? or [[:alpha:]-[abc]]? - (maybe bad, as we explicitly disallow such 'ranges') - intersection syntax? maybe [[..]&[...]]? - POSIX [=bar=] and [.zap.] would nice too but there's no API for them - =bar= could be done with Unicode, though, see the Unicode TR #15 about - normalization forms: - http://www.unicode.org/unicode/reports/tr15/ - this is also a part of the Unicode 3.0: - http://www.unicode.org/unicode/uni2book/u2.html - executive summary: there are several different levels of 'equivalence' - trie optimization: factor out common suffixes (and prefixes?) - from |-alternating groups (both for exact strings and character - classes, use lookaheads?) - approximate matching - -Security - use fchown, fchmod (and futimes?) internally when possible - use fchdir(how portable?) - create secure reliable portable temporary file modules - audit the standard utilities for security problems and fix them - -Reliable Signals - custom opcodes - alternate runops() for signal despatch - figure out how to die() in delayed sighandler - make Thread::Signal work under useithreads - -Win32 stuff - sort out the spawnvp() mess for system('a','b','c') compatibility - work out DLL versioning - -Miscellaneous - introduce @( and @) because group names can have spaces - add new modules (Archive::Tar, Compress::Zlib, CPAN::FTP?) - sub-second sleep()? alarm()? time()? (integrate Time::HiRes? - Configure doesn't yet probe for usleep/nanosleep/ualarm but - the units exist) - floating point handling: nans, infinities, fp exception masks, etc. - At least the following interfaces exist: fp_classify(), fp_class(), - fp_class_d(), class(), isinf(), isfinite(), finite(), isnormal(), - unordered(), - <ieeefp.h>, <fp_class.h> (there are metaconfig units for all these) - (I think), - fp_setmask(), fp_getmask(), fp_setround(), fp_getround() - (no metaconfig units yet for these). - Don't forget finitel(), fp_classl(), fp_class_l(), (yes, both do, - unfortunately, exist), and unorderedl(). - PREFERABLY AS AN EXTENSION. - As of 5.6.1 there is cpp macro Perl_isnan(). - fix the basic arithmetics (+ - * / %) to preserve IVness/UVness if - both arguments are IVs/UVs: it sucks that one cannot see - the 'carry flag' (or equivalent) of the CPU from C, - C is too high-level... - replace pod2html with new PodtoHtml? (requires other modules from CPAN) - automate testing with large parts of CPAN - turn Cwd into an XS module? (Configure already probes for getcwd()) - mmap for speeding up input? (Configure already probes for the mmap family) - sendmsg, recvmsg? (Configure doesn't probe for these but the units exist) - sockatmark? - setitimer, getitimer? (the metaconfig units exist) - -Ongoing - keep filenames 8.3 friendly, where feasible - upgrade to newer versions of all independently maintained modules - comprehensive perldelta.pod - -Documentation - describe new age patterns - update perl{guts,call,embed,xs} with additions, changes to API - convert more examples to use autovivified filehandles - document Win32 choices - spot-check all new modules for completeness - better docs for pack()/unpack() - reorg tutorials vs. reference sections - make roffitall to be dynamical about its pods and libs - @@ -334,6 +334,8 @@ #define leave_scope Perl_leave_scope #define lex_end Perl_lex_end #define lex_start Perl_lex_start +#define op_null Perl_op_null +#define op_clear Perl_op_clear #define linklist Perl_linklist #define list Perl_list #define listkids Perl_listkids @@ -913,8 +915,6 @@ #define scalarboolean S_scalarboolean #define too_few_arguments S_too_few_arguments #define too_many_arguments S_too_many_arguments -#define op_clear S_op_clear -#define null S_null #define pad_addlex S_pad_addlex #define pad_findlex S_pad_findlex #define newDEFSVOP S_newDEFSVOP @@ -1833,6 +1833,8 @@ #define leave_scope(a) Perl_leave_scope(aTHX_ a) #define lex_end() Perl_lex_end(aTHX) #define lex_start(a) Perl_lex_start(aTHX_ a) +#define op_null(a) Perl_op_null(aTHX_ a) +#define op_clear(a) Perl_op_clear(aTHX_ a) #define linklist(a) Perl_linklist(aTHX_ a) #define list(a) Perl_list(aTHX_ a) #define listkids(a) Perl_listkids(aTHX_ a) @@ -2401,8 +2403,6 @@ #define scalarboolean(a) S_scalarboolean(aTHX_ a) #define too_few_arguments(a,b) S_too_few_arguments(aTHX_ a,b) #define too_many_arguments(a,b) S_too_many_arguments(aTHX_ a,b) -#define op_clear(a) S_op_clear(aTHX_ a) -#define null(a) S_null(aTHX_ a) #define pad_addlex(a) S_pad_addlex(aTHX_ a) #define pad_findlex(a,b,c,d,e,f,g) S_pad_findlex(aTHX_ a,b,c,d,e,f,g) #define newDEFSVOP() S_newDEFSVOP(aTHX) @@ -3596,6 +3596,10 @@ #define lex_end Perl_lex_end #define Perl_lex_start CPerlObj::Perl_lex_start #define lex_start Perl_lex_start +#define Perl_op_null CPerlObj::Perl_op_null +#define op_null Perl_op_null +#define Perl_op_clear CPerlObj::Perl_op_clear +#define op_clear Perl_op_clear #define Perl_linklist CPerlObj::Perl_linklist #define linklist Perl_linklist #define Perl_list CPerlObj::Perl_list @@ -4697,10 +4701,6 @@ #define too_few_arguments S_too_few_arguments #define S_too_many_arguments CPerlObj::S_too_many_arguments #define too_many_arguments S_too_many_arguments -#define S_op_clear CPerlObj::S_op_clear -#define op_clear S_op_clear -#define S_null CPerlObj::S_null -#define null S_null #define S_pad_addlex CPerlObj::S_pad_addlex #define pad_addlex S_pad_addlex #define S_pad_findlex CPerlObj::S_pad_findlex @@ -1673,6 +1673,8 @@ p |I32 |keyword |char* d|I32 len Ap |void |leave_scope |I32 base p |void |lex_end p |void |lex_start |SV* line +p |void |op_null |OP* o +p |void |op_clear |OP* o p |OP* |linklist |OP* o p |OP* |list |OP* o p |OP* |listkids |OP* o @@ -2296,8 +2298,6 @@ s |OP* |no_fh_allowed |OP *o s |OP* |scalarboolean |OP *o s |OP* |too_few_arguments|OP *o|char* name s |OP* |too_many_arguments|OP *o|char* name -s |void |op_clear |OP* o -s |void |null |OP* o s |PADOFFSET|pad_addlex |SV* name s |PADOFFSET|pad_findlex |char* name|PADOFFSET newoff|U32 seq \ |CV* startcv|I32 cx_ix|I32 saweval|U32 flags diff --git a/ext/B/B.xs b/ext/B/B.xs index 35e3233d68..ea4f620862 100644 --- a/ext/B/B.xs +++ b/ext/B/B.xs @@ -756,11 +756,22 @@ PVOP_pv(o) B::PVOP o CODE: /* - * OP_TRANS uses op_pv to point to a table of 256 shorts + * OP_TRANS uses op_pv to point to a table of 256 or >=258 shorts * whereas other PVOPs point to a null terminated string. */ - ST(0) = sv_2mortal(newSVpv(o->op_pv, (o->op_type == OP_TRANS) ? - 256 * sizeof(short) : 0)); + if (o->op_type == OP_TRANS && + (o->op_private & OPpTRANS_COMPLEMENT) && + !(o->op_private & OPpTRANS_DELETE)) + { + short* tbl = (short*)o->op_pv; + short entries = 257 + tbl[256]; + ST(0) = sv_2mortal(newSVpv(o->op_pv, entries * sizeof(short))); + } + else if (o->op_type == OP_TRANS) { + ST(0) = sv_2mortal(newSVpv(o->op_pv, 256 * sizeof(short))); + } + else + ST(0) = sv_2mortal(newSVpv(o->op_pv, 0)); #define LOOP_redoop(o) o->op_redoop #define LOOP_nextop(o) o->op_nextop diff --git a/ext/B/B/Debug.pm b/ext/B/B/Debug.pm index 049195b423..c69bfbfbf5 100644 --- a/ext/B/B/Debug.pm +++ b/ext/B/B/Debug.pm @@ -90,7 +90,7 @@ sub B::SVOP::debug { sub B::PVOP::debug { my ($op) = @_; $op->B::OP::debug(); - printf "\top_pv\t\t0x%x\n", $op->pv; + printf "\top_pv\t\t%s\n", cstring($op->pv); } sub B::PADOP::debug { @@ -127,6 +127,15 @@ sub B::SV::debug { EOT } +sub B::RV::debug { + my ($rv) = @_; + B::SV::debug($rv); + printf <<'EOT', ${$rv->RV}; + RV 0x%x +EOT + $rv->RV->debug; +} + sub B::PV::debug { my ($sv) = @_; $sv->B::SV::debug(); diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm index 6a51cb330c..221ca22b07 100644 --- a/ext/B/B/Deparse.pm +++ b/ext/B/B/Deparse.pm @@ -10,7 +10,7 @@ package B::Deparse; use Carp 'cluck', 'croak'; use B qw(class main_root main_start main_cv svref_2object opnumber cstring OPf_WANT OPf_WANT_VOID OPf_WANT_SCALAR OPf_WANT_LIST - OPf_KIDS OPf_REF OPf_STACKED OPf_SPECIAL + OPf_KIDS OPf_REF OPf_STACKED OPf_SPECIAL OPf_MOD OPpLVAL_INTRO OPpOUR_INTRO OPpENTERSUB_AMPER OPpSLICE OPpCONST_BARE OPpTRANS_SQUASH OPpTRANS_DELETE OPpTRANS_COMPLEMENT OPpTARGET_MY OPpCONST_ARYBASE OPpEXISTS_SUB OPpSORT_NUMERIC OPpSORT_INTEGER @@ -94,6 +94,8 @@ use warnings (); # - added more control of expanding control structures # Todo: +# (See also BUGS section at the end of this file) +# # - finish tr/// changes # - add option for even more parens (generalize \&foo change) # - left/right context @@ -113,7 +115,7 @@ use warnings (); # - here-docs? # Tests that will always fail: -# comp/redef.t -- all (redefinition happens at compile time) +# (see t/TEST for the short list) # Object fields (were globals): # @@ -959,6 +961,11 @@ sub pp_mapstart { # see also mapwhile return "XXX"; } +sub pp_method_named { + cluck "unexpected OP_METHOD_NAMED"; + return "XXX"; +} + sub pp_flip { # see also flop cluck "unexpected OP_FLIP"; return "XXX"; @@ -1818,7 +1825,8 @@ sub binop { ($left, $right) = ($right, $left); } $left = $self->deparse_binop_left($op, $left, $prec); - $left = "($left)" if $flags & LIST_CONTEXT && $left =~ /^\$/; + $left = "($left)" if $flags & LIST_CONTEXT + && $left !~ /^(my|our|local|)[\@\(]/; $right = $self->deparse_binop_right($op, $right, $prec); return $self->maybe_parens("$left $opname$eq $right", $cx, $prec); } @@ -2206,8 +2214,15 @@ sub pp_list { # This assumes that no other private flags equal 128, and that # OPs that store things other than flags in their op_private, # like OP_AELEMFAST, won't be immediate children of a list. - unless ($lop->private & OPpLVAL_INTRO + # + # OP_ENTERSUB can break this logic, so check for it. + # I suspect that open and exit can too. + + if (!($lop->private & (OPpLVAL_INTRO|OPpOUR_INTRO) or $lop->name eq "undef") + or $lop->name eq "entersub" + or $lop->name eq "exit" + or $lop->name eq "open") { $local = ""; # or not last; @@ -2215,8 +2230,10 @@ sub pp_list { if ($lop->name =~ /^pad[ash]v$/) { # my() ($local = "", last) if $local eq "local" || $local eq "our"; $local = "my"; - } elsif ($op->name =~ /^(gv|rv2)[ash]v$/ - && $op->private & OPpOUR_INTRO) { # our() + } elsif ($lop->name =~ /^(gv|rv2)[ash]v$/ + && $lop->private & OPpOUR_INTRO + or $lop->name eq "null" && $lop->first->name eq "gvsv" + && $lop->first->private & OPpOUR_INTRO) { # our() ($local = "", last) if $local eq "my" || $local eq "local"; $local = "our"; } elsif ($lop->name ne "undef") { # local() @@ -2412,6 +2429,8 @@ sub pp_leavetry { BEGIN { eval "sub OP_CONST () {" . opnumber("const") . "}" } BEGIN { eval "sub OP_STRINGIFY () {" . opnumber("stringify") . "}" } +BEGIN { eval "sub OP_RV2SV () {" . opnumber("rv2sv") . "}" } +BEGIN { eval "sub OP_LIST () {" . opnumber("list") . "}" } sub pp_null { my $self = shift; @@ -2520,6 +2539,11 @@ sub pp_aelemfast { sub rv2x { my $self = shift; my($op, $cx, $type) = @_; + + if (class($op) eq 'NULL' || !$op->can("first")) { + Carp::cluck("Unexpected op in pp_rv2x"); + return 'XXX'; + } my $kid = $op->first; my $str = $self->deparse($kid, 0); return $self->stash_variable($type, $str) if is_scalar($kid); @@ -2543,7 +2567,17 @@ sub pp_av2arylen { } # skip down to the old, ex-rv2cv -sub pp_rv2cv { $_[0]->rv2x($_[1]->first->first->sibling, $_[2], "&") } +sub pp_rv2cv { + my ($self, $op, $cx) = @_; + if (!null($op->first) && $op->first->name eq 'null' && + $op->first->targ eq OP_LIST) + { + return $self->rv2x($op->first->first->sibling, $cx, "&") + } + else { + return $self->rv2x($op, $cx, "") + } +} sub pp_rv2av { my $self = shift; @@ -2725,7 +2759,8 @@ sub method { } else { $obj = $kid; $kid = $kid->sibling; - for (; not null $kid->sibling; $kid = $kid->sibling) { + for (; !null ($kid->sibling) && $kid->name ne "method_named"; + $kid = $kid->sibling) { push @exprs, $self->deparse($kid, 6); } $meth = $kid; @@ -2745,7 +2780,7 @@ sub method { } my $args = join(", ", @exprs); $kid = $obj . "->" . $meth; - if ($args) { + if (length $args) { return $kid . "(" . $args . ")"; # parens mandatory } else { return $kid; @@ -2835,7 +2870,7 @@ sub pp_entersub { my $prefix = ""; my $amper = ""; my($kid, @exprs); - if ($op->flags & OPf_SPECIAL) { + if ($op->flags & OPf_SPECIAL && !($op->flags & OPf_MOD)) { $prefix = "do "; } elsif ($op->private & OPpENTERSUB_AMPER) { $amper = "&"; @@ -2857,7 +2892,7 @@ sub pp_entersub { } $simple = 1; # only calls of named functions can be prototyped $kid = $self->deparse($kid, 24); - } elsif (is_scalar $kid->first) { + } elsif (is_scalar ($kid->first) && $kid->first->name ne 'rv2cv') { $amper = "&"; $kid = $self->deparse($kid, 24); } else { @@ -2963,6 +2998,12 @@ sub re_uninterp { return $str; } +sub re_uninterp_extended { + my ($str) = @_; + $str =~ s/^([^#]*)/re_uninterp($1)/emg; + return $str; +} + # character escapes, but not delimiters that might need to be escaped sub escape_str { # ASCII, UTF8 my($str) = @_; @@ -2979,6 +3020,14 @@ sub escape_str { # ASCII, UTF8 return $str; } +sub escape_extended_re { + my($str) = @_; + $str =~ s/(.)/ord($1)>255 ? sprintf("\\x{%x}", ord($1)) : $1/eg; + $str =~ s/([\0\033-\037\177-\377])/'\\' . sprintf("%03o", ord($1))/ge; + $str =~ s/\n/\n\f/g; + return $str; +} + # Don't do this for regexen sub unback { my($str) = @_; @@ -3048,7 +3097,13 @@ sub const { } elsif ($sv->FLAGS & SVf_IOK) { return $sv->int_value; } elsif ($sv->FLAGS & SVf_NOK) { - return $sv->NV; + # try the default stringification + my $r = "".$sv->NV; + if ($r =~ /e/) { + # If it's in scientific notation, we might have lost information + return sprintf("%.20e", $sv->NV); + } + return $r; } elsif ($sv->FLAGS & SVf_ROK && $sv->can("RV")) { return "\\(" . const($sv->RV) . ")"; # constant folded } elsif ($sv->FLAGS & SVf_POK) { @@ -3097,13 +3152,13 @@ sub dq { } elsif ($type eq "concat") { my $first = $self->dq($op->first); my $last = $self->dq($op->last); - # Disambiguate "${foo}bar", "${foo}{bar}", "${foo}[1]" - if ($last =~ /^[A-Z\\\^\[\]_?]/) { - $first =~ s/([\$@])\^$/${1}{^}/; # "${^}W" etc - } - elsif ($last =~ /^[{\[\w]/) { - $first =~ s/([\$@])([A-Za-z_]\w*)$/${1}{$2}/; - } + + # Disambiguate "${foo}bar", "${foo}{bar}", "${foo}[1]" + ($last =~ /^[A-Z\\\^\[\]_?]/ && + $first =~ s/([\$@])\^$/${1}{^}/) # "${^}W" etc + || ($last =~ /^[{\[\w_]/ && + $first =~ s/([\$@])([A-Za-z_]\w*)$/${1}{$2}/); + return $first . $last; } elsif ($type eq "uc") { return '\U' . $self->dq($op->first->sibling) . '\E'; @@ -3169,10 +3224,13 @@ sub double_delim { } } +# Only used by tr///, so backslashes hyphens sub pchr { # ASCII my($n) = @_; if ($n == ord '\\') { return '\\\\'; + } elsif ($n == ord "-") { + return "\\-"; } elsif ($n >= ord(' ') and $n <= ord('~')) { return chr($n); } elsif ($n == ord "\a") { @@ -3215,12 +3273,10 @@ sub collapse { return $str; } -# XXX This has trouble with hyphens in the replacement (tr/bac/-AC/), -# and backslashes. - sub tr_decode_byte { my($table, $flags) = @_; - my(@table) = unpack("s256", $table); + my(@table) = unpack("s*", $table); + splice @table, 0x100, 1; # Number of subsequent elements my($c, $tr, @from, @to, @delfrom, $delhyphen); if ($table[ord "-"] != -1 and $table[ord("-") - 1] == -1 || $table[ord("-") + 1] == -1) @@ -3234,7 +3290,7 @@ sub tr_decode_byte { $delhyphen = 1; } } - for ($c = 0; $c < 256; $c++) { + for ($c = 0; $c < @table; $c++) { $tr = $table[$c]; if ($tr >= 0) { push @from, $c; push @to, $tr; @@ -3266,6 +3322,8 @@ sub tr_chr { my $x = shift; if ($x == ord "-") { return "\\-"; + } elsif ($x == ord "\\") { + return "\\\\"; } else { return chr $x; } @@ -3388,14 +3446,18 @@ sub pp_trans { # Like dq(), but different sub re_dq { my $self = shift; - my $op = shift; + my ($op, $extended) = @_; + my $type = $op->name; if ($type eq "const") { return '$[' if $op->private & OPpCONST_ARYBASE; - return re_uninterp(escape_str(re_unback($self->const_sv($op)->as_string))); + my $unbacked = re_unback($self->const_sv($op)->as_string); + return re_uninterp_extended(escape_extended_re($unbacked)) + if $extended; + return re_uninterp(escape_str($unbacked)); } elsif ($type eq "concat") { - my $first = $self->re_dq($op->first); - my $last = $self->re_dq($op->last); + my $first = $self->re_dq($op->first, $extended); + my $last = $self->re_dq($op->last, $extended); # Disambiguate "${foo}bar", "${foo}{bar}", "${foo}[1]" if ($last =~ /^[A-Z\\\^\[\]_?]/) { $first =~ s/([\$@])\^$/${1}{^}/; @@ -3405,15 +3467,15 @@ sub re_dq { } return $first . $last; } elsif ($type eq "uc") { - return '\U' . $self->re_dq($op->first->sibling) . '\E'; + return '\U' . $self->re_dq($op->first->sibling, $extended) . '\E'; } elsif ($type eq "lc") { - return '\L' . $self->re_dq($op->first->sibling) . '\E'; + return '\L' . $self->re_dq($op->first->sibling, $extended) . '\E'; } elsif ($type eq "ucfirst") { - return '\u' . $self->re_dq($op->first->sibling); + return '\u' . $self->re_dq($op->first->sibling, $extended); } elsif ($type eq "lcfirst") { - return '\l' . $self->re_dq($op->first->sibling); + return '\l' . $self->re_dq($op->first->sibling, $extended); } elsif ($type eq "quotemeta") { - return '\Q' . $self->re_dq($op->first->sibling) . '\E'; + return '\Q' . $self->re_dq($op->first->sibling, $extended) . '\E'; } elsif ($type eq "join") { return $self->deparse($op->last, 26); # was join($", @ary) } else { @@ -3421,13 +3483,54 @@ sub re_dq { } } -sub pp_regcomp { +sub pure_string { + my ($self, $op) = @_; + my $type = $op->name; + + if ($type eq 'const') { + return 1; + } + elsif ($type =~ /^[ul]c(first)?$/ || $type eq 'quotemeta') { + return $self->pure_string($op->first->sibling); + } + elsif ($type eq 'join') { + my $join_op = $op->first->sibling; # Skip pushmark + return 0 unless $join_op->name eq 'null' && $join_op->targ eq OP_RV2SV; + + my $gvop = $join_op->first; + return 0 unless $gvop->name eq 'gvsv'; + return 0 unless '"' eq $self->gv_name($self->gv_or_padgv($gvop)); + + return 0 unless ${$join_op->sibling} eq ${$op->last}; + return 0 unless $op->last->name =~ /^(rv2|pad)av$/; + } + elsif ($type eq 'concat') { + return $self->pure_string($op->first) + && $self->pure_string($op->last); + } + elsif (is_scalar($op) || $type =~ /^[ah]elem(fast)?$/) { + return 1; + } + else { + return 0; + } + + return 1; +} + +sub regcomp { my $self = shift; - my($op, $cx) = @_; + my($op, $cx, $extended) = @_; my $kid = $op->first; $kid = $kid->first if $kid->name eq "regcmaybe"; $kid = $kid->first if $kid->name eq "regcreset"; - return $self->re_dq($kid); + return ($self->re_dq($kid, $extended), 1) if $self->pure_string($kid); + return ($self->deparse($kid, $cx), 0); +} + +sub pp_regcomp { + my ($self, $op, $cx) = @_; + return (($self->regcomp($op, $cx, 0))[0]); } # osmic acid -- see osmium tetroxide @@ -3447,10 +3550,19 @@ sub matchop { $var = $self->deparse($kid, 20); $kid = $kid->sibling; } + my $quote = 1; + my $extended = ($op->pmflags & PMf_EXTENDED); if (null $kid) { - $re = re_uninterp(escape_str(re_unback($op->precomp))); + my $unbacked = re_unback($op->precomp); + if ($extended) { + $re = re_uninterp_extended(escape_extended_re($unbacked)); + } else { + $re = re_uninterp(escape_str(re_unback($op->precomp))); + } + } elsif ($kid->name ne 'regcomp') { + Carp::cluck("found ".$kid->name." where regcomp expected"); } else { - $re = $self->deparse($kid, 1); + ($re, $quote) = $self->regcomp($kid, 1, $extended); } my $flags = ""; $flags .= "c" if $op->pmflags & PMf_CONTINUE; @@ -3464,10 +3576,10 @@ sub matchop { if ($op->pmflags & PMf_ONCE) { # only one kind of delimiter works here $re =~ s/\?/\\?/g; $re = "?$re?"; - } else { + } elsif ($quote) { $re = single_delim($name, $delim, $re); } - $re = $re . $flags; + $re = $re . $flags if $quote; if ($binop) { return $self->maybe_parens("$var =~ $re", $cx, 20); } else { @@ -3952,39 +4064,12 @@ than in the input file. =item * -Lvalue method calls are not yet fully supported. (Ordinary lvalue -subroutine calls ought to be okay though.) - -=item * - -If you have a regex which is anything other than a literal of some -kind, B::Deparse will produce incorrect output. -e.g. C<$foo =~ give_me_a_regex()> will come back as -C<$foo =~ /give_me_a_regex()/> - -=item * - - m{ #foo - bar }x - -comes out as - - m/#foo\n bar/x) - -which isn't right. - -=item * - If a keyword is over-ridden, and your program explicitly calls the built-in version by using CORE::keyword, the output of B::Deparse will not reflect this. =item * -tr/// doesn't correctly handle wide characters - -=item * - C<sort foo (1, 2, 3)> comes out as C<sort (foo 1, 2, 3)>, which causes perl to issue a warning. @@ -4001,13 +4086,24 @@ Examples that fail include: use constant E2BIG => ($!=7); use constant x=>\$x; print x +=item * + +An input file that uses source filtering probably won't be deparsed into +runnable code, because it will still include the B<use> declaration +for the source filtering module, even though the code that is +produced is already ordinary Perl which shouldn't be filtered again. + +=item * + +There are probably many more bugs on non-ASCII platforms (EBCDIC). + =back =head1 AUTHOR Stephen McCamant <smcc@CSUA.Berkeley.EDU>, based on an earlier version by Malcolm Beattie <mbeattie@sable.ox.ac.uk>, with -contributions from Gisle Aas, James Duncan, Albert Dvornik, Hugo van -der Sanden, Gurusamy Sarathy, and Nick Ing-Simmons. +contributions from Gisle Aas, James Duncan, Albert Dvornik, Robin +Houston, Hugo van der Sanden, Gurusamy Sarathy, and Nick Ing-Simmons. =cut diff --git a/ext/B/O.pm b/ext/B/O.pm index 89352fb6e7..455a061325 100644 --- a/ext/B/O.pm +++ b/ext/B/O.pm @@ -4,13 +4,16 @@ use Carp; sub import { my ($class, @options) = @_; - my $quiet = 0; - if ($options[0] eq '-q') { + my ($quiet, $veryquiet) = (0, 0); + if ($options[0] eq '-q' || $options[0] eq '-qq') { $quiet = 1; - shift @options; open (SAVEOUT, ">&STDOUT"); close STDOUT; open (STDOUT, ">", \$O::BEGIN_output); + if ($options[0] eq '-qq') { + $veryquiet = 1; + } + shift @options; } my $backend = shift (@options); eval q[ @@ -37,6 +40,8 @@ sub import { } &$compilesub(); + + close STDERR if $veryquiet; } ]; die $@ if $@; @@ -67,6 +72,10 @@ produce output themselves (C<Deparse>, C<Concise> etc), so that their output is not confused with that generated by the code being compiled. +The C<-qq> option behaves like C<-q>, except that it also closes +STDERR after deparsing has finished. This suppresses the "Syntax OK" +message normally produced by perl. + =head1 CONVENTIONS Most compiler backends use the following conventions: OPTIONS diff --git a/ext/POSIX/hints/uts.pl b/ext/POSIX/hints/uts.pl new file mode 100644 index 0000000000..7a18b4a91e --- /dev/null +++ b/ext/POSIX/hints/uts.pl @@ -0,0 +1,9 @@ +# UTS - Leaving -lm in there results in death of make with the message: +# LD_RUN_PATH="/usr/ccs/lib" ld -G -z text POSIX.o \ +# -o ../../lib/auto/POS IX/POSIX.so -lm +# relocations referenced +# from file(s) +# /usr/ccs/lib/libm.a(acos.o) +# ... + +$self->{LIBS} = ['']; diff --git a/ext/re/re.pm b/ext/re/re.pm index d66bda5800..f1a4e3bc38 100644 --- a/ext/re/re.pm +++ b/ext/re/re.pm @@ -79,7 +79,6 @@ See L<perlmodlib/Pragmatic Modules>. my %bitmask = ( taint => 0x00100000, eval => 0x00200000, -asciirange => 0x02000000, ); sub setcolor { diff --git a/hints/hpux.sh b/hints/hpux.sh index 59dcdbf26a..5b0dd7ea54 100644 --- a/hints/hpux.sh +++ b/hints/hpux.sh @@ -97,7 +97,6 @@ case `$cc -v 2>&1`"" in # When HP-UX runs a script with "#!", it sets argv[0] to the script name. toke_cflags='ccflags="$ccflags -DARG_ZERO_IS_SCRIPT"' - ### 64 BITNESS case "$use64bitall" in @@ -203,7 +202,7 @@ those parts. If you are a sysadmin, and you *do* want full optimization, raise the 'maxdsiz' kernel configuration parameter to at least 0x08000000 (128 Mb) and rebuild your kernel. EOM - exit +regexec_cflags='' fi case "$ccisgcc" in @@ -232,12 +231,10 @@ case "$ccisgcc" in ;; esac if [ $maxdsiz -le 64 ]; then - # 64 Mb is probably not enough to optimize toke.c - # and regexp.c with -O2 case "$optimize" in *O2*) opt=`echo "$optimize" | sed -e 's/O2/O1/'` - toke_cflags="$ccflags $opt" - regexec_cflags="$ccflags $opt" + toke_cflags="$toke_cflags;optimize=\"$opt\"" + regexec_cflags="optimize=\"$opt\"" ;; esac fi @@ -249,13 +246,11 @@ case "$ccisgcc" in *O[3456789]*) optimize=`echo "$optimize" | sed -e 's/O[3-9]/O2/'` ;; esac if [ $maxdsiz -le 64 ]; then - # 64 Mb is probably not enough to optimize toke.c - # and regexp.c with -O (+O2) case "$optimize" in *-O*|\ *O2*) opt=`echo "$optimize" | sed -e 's/-O/+O2/' -e 's/O2/O1/' -e 's/ *+Onolimit//'` - toke_cflags="$ccflags $opt" - regexec_cflags="$ccflags $opt" + toke_cflags="$toke_cflags;optimize=\"$opt\"" + regexec_cflags="optimize=\"$opt\"" ;; esac fi @@ -265,7 +260,6 @@ case "$ccisgcc" in ;; esac - ## LARGEFILES #case "$uselargefiles-$ccisgcc" in diff --git a/hints/uts.sh b/hints/uts.sh index 01b217c96b..06a0fdab78 100644 --- a/hints/uts.sh +++ b/hints/uts.sh @@ -1,17 +1,19 @@ archname='s390' cc='cc' -ccflags='-Xa -XTSTRINGS=1500000' cccdlflags='-pic' -d_bincompat3='undef' -d_csh='undef' -d_lstat='define' -d_suidsafe='define' +ccflags='-Xa -XTSTRINGS=1500000' +d_bincompat3='undef' +d_csh='undef' +d_lstat='define' +d_suidsafe='define' dlsrc='dl_dlopen.xs' -ld='ld' +i_ieeefp='undef' +ld='ld' lddlflags='-G -z text' libperl='libperl.so' -libpth='/lib /usr/lib /usr/ccs/lib' -libs='-lsocket -lnsl -ldl -lm' -prefix='psf_prefix' -static_ext='none' -useshrplib='define' +libpth='/lib /usr/lib /usr/ccs/lib' +libs='-lsocket -lnsl -ldl -lm' +libswanted='m' +prefix='psf_prefix' +toke_cflags='optimize=""' +useshrplib='define' @@ -163,7 +163,7 @@ Perl_hv_fetch(pTHX_ HV *hv, const char *key, I32 klen, I32 lval) } if (SvRMAGICAL(hv)) { - if (mg_find((SV*)hv,'P')) { + if (mg_find((SV*)hv,'P') || SvGMAGICAL((SV*)hv)) { sv = sv_newmortal(); mg_copy((SV*)hv, sv, key, klen); PL_hv_fetch_sv = sv; @@ -283,7 +283,7 @@ Perl_hv_fetch_ent(pTHX_ HV *hv, SV *keysv, I32 lval, register U32 hash) return 0; if (SvRMAGICAL(hv)) { - if (mg_find((SV*)hv,'P')) { + if (mg_find((SV*)hv,'P') || SvGMAGICAL((SV*)hv)) { sv = sv_newmortal(); keysv = sv_2mortal(newSVsv(keysv)); mg_copy((SV*)hv, sv, (char*)keysv, HEf_SVKEY); @@ -836,7 +836,7 @@ Perl_hv_exists(pTHX_ HV *hv, const char *key, I32 klen) } if (SvRMAGICAL(hv)) { - if (mg_find((SV*)hv,'P')) { + if (mg_find((SV*)hv,'P') || SvGMAGICAL((SV*)hv)) { sv = sv_newmortal(); mg_copy((SV*)hv, sv, key, klen); magic_existspack(sv, mg_find(sv, 'p')); @@ -926,7 +926,7 @@ Perl_hv_exists_ent(pTHX_ HV *hv, SV *keysv, U32 hash) return 0; if (SvRMAGICAL(hv)) { - if (mg_find((SV*)hv,'P')) { + if (mg_find((SV*)hv,'P') || SvGMAGICAL((SV*)hv)) { SV* svret = sv_newmortal(); sv = sv_newmortal(); keysv = sv_2mortal(newSVsv(keysv)); diff --git a/lib/AutoSplit.pm b/lib/AutoSplit.pm index 8fcf528101..314715243d 100644 --- a/lib/AutoSplit.pm +++ b/lib/AutoSplit.pm @@ -54,7 +54,7 @@ $keep defaults to 0. The fourth argument, I<$check>, instructs C<autosplit> to check the module -currently being split to ensure that it does include a C<use> +currently being split to ensure that it includes a C<use> specification for the AutoLoader module, and skips the module if AutoLoader is not detected. $check defaults to 1. @@ -199,6 +199,8 @@ sub autosplit_lib_modules{ # private functions +my $self_mod_time = (stat __FILE__)[9]; + sub autosplit_file { my($filename, $autodir, $keep, $check_for_autoloader, $check_mod_time) = @_; @@ -268,7 +270,8 @@ sub autosplit_file { if ($check_mod_time){ my($al_ts_time) = (stat("$al_idx_file"))[9] || 1; - if ($al_ts_time >= $pm_mod_time){ + if ($al_ts_time >= $pm_mod_time and + $al_ts_time >= $self_mod_time){ print "AutoSplit skipped ($al_idx_file newer than $filename)\n" if ($Verbose >= 2); return undef; # one undef, not a list @@ -338,13 +341,14 @@ sub autosplit_file { if ($Verbose>=1); } push(@outfiles, $path); + my $lineno = $fnr - @cache; print OUT <<EOT; # NOTE: Derived from $filename. -# Changes made here will be lost when autosplit again. +# Changes made here will be lost when autosplit is run again. # See AutoSplit.pm. package $this_package; -#line $fnr "$filename (autosplit into $path)" +#line $lineno "$filename (autosplit into $path)" EOT print OUT @cache; @cache = (); diff --git a/lib/Class/Struct.pm b/lib/Class/Struct.pm index 6e5de810f7..5c68bf34d3 100644 --- a/lib/Class/Struct.pm +++ b/lib/Class/Struct.pm @@ -14,7 +14,7 @@ require Exporter; @ISA = qw(Exporter); @EXPORT = qw(struct); -$VERSION = '0.59'; +$VERSION = '0.60'; ## Tested on 5.002 and 5.003 without class membership tests: my $CHECK_CLASS_MEMBERSHIP = ($] >= 5.003_95); @@ -203,11 +203,13 @@ sub struct { if( defined $arrays{$name} ){ $out .= " my \$i;\n"; $out .= " \@_ ? (\$i = shift) : return \$r->$elem;\n"; + $out .= " if (ref(\$i) eq 'ARRAY' && !\@_) { \$r->$elem = \$i; return \$r }\n"; $sel = "->[\$i]"; } elsif( defined $hashes{$name} ){ $out .= " my \$i;\n"; - $out .= " \@_ ? (\$i = shift) : return \$r->$elem;\n"; + $out .= " \@_ ? (\$i = shift) : return \$r->$elem;\n"; + $out .= " if (ref(\$i) eq 'HASH' && !\@_) { \$r->$elem = \$i; return \$r }\n"; $sel = "->{\$i}"; } elsif( defined $classes{$name} ){ @@ -389,6 +391,10 @@ is C<'@'>, the accessor returns the array element value. If the element type is C<'*@'>, a reference to the array element is returned. +As a special case, when the accessor is called with an array reference +as the sole argument, this causes an assignment of the whole array element. +The object reference is returned. + =item Hash (C<'%'> or C<'*%'>) The element is a hash, initialized by default to C<()>. @@ -403,6 +409,10 @@ assigned to the hash element. If the element type is C<'%'>, the accessor returns the hash element value. If the element type is C<'*%'>, a reference to the hash element is returned. +As a special case, when the accessor is called with a hash reference +as the sole argument, this causes an assignment of the whole hash element. +The object reference is returned. + =item Class (C<'Class_Name'> or C<'*Class_Name'>) The element's value must be a reference blessed to the named diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm index 0f441d0e82..68371318de 100644 --- a/lib/ExtUtils/MM_Unix.pm +++ b/lib/ExtUtils/MM_Unix.pm @@ -3110,7 +3110,7 @@ sub prefixify { my($self,$var,$sprefix,$rprefix) = @_; $self->{uc $var} ||= $Config{lc $var}; $self->{uc $var} = VMS::Filespec::unixpath($self->{uc $var}) if $Is_VMS; - $self->{uc $var} =~ s/\Q$sprefix\E/$rprefix/s; + $self->{uc $var} =~ s,^\Q$sprefix\E(?=/|\z),$rprefix,s; } =item processPL (o) diff --git a/lib/Pod/Html.pm b/lib/Pod/Html.pm index 7a85f5cfc5..c5e085b1bf 100644 --- a/lib/Pod/Html.pm +++ b/lib/Pod/Html.pm @@ -313,7 +313,7 @@ sub clean_data($){ ${$dataref}[$i] =~ s/\s+\Z//; # have a look for all-space lines - if( ${$dataref}[$i] =~ /^\s+$/m ){ + if( ${$dataref}[$i] =~ /^\s+$/m and $dataref->[$i] !~ /^\s/ ){ my @chunks = split( /^\s+$/m, ${$dataref}[$i] ); splice( @$dataref, $i, 1, @chunks ); } @@ -674,7 +674,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) case '.': #ifndef lint if (GvIO(PL_last_in_gv)) { - sv_setiv(sv, (IV)IoLINES(GvIO(PL_last_in_gv))); + sv_setiv(sv, (IV)IoLINES(GvIOp(PL_last_in_gv))); } #endif break; @@ -735,8 +735,8 @@ Perl_op_free(pTHX_ OP *o) #endif } -STATIC void -S_op_clear(pTHX_ OP *o) +void +Perl_op_clear(pTHX_ OP *o) { switch (o->op_type) { case OP_NULL: /* Was holding old type, if any. */ @@ -871,8 +871,8 @@ S_cop_free(pTHX_ COP* cop) SvREFCNT_dec(cop->cop_io); } -STATIC void -S_null(pTHX_ OP *o) +void +Perl_op_null(pTHX_ OP *o) { if (o->op_type == OP_NULL) return; @@ -1156,7 +1156,7 @@ Perl_scalarvoid(pTHX_ OP *o) } } } - null(o); /* don't execute or even remember it */ + op_null(o); /* don't execute or even remember it */ break; case OP_POSTINC: @@ -1386,7 +1386,7 @@ Perl_mod(pTHX_ OP *o, I32 type) o->op_type = OP_RV2CV; /* entersub => rv2cv */ o->op_ppaddr = PL_ppaddr[OP_RV2CV]; assert(cUNOPo->op_first->op_type == OP_NULL); - null(((LISTOP*)cUNOPo->op_first)->op_first);/* disable pushmark */ + op_null(((LISTOP*)cUNOPo->op_first)->op_first);/* disable pushmark */ break; } else { /* lvalue subroutine call */ @@ -1758,7 +1758,7 @@ Perl_ref(pTHX_ OP *o, I32 type) o->op_type = OP_RV2CV; /* entersub => rv2cv */ o->op_ppaddr = PL_ppaddr[OP_RV2CV]; assert(cUNOPo->op_first->op_type == OP_NULL); - null(((LISTOP*)cUNOPo->op_first)->op_first); /* disable pushmark */ + op_null(((LISTOP*)cUNOPo->op_first)->op_first); /* disable pushmark */ o->op_flags |= OPf_SPECIAL; } break; @@ -2070,7 +2070,7 @@ Perl_scope(pTHX_ OP *o) o->op_ppaddr = PL_ppaddr[OP_SCOPE]; kid = ((LISTOP*)o)->op_first; if (kid->op_type == OP_NEXTSTATE || kid->op_type == OP_DBSTATE) - null(kid); + op_null(kid); } else o = newLISTOP(OP_SCOPE, 0, o, Nullop); @@ -2381,7 +2381,7 @@ Perl_convert(pTHX_ I32 type, I32 flags, OP *o) o->op_flags &= ~OPf_WANT; if (!(PL_opargs[type] & OA_MARK)) - null(cLISTOPo->op_first); + op_null(cLISTOPo->op_first); o->op_type = type; o->op_ppaddr = PL_ppaddr[type]; @@ -2491,7 +2491,7 @@ Perl_force_list(pTHX_ OP *o) { if (!o || o->op_type != OP_LIST) o = newLISTOP(OP_LIST, 0, o, Nullop); - null(o); + op_null(o); return o; } @@ -4100,7 +4100,7 @@ Perl_newFOROP(pTHX_ I32 flags,char *label,line_t forline,OP *sv,OP *expr,OP *blo op_free(expr); expr = (OP*)(listop); - null(expr); + op_null(expr); iterflags |= OPf_STACKED; } else { @@ -4216,6 +4216,9 @@ Perl_cv_undef(pTHX_ CV *cv) } CvPADLIST(cv) = Nullav; } + if (CvXSUB(cv)) { + CvXSUB(cv) = 0; + } CvFLAGS(cv) = 0; } @@ -5356,7 +5359,7 @@ Perl_ck_delete(pTHX_ OP *o) Perl_croak(aTHX_ "%s argument is not a HASH or ARRAY element or slice", PL_op_desc[o->op_type]); } - null(kid); + op_null(kid); } return o; } @@ -5386,7 +5389,7 @@ Perl_ck_eval(pTHX_ OP *o) if (!kid) { o->op_flags &= ~OPf_KIDS; - null(o); + op_null(o); } else if (kid->op_type == OP_LINESEQ) { LOGOP *enter; @@ -5442,7 +5445,7 @@ Perl_ck_exec(pTHX_ OP *o) o = ck_fun(o); kid = cUNOPo->op_first->op_sibling; if (kid->op_type == OP_RV2GV) - null(kid); + op_null(kid); } else o = listkids(o); @@ -5467,7 +5470,7 @@ Perl_ck_exists(pTHX_ OP *o) else if (kid->op_type != OP_HELEM) Perl_croak(aTHX_ "%s argument is not a HASH or ARRAY element", PL_op_desc[o->op_type]); - null(kid); + op_null(kid); } return o; } @@ -6302,7 +6305,7 @@ Perl_ck_sort(pTHX_ OP *o) } else if (kid->op_type == OP_LEAVE) { if (o->op_type == OP_SORT) { - null(kid); /* wipe out leave */ + op_null(kid); /* wipe out leave */ kid->op_next = kid; for (k = kLISTOP->op_first->op_next; k; k = k->op_next) { @@ -6333,7 +6336,7 @@ Perl_ck_sort(pTHX_ OP *o) o->op_flags |= OPf_SPECIAL; } else if (kid->op_type == OP_RV2SV || kid->op_type == OP_PADSV) - null(firstkid); + op_null(firstkid); firstkid = firstkid->op_sibling; } @@ -6496,7 +6499,7 @@ Perl_ck_subr(pTHX_ OP *o) if (cvop->op_type == OP_RV2CV) { SVOP* tmpop; o->op_private |= (cvop->op_private & OPpENTERSUB_AMPER); - null(cvop); /* disable rv2cv */ + op_null(cvop); /* disable rv2cv */ tmpop = (SVOP*)((UNOP*)cvop)->op_first; if (tmpop->op_type == OP_GV && !(o->op_private & OPpENTERSUB_AMPER)) { GV *gv = cGVOPx_gv(tmpop); @@ -6758,7 +6761,7 @@ Perl_peep(pTHX_ register OP *o) o->op_private |= OPpTARGET_MY; } } - null(o->op_next); + op_null(o->op_next); } ignore_optimization: o->op_seq = PL_op_seqmax++; @@ -6791,7 +6794,7 @@ Perl_peep(pTHX_ register OP *o) case OP_GV: if (o->op_next->op_type == OP_RV2SV) { if (!(o->op_next->op_private & OPpDEREF)) { - null(o->op_next); + op_null(o->op_next); o->op_private |= o->op_next->op_private & (OPpLVAL_INTRO | OPpOUR_INTRO); o->op_next = o->op_next->op_next; @@ -6812,9 +6815,9 @@ Perl_peep(pTHX_ register OP *o) i >= 0) { GV *gv; - null(o->op_next); - null(pop->op_next); - null(pop); + op_null(o->op_next); + op_null(pop->op_next); + op_null(pop); o->op_flags |= pop->op_next->op_flags & OPf_MOD; o->op_next = pop->op_next->op_next; o->op_type = OP_AELEMFAST; diff --git a/patchlevel.h b/patchlevel.h index 5615d49862..49c96184f8 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -70,7 +70,7 @@ #if !defined(PERL_PATCHLEVEL_H_IMPLICIT) && !defined(LOCAL_PATCH_COUNT) static char *local_patches[] = { NULL - ,"DEVEL10055" + ,"DEVEL10104" ,NULL }; @@ -1028,6 +1028,13 @@ typedef struct perl_mstats perl_mstats_t; #undef UV #endif +/* Configure gets this right but the UTS compiler gets it wrong. + -- Hal Morris <hom00@utsglobal.com> */ +#ifdef UTS +# undef UVTYPE +# define UVTYPE unsigned +#endif + /* The IV type is supposed to be long enough to hold any integral value or a pointer. @@ -2833,7 +2840,6 @@ enum { /* pass one of these to get_vtbl */ #define HINT_FILETEST_ACCESS 0x00400000 #define HINT_UTF8 0x00800000 #define HINT_UTF8_DISTINCT 0x01000000 -#define HINT_RE_ASCIIR 0x02000000 /* Various states of an input record separator SV (rs, nrs) */ #define RsSNARF(sv) (! SvOK(sv)) @@ -3579,6 +3585,9 @@ typedef struct am_table_short AMTS; #ifdef IAMSUID #ifdef I_SYS_STATVFS +# if defined(PERL_SCO) && !defined(_SVID3) +# define _SVID3 +# endif # include <sys/statvfs.h> /* for f?statvfs() */ #endif #ifdef I_SYS_MOUNT diff --git a/pod/perlfaq1.pod b/pod/perlfaq1.pod index e9ac168408..ad186264e6 100644 --- a/pod/perlfaq1.pod +++ b/pod/perlfaq1.pod @@ -306,6 +306,10 @@ In August 2000 in all Linux distributions a new security problem was found in the optional 'suidperl' (not built or installed by default) in all the Perl branches 5.6, 5.005, and 5.004, see http://www.cpan.org/src/5.0/sperl-2000-08-05/ +Perl maintenance releases 5.6.1 and 5.8.0 have this security hole closed. +Most, if not all, Linux distribution have patches for this +vulnerability available, see http://www.linuxsecurity.com/advisories/ , +but the most recommendable way is to upgrade to at least Perl 5.6.1. =head1 AUTHOR AND COPYRIGHT diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 1feb80ab8e..e959cd3da0 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -3532,8 +3532,8 @@ If EXPR is omitted, uses C<$_>. Returns a random fractional number greater than or equal to C<0> and less than the value of EXPR. (EXPR should be positive.) If EXPR is -omitted, the value C<1> is used. Automatically calls C<srand> unless -C<srand> has already been called. See also C<srand>. +omitted, or a C<0>, the value C<1> is used. Automatically calls C<srand> +unless C<srand> has already been called. See also C<srand>. Apply C<int()> to the value returned by C<rand()> if you want random integers instead of random fractional numbers. For example, @@ -4433,11 +4433,15 @@ splits on whitespace (after skipping any leading whitespace). Anything matching PATTERN is taken to be a delimiter separating the fields. (Note that the delimiter may be longer than one character.) -If LIMIT is specified and positive, splits into no more than that -many fields (though it may split into fewer). If LIMIT is unspecified -or zero, trailing null fields are stripped (which potential users -of C<pop> would do well to remember). If LIMIT is negative, it is -treated as if an arbitrarily large LIMIT had been specified. +If LIMIT is specified and positive, it represents the maximum number +of fields the EXPR will be split into, though the actual number of +fields returned depends on the number of times PATTERN matches within +EXPR. If LIMIT is unspecified or zero, trailing null fields are +stripped (which potential users of C<pop> would do well to remember). +If LIMIT is negative, it is treated as if an arbitrarily large LIMIT +had been specified. Note that splitting an EXPR that evaluates to the +empty string always returns the empty list, regardless of the LIMIT +specified. A pattern matching the null string (not to be confused with a null pattern C<//>, which is just one member of the set of patterns diff --git a/pod/perltodo.pod b/pod/perltodo.pod index 1d98fa8065..39aa37f35c 100644 --- a/pod/perltodo.pod +++ b/pod/perltodo.pod @@ -4,8 +4,7 @@ perltodo - Perl TO-DO List =head1 DESCRIPTION -This is a list of wishes for Perl. It is maintained by Nathan -Torkington for the Perl porters. Send updates to +This is a list of wishes for Perl. Send updates to I<perl5-porters@perl.org>. If you want to work on any of these projects, be sure to check the perl5-porters archives for past ideas, flames, and propaganda. This will save you time and also prevent you @@ -14,794 +13,750 @@ of archives may be found at: http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/ +=head1 To do during 5.6.x -=head1 Infrastructure +=head2 Support for I/O disciplines -=head2 Mailing list archives +C<perlio> provides this, but the interface could be a lot more +straightforward. -Chaim suggests contacting egroup and asking them to archive the other -perl.org mailing lists. Probably not advocacy, but definitely -perl6-porters, etc. +=head2 Eliminate need for "use utf8"; -=head2 Bug tracking system +While the C<utf8> pragma is autoloaded when necessary, it's still needed +for things like Unicode characters in a source file. The UTF8 hint can +always be set to true, but it needs to be set to false when F<utf8.pm> +is being compiled. (To stop Perl trying to autoload the C<utf8> +pragma...) -Richard Foley I<richard@perl.org> is writing one. We looked at -several, like gnats and the Debian system, but at the time we -investigated them, none met our needs. Since then, Jitterbug has -matured, and may be worth reinvestigation. +=head2 Autoload byte.pm -The system we've developed is the recipient of perlbug mail, and any -followups it generates from perl5-porters. New bugs are entered -into a mysql database, and sent on to -perl5-porters with the subject line rewritten to include a "ticket -number" (unique ID for the new bug). If the incoming message already -had a ticket number in the subject line, then the message is logged -against that bug. There is a separate email interface (not forwarding -to p5p) that permits porters to claim, categorize, and close tickets. +When the lexer sees, for instance, C<bytes::length>, it should +automatically load the C<bytes> pragma. -There is also a web interface to the system at http://bugs.perl.org. +=head2 Make "\u{XXXX}" et al work -The current delay in implementation is caused by perl.org lockups. -One suspect is the mail handling system, possibly going into loops. +Danger, Will Robinson! Discussing the semantics of C<"\x{F00}">, +C<"\xF00"> and C<"\U{F00}"> on P5P I<will> lead to a long and boring +flamewar. -We still desperately need a bugmaster, someone who will look at -every new "bug" and kill those that we already know about, those -that are not bugs at all, etc. +=head2 Overloadable regex assertions -=head2 Regression Tests +This may or may not be possible with the current regular expression +engine. The idea is that, for instance, C<\b> needs to be +algorithmically computed if you're dealing with Thai text. Hence, the +B<\b> assertion wants to be overloaded by a function. -The test suite for Perl serves two needs: ensuring features work, and -ensuring old bugs have not been reintroduced. Both need work. +=head2 Unicode collation and normalization -Brent LaVelle (lavelle@metronet.com) has stepped forward to work on -performance tests and improving the size of the test suite. +Simon Cozens promises to work on this. -=over 4 + Collation? http://www.unicode.org/unicode/reports/tr10/ + Normalization? http://www.unicode.org/unicode/reports/tr15/ -=item Coverage +=head2 Unicode case mappings -Do the tests that come with Perl exercise every line (or every block, -or ...) of the Perl interpreter, and if not then how can we make them -do so? + Case Mappings? http://www.unicode.org/unicode/reports/tr21/ -=item Regression +=head2 Unicode regular expression character classes -No bug fixes should be made without a corresponding testsuite addition. -This needs a dedicated enforcer, as the current pumpking is either too -lazy or too stupid or both and lets enforcement wander all over the -map. :-) +They have some tricks Perl doesn't yet implement. -=item __DIE__ + http://www.unicode.org/unicode/reports/tr18/ -Tests that fail need to be of a form that can be readily mailed -to perlbug and diagnosed with minimal back-and-forth's to determine -which test failed, due to what cause, etc. +=head2 use Thread for iThreads -=item suidperl +Artur Bergman's C<iThreads> module is a start on this, but needs to +be more mature. -We need regression/sanity tests for suidperl +=head2 Work out exit/die semantics for threads -=item The 25% slowdown from perl4 to perl5 +=head2 Typed lexicals for compiler -This value may or may not be accurate, but it certainly is -eye-catching. For some things perl5 is faster than perl4, but often -the reliability and extensibility have come at a cost of speed. The -benchmark suite that Gisle released earlier has been hailed as both a -fantastic solution and as a source of entirely meaningless figures. -Do we need to test "real applications"? Can you do so? Anyone have -machines to dedicate to the task? Identify the things that have grown -slower, and see if there's a way to make them faster. +=head2 Compiler workarounds for Win32 -=back +=head2 AUTOLOADing in the compiler -=head1 Configure +=head2 Fixing comppadlist when compiling -Andy Dougherty maintain(ed|s) a list of "todo" items for the configure -that comes with Perl. See Porting/pumpkin.pod in the latest -source release. +=head2 Cleaning up exported namespace -=head2 Install HTML +=head2 Complete signal handling -Have "make install" give you the option to install HTML as well. This -would be part of Configure. Andy Wardley (certified Perl studmuffin) -will look into the current problems of HTML installation--is -'installhtml' preventing this from happening cleanly, or is pod2html -the problem? If the latter, Brad Appleton's pod work may fix the -problem for free. +Add C<PERL_ASYNC_CHECK> to opcodes which loop; replace C<sigsetjmp> with +C<sigjmp>; check C<wait> for signal safety. -=head1 Perl Language +=head2 Out-of-source builds -=head2 Prototypes +This was done for 5.6.0, but needs reworking for 5.7.x -=over 4 +=head2 POSIX realtime support -=item Named prototypes +POSIX 1003.1 1996 Edition support--realtime stuff: POSIX semaphores, +message queues, shared memory, realtime clocks, timers, signals (the +metaconfig units mostly already exist for these) -Add proper named prototypes that actually work usefully. +=head2 UNIX98 support -=item Indirect objects +Reader-writer locks, realtime/asynchronous IO -Fix prototype bug that forgets indirect objects. +=head2 IPv6 Support -=item Method calls +There are non-core modules, such as C<Net::IPv6>, but these will need +integrating when IPv6 actually starts to really happen. See RFC 2292 +and RFC 2553. -Prototypes for method calls. +=head2 Long double conversion -=item Context +Floating point formatting is still causing some weird test failures. -Return context prototype declarations. +=head2 Locales -=item Scoped subs +Locales and Unicode interact with each other in unpleasant ways. +One possible solution would be to adopt/support ICU: -lexically-scoped subs, e.g. my sub + http://oss.software.ibm.com/developerworks/opensource/icu/project/ -=back +=head2 Thread-safe regexes -=head1 Perl Internals +The regular expression engine is currently non-threadsafe. -=head2 magic_setisa +=head2 Arithmetic on non-Arabic numerals -C<magic_setisa> should be made to update %FIELDS [???] +C<[1234567890]> aren't the only numerals any more. -=head2 Garbage Collection +=head2 POSIX Unicode character classes -There was talk of a mark-and-sweep garbage collector at TPC2, but the -(to users) unpredictable nature of its behaviour put some off. -Sarathy, I believe, did the work. Here's what he has to say: +([=a=] for equivalance classes, [.ch.] for collation.) +These are dependent on Unicode normalization and collation. -Yeah, I hope to implement it someday too. The points that were -raised in TPC2 were all to do with calling DESTROY() methods, but -I think we can accommodate that by extending bless() to stash -extra information for objects so we track their lifetime accurately -for those that want their DESTROY() to be predictable (this will be -a speed hit, naturally, and will therefore be optional, naturally. :) +=head2 Factoring out common suffices/prefices in regexps (trie optimization) -[N.B. Don't even ask me about this now! When I have the time to -write a cogent summary, I'll post it.] +Currently, the user has to optimize C<foo|far> and C<foo|goo> into +C<f(?:oo|ar)> and C<[fg]oo> by hand; this could be done automatically. -=head2 Reliable signals +=head2 Security audit shipped utilities -Mostly done in Perl 5.8, there is now a reliable signal handler -despatch. No measurable slowdown detected in Linux or Solaris -with the 5.8 approach (implemented by Nick I-S). +All the code we ship with Perl needs to be sensible about temporary file +handling, locking, input validation, and so on. -There are at least three things to consider: +=head2 Custom opcodes -=over 4 +Have a way to introduce user-defined opcodes without the subroutine call +overhead of an XSUB; the user should be able to create PP code. Simon +Cozens has some ideas on this. -=item Alternate runops() for signal despatch +=head2 spawnvp() on Win32 -Sarathy and Dan discussed this on perl5-porters. +Win32 has problems spawning processes, particularly when the arguments +to the child process contain spaces, quotes or tab characters. -=item Figure out how to die() in delayed sighandler +=head2 DLL Versioning -=item Add tests for Thread::Signal +Windows needs a way to know what version of a XS or C<libperl> DLL it's +loading. -=item Automatic tests against CPAN +=head2 Introduce @( and @) -Is there some way to automatically build all/most of CPAN with -the new Perl and check that the modules there pass all the tests? +C<$(> may return "foo bar baz". Unfortunately, since groups can +theoretically have spaces in their names, this could be one, two or +three groups. -=back +=head2 Floating point handling -=head2 Interpolated regex performance bugs +C<NaN> and C<inf> support is particularly troublesome. +(fp_classify(), fp_class(), fp_class_d(), class(), isinf(), +isfinite(), finite(), isnormal(), unordered(), <ieeefp.h>, +<fp_class.h> (there are metaconfig units for all these) (I think), +fp_setmask(), fp_getmask(), fp_setround(), fp_getround() +(no metaconfig units yet for these). Don't forget finitel(), fp_classl(), +fp_class_l(), (yes, both do, unfortunately, exist), and unorderedl().) - while (<>) { - $found = 0; - foreach $pat (@patterns) { - $found++ if /$pat/o; - } - print if $found; - } +As of Perl 5.6.1 is a Perl macro, Perl_isnan(). -The qr// syntax added in 5.005 has solved this problem, but -it needs more thorough documentation. +=head2 IV/UV preservation -=head2 Memory leaks from failed eval/regcomp +Nicholas Clark has done a lot of work on this, but work is continuing. +C<+>, C<-> and C<*> work, but guards need to be in place for C<%>, C</>, +C<&>, C<oct>, C<hex> and C<pack>. -The only known memory leaks in Perl are in failed code or regexp -compilation. Fix this. +=head2 Replace pod2html with something using Pod::Parser -Noticed in Perl 5.6: Also local()ising tied variables leak. +The CPAN module C<Malik::Pod::Html> may be a more suitable basis for a +C<pod2html> convertor; the current one duplicates the functionality +abstracted in C<Pod::Parser>, which makes updating the POD language +difficult. -=head2 Make XS easier to use +=head2 Automate module testing on CPAN -There was interest in SWIG from porters, but nothing has happened -lately. +When a new Perl is being beta tested, porters have to manually grab +their favourite CPAN modules and test them - this should be done +automatically. -New development in 2001: the Inline module, when it gels, shows great -promise. +=head2 sendmsg and recvmsg -=head2 Make embedded Perl easier to use +We have all the other BSD socket functions but these. There are +metaconfig units for these functions which can be added. To avoid these +being new opcodes, a solution similar to the way C<sockatmark> was added +would be preferable. (Autoload the C<IO::whatever> module.) -This is probably difficult for the same reasons that "XS For Dummies" -will be difficult. +=head2 Rewrite perlre documentation -=head2 Namespace cleanup +The new-style patterns need full documentation, and the whole document +needs to be a lot clearer. - CPP-space: restrict CPP symbols exported from headers - header-space: move into CORE/perl/ - API-space: begin list of things that constitute public api - env-space: Configure should use PERL_CONFIG instead of CONFIG etc. +=head2 Convert example code to IO::Handle filehandles -=head2 MULTIPLICITY +=head2 Document Win32 choices -Complete work on safe recursive interpreters C<Perl-E<gt>new()>. -Sarathy says that a reference implementation exists. +=head2 Check new modules -=head2 MacPerl +=head2 Make roffitall find pods and libs itself -Chris Nandor and Matthias Neeracher are working on better integrating -MacPerl into the Perl distribution. +Simon Cozens has done some work on this but it needs a rethink. -=head1 Documentation +=head1 To do at some point -There's a lot of documentation that comes with Perl. The quantity of -documentation makes it difficult for users to know which section of -which manpage to read in order to solve their problem. Tom -Christiansen has done much of the documentation work in the past. +These are ideas that have been regularly tossed around, that most +people believe should be done maybe during 5.8.x -=head2 A clear division into tutorial and reference +=head2 Remove regular expression recursion -Some manpages (e.g., perltoot and perlreftut) clearly set out to -educate the reader about a subject. Other manpages (e.g., perlsub) -are references for which there is no tutorial, or are references with -a slight tutorial bent. If things are either tutorial or reference, -then the reader knows which manpage to read to learn about a subject, -and which manpage to read to learn all about an aspect of that -subject. Part of the solution to this is: +Because the regular expression engine is recursive, badly designed +expressions can lead to lots of recursion filling up the stack. Ilya +claims that it is easy to convert the engine to being iterative, but +this has still not yet been done. There may be a regular expression +engine hit squad meeting at TPC5. -=head2 Remove the artificial distinction between operators and functions +=head2 Memory leaks after failed eval -History shows us that users, and often porters, aren't clear on the -operator-function distinction. The present split in reference -material between perlfunc and perlop hinders user navigation. Given -that perlfunc is by far the larger of the two, move operator reference -into perlfunc. +Perl will leak memory if you C<eval "hlagh hlagh hlagh hlagh">. This is +partially because it attempts to build up an op tree for that code and +doesn't properly free it. The same goes for non-syntactically-correct +regular expressions. Hugo looked into this, but decided it needed a +mark-and-sweep GC implementation. -=head2 More tutorials +Alan notes that: The basic idea was to extend the parser token stack +(C<YYSTYPE>) to include a type field so we knew what sort of thing each +element of the stack was. The F<<perly.c> code would then have to be +postprocessed to record the type of each entry on the stack as it was +created, and the parser patched so that it could unroll the stack +properly on error. -More documents of a tutorial nature could help. Here are some -candidates: +This is possible to do, but would be pretty messy to implement, as it +would rely on even more sed hackery in F<perly.fixer>. -=over 4 +=head2 pack "(stuff)*" -=item I/O +That's to say, C<pack "(sI)40"> would be the same as C<pack "sI"x40> -Mark-Jason Dominus (mjd@plover.com) has an outline for perliotut. +=head2 bitfields in pack -=item pack/unpack +=head2 Cross compilation -This is badly needed. There has been some discussion on the -subject on perl5-porters. +Make Perl buildable with a cross-compiler. This will play havoc with +Configure, which needs to how how the target system will respond to +its tests; maybe C<microperl> will be a good starting point here. +(Indeed, Bart Schuller reports that he compiled up C<microperl> for +the Agenda PDA and it works fine.) A really big spanner in the works +is the bootstrapping build process of Perl: if the filesystem the +target systems sees is not the same what the build host sees, various +input, output, and (Perl) library files need to be copied back and forth. -=item Debugging +=head2 Perl preprocessor / macros -Ronald Kimball (rjk@linguist.dartmouth.edu) has volunteered. +Source filters help with this, but do not get us all the way. For +instance, it should be possible to implement the C<??> operator somehow; +source filters don't (quite) cut it. -=back +=head2 Perl lexer in Perl -=head2 Include a search tool +Damian Conway is planning to work on this, but it hasn't happened yet. -perldoc should be able to 'grep' fulltext indices of installed POD -files. This would let people say: +=head2 Using POSIX calls internally - perldoc -find printing numbers with commas +When faced with a BSD vs. SySV -style interface to some library or +system function, perl's roots show in that it typically prefers the BSD +interface (but falls back to the SysV one). One example is getpgrp(). +Other examples include C<memcpy> vs. C<bcopy>. There are others, mostly in +F<<pp_sys.c>. -and get back the perlfaq entry on 'commify'. +Mostly, this item is a suggestion for which way to start a journey into +an C<#ifdef> forest. It is not primarily a suggestion to eliminate any of +the C<#ifdef> forests. -This solution, however, requires documentation to contain the keywords -the user is searching for. Even when the users know what they're -looking for, often they can't spell it. +POSIX calls are perhaps more likely to be portable to unexpected +architectures. They are also perhaps more likely to be actively +maintained by a current vendor. They are also perhaps more likely to be +available in thread-safe versions, if appropriate. -=head2 Include a locate tool +=head2 -i rename file when changed -perldoc should be able to help people find the manpages on a -particular high-level subject: +It's only necessary to rename a file when inplace editing when the file +has changed. Detecting a change is perhaps the difficult bit. - perldoc -find web +=head2 All ARGV input should act like E<lt>E<gt> -would tell them manpages, web pages, and books with material on web -programming. Similarly C<perldoc -find databases>, C<perldoc -find -references> and so on. +=head2 Support for rerunning debugger -We need something in the vicinity of: +There should be a way of restarting the debugger on demand. - % perl -help random stuff - No documentation for perl function `random stuff' found - The following entry in perlfunc.pod matches /random/a: - =item rand EXPR +=head2 my sub foo { } - =item rand +The basic principle is sound, but there are problems with the semantics +of self-referential and mutually referential lexical subs: how to +declare the subs? - Returns a random fractional number greater than or equal to C<0> and less - than the value of EXPR. (EXPR should be positive.) If EXPR is - omitted, the value C<1> is used. Automatically calls C<srand()> unless - C<srand()> has already been called. See also C<srand()>. +=head2 One-pass global destruction - (Note: If your rand function consistently returns numbers that are too - large or too small, then your version of Perl was probably compiled - with the wrong number of RANDBITS.) - The following pod pages seem to have /stuff/a: - perlfunc.pod (7 hits) - perlfaq7.pod (6 hits) - perlmod.pod (4 hits) - perlsyn.pod (3 hits) - perlfaq8.pod (2 hits) - perlipc.pod (2 hits) - perl5004delta.pod (1 hit) - perl5005delta.pod (1 hit) - perlcall.pod (1 hit) - perldelta.pod (1 hit) - perlfaq3.pod (1 hit) - perlfaq5.pod (1 hit) - perlhist.pod (1 hit) - perlref.pod (1 hit) - perltoc.pod (1 hit) - perltrap.pod (1 hit) - Proceed to open perlfunc.pod? [y] n - Do you want to speak perl interactively? [y] n - Should I dial 911? [y] n - Do you need psychiatric help? [y] y - <PELIZA> Hi, what bothers you today? - A Python programmer in the next cubby is driving me nuts! - <PELIZA> Hmm, thats fixable. Just [rest censored] +Sweeping away all the allocated memory in one go is a laudable goal, but +it's difficult and in most cases, it's easier to let the memory get +freed by exiting. -=head2 Separate function manpages by default +=head2 Rewrite regexp parser -Perl should install 'manpages' for every function/operator into the -3pl or 3p manual section. By default. The splitman program in the -Perl source distribution does the work of turning big perlfunc into -little 3p pages. +There has been talk recently of rewriting the regular expression parser +to produce an optree instead of a chain of opcodes; it's unclear whether +or not this would be a win. -=head2 Users can't find the manpages +=head2 Cache recently used regexps -Make C<perldoc> tell users what they need to add to their .login or -.cshrc to set their MANPATH correctly. +This is to speed up -=head2 Outstanding issues to be documented + for my $re (@regexps) { + $matched++ if /$re/ + } -Tom has a list of 5.005_5* features or changes that require -documentation. +C<qr//> already gives us a way of saving compiled regexps, but it should +be done automatically. -Create one document that coherently explains the delta between the -last camel release and the current release. perldelta was supposed -to be that, but no longer. The things in perldelta never seemed to -get placed in the right places in the real manpages, either. This -needs work. +=head2 Re-entrant functions -=head2 Adapt www.linuxhq.com for Perl +Add configure probes for C<_r> forms of system calls and fit them to the +core. Unfortunately, calling conventions for these functions and not +standardised. -This should help glorify documentation and get more people involved in -perl development. +=head2 Cross-compilation support -=head2 Replace man with a perl program +Bart Schuller reports that using C<microperl> and a cross-compiler, he +got Perl working on the Agenda PDA. However, one cannot build a full +Perl because Configure needs to get the results for the target platform, +for the host. -Can we reimplement man in Perl? Tom has a start. I believe some of -the Linux systems distribute a manalike. Alternatively, build on -perldoc to remove the unfeatures like "is slow" and "has no apropos". +=head2 Bit-shifting bitvectors -=head2 Unicode tutorial +Given: -We could use more work on helping people understand Perl's new -Unicode support that Larry has created. + vec($v, 1000, 1) = 1; -=head1 Modules +One should be able to do -=head2 Update the POSIX extension to conform with the POSIX 1003.1 Edition 2 + $v <<= 1; -The current state of the POSIX extension is as of Edition 1, 1991, -whereas the Edition 2 came out in 1996. ISO/IEC 9945:1-1996(E), -ANSI/IEEE Std 1003.1, 1996 Edition. ISBN 1-55937-573-6. The updates -were legion: threads, IPC, and real time extensions. +and have the 999'th bit set. -=head2 Module versions +Currently if you try with shift bitvectors you shift the NV/UV, instead +of the bits in the PV. Not very logical. -Automate the checking of versions in the standard distribution so -it's easy for a pumpking to check whether CPAN has a newer version -that we should be including? +=head2 debugger pragma -=head2 New modules +The debugger is implemented in Perl in F<perl5db.pl>; turning it into a +pragma should be easy, but making it work lexically might be more +difficult. Fiddling with C<$^P> would be necessary. -Which modules should be added to the standard distribution? This ties -in with the SDK discussed on the perl-sdk list at perl.org. +=head2 use less pragma -=head2 Profiler +Identify areas where speed/memory tradeoffs can be made and have a hint +to switch between them. -Devel::DProf requires more documentation. +=head2 switch structures -=head2 Tie Modules +Although we have C<Switch.pm> in core, Larry points to the dormant +C<nswitch> and C<cswitch> ops in F<pp.c>; using these opcodes would be +much faster. -=over 4 +=head2 Cache eval tree -=item VecArray +=head2 rcatmaybe -Implement array using vec(). Nathan Torkington has working code to -do this. +=head2 Shrink opcode tables -=item SubstrArray +=head2 Optimize away @_ -Implement array using substr() +Look at the "reification" code in C<av.c> -=item VirtualArray +=head2 Prototypes versus indirect objects -Implement array using a file +Currently, indirect object syntax bypasses prototype checks. -=item ShiftSplice +=head2 Install HMTL -Defines shift et al in terms of splice method +HTML versions of the documentation need to be installed by default; a +call to C<installhtml> from C<installperl> may be all that's necessary. -=back +=head2 Prototype method calls -=head2 Procedural options +=head2 Return context prototype declarations -Support procedural interfaces for the common cases of Perl's -gratuitously OOO modules. Tom objects to "use IO::File" reading many -thousands of lines of code. +=head2 magic_setisa -=head2 RPC +=head2 Garbage collection -Write a module for transparent, portable remote procedure calls. (Not -core). This touches on the CORBA and ILU work. +There have been persistent mumblings about putting a mark-and-sweep +garbage detector into Perl; Alan Burlison has some ideas about this. -=head2 Export File::Find variables +=head2 IO tutorial -Make File::Find export C<$name> etc manually, at least if asked to. +Mark-Jason Dominus has the beginnings of one of these. -=head2 Ioctl +=head2 pack/unpack tutorial -Finish a proper Ioctl module. +Simon Cozens has the beginnings of one of these. -=head2 Debugger attach/detach +=head2 Rewrite perldoc -Permit a user to debug an already-running program. +There are a few suggestions for what to do with C<perldoc>: maybe a +full-text search, an index function, locating pages on a particular +high-level subject, and so on. -=head2 Alternative RE Syntax +=head2 Install .3p man pages -Make an alternative regular expression syntax that is accessed through -a module. For instance, +This is a bone of contention; we can create C<.3p> man pages for each +built-in function, but should we install them by default? Tcl does this, +and it clutters up C<apropos>. - use RE; - $re = start_of_line() - ->literal("1998/10/08") - ->optional( whitespace() ) - ->literal("[") - ->remember( many( or( "-", digit() ) ) ); +=head2 Unicode tutorial - if (/$re/) { - print "time is $1\n"; - } +Simon Cozens promises to do this before he gets old. -Newbies to regular expressions typically only use a subset of the full -language. Perhaps you wouldn't have to implement the full feature set. +=head2 Update POSIX.pm for 1003.1-2 +=head2 Retargetable installation -=head2 Bundled modules +Allow C<@INC> to be changed after Perl is built. -Nicholas Clark (nick@flirble.org) had a patch for storing modules in -zipped format. This needs exploring and concluding. +=head2 POSIX emulation on non-POSIX systems -=head2 Expect +Make C<POSIX.pm> behave as POSIXly as possible everywhere, meaning we +have to implement POSIX equivalents for some functions if necessary. -Adopt IO::Tty, make it as portable as Don Libes' "expect" (can we link -against expect code?), and perfect a Perl version of expect. IO::Tty -and expect could then be distributed as part of the core distribution, -replacing Comm.pl and other hacks. +=head2 Rename Win32 headers -=head2 GUI::Native +=head2 Finish off lvalue functions + +They don't work in the debugger, and they don't work for list or hash +slices. -A simple-to-use interface to native graphical abilities would -be welcomed. Oh, Perl's access Tk is nice enough, and reasonably -portable, but it's not particularly as fast as one would like. -Simple access to the mouse's cut buffer or mouse-presses shouldn't -required loading a few terabytes of Tk code. +=head2 Update sprintf documentation -=head2 Update semibroken auxiliary tools; h2ph, a2p, etc. +Hugo van der Sanden plans to look at this. -Kurt Starsinic is working on h2ph. mjd has fixed bugs in a2p in the -past. a2p apparently doesn't work on nawk and gawk extensions. -Graham Barr has an Include module that does h2ph work at runtime. +=head2 Use fchown/fchmod internally -=head2 pod2html +This has been done in places, but needs a thorough code review. +Also fchdir is available in some platforms. -A short-term fix: pod2html generates absolute HTML links. Make it -generate relative links. +=head1 Vague ideas -=head2 Podchecker +Ideas which have been discussed, and which may or may not happen. -Something like lint for Pod would be good. Something that catches -common errors as well as gross ones. Brad Appleton is putting -together something as part of his PodParser work. +=head2 ref() in list context -=head1 Tom's Wishes +It's unclear what this should do or how to do it without breaking old +code. -=head2 Webperl +=head2 Make tr/// return histogram -Design a webperl environment that's as tightly integrated and as -easy-to-use as Perl's current command-line environment. +There is a patch for this, but it may require Unicodification. -=head2 Mobile agents +=head2 Compile to real threaded code +=head2 Structured types +=head2 Modifiable $1 et al. -More work on a safe and secure execution environment for mobile -agents would be neat; the Safe.pm module is a start, but there's a -still a lot to be done in that area. Adopt Penguin? + ($x = "elephant") =~ /e(ph)/; + $1 = "g"; # $x = "elegant" -=head2 POSIX on non-POSIX +What happens if there are multiple (nested?) brackets? What if the +string changes between the match and the assignment? -Standard programming constructs for non-POSIX systems would help a -lot of programmers stuck on primitive, legacy systems. For example, -Microsoft still hasn't made a usable POSIX interface on their clunky -systems, which means that standard operations such as alarm() and -fork(), both critical for sophisticated client-server programming, -must both be kludged around. +=head2 Procedural interfaces for IO::*, etc. -I'm unsure whether Tom means to emulate alarm( )and fork(), or merely -to provide a document like perlport.pod to say which features are -portable and which are not. +Some core modules have been accused of being overly-OO. Adding +procedural interfaces could demystify them. -=head2 Portable installations +=head2 RPC modules -Figure out a portable semi-gelled installation, that is, one without -full paths. Larry has said that he's thinking about this. Ilya -pointed out that perllib_mangle() is good for this. +=head2 Attach/detach debugger from running program -=head1 Win32 Stuff +With C<gdb>, you can attach the debugger to a running program if you +pass the process ID. It would be good to do this with the Perl debugger +on a running Perl program, although I'm not sure how it would be done. -=head2 Rename new headers to be consistent with the rest +=head2 Alternative RE syntax module -=head2 Sort out the spawnvp() mess + use Regex::Newbie; + $re = Regex::Newbie->new + ->start + ->match("foo") + ->repeat(Regex::Newbie->class("char"),3) + ->end; + /$re/; -=head2 Work out DLL versioning +=head2 GUI::Native -=head2 Style-check +A non-core module that would use "native" GUI to create graphical +applications. -=head1 Would be nice to have +=head2 foreach(reverse ...) -=over 4 +Currently -=item C<pack "(stuff)*"> + foreach (reverse @_) { ... } -=item Contiguous bitfields in pack/unpack +puts C<@_> on the stack, reverses it putting the reversed version on the +stack, then iterates forwards. Instead, it could be special-cased to put +C<@_> on the stack then iterate backwards. -=item lexperl +=head2 Constant function cache -=item Bundled perl preprocessor +=head2 Approximate regular expression matching -=item Use posix calls internally where possible +=head1 Ongoing -=item format BOTTOM +These items B<always> need doing: -=item -i rename file only when successfully changed +=head2 Update guts documentation -=item All ARGV input should act like <> +Simon Cozens tries to do this when possible, and contributions to the +C<perlapi> documentation is welcome. -=item report HANDLE [formats]. +=head2 Add more tests -=item support in perlmain to rerun debugger +Michael Schwern will donate $500 to Yet Another Society when all core +modules have tests. -=item lvalue functions +=head2 Update auxiliary tools -Tuomas Lukka, on behalf of the PDL project, greatly desires this and -Ilya has a patch for it (probably against an older version of Perl). -Tuomas points out that what PDL really wants is lvalue I<methods>, -not just subs. +The code we ship with Perl should look like good Perl 5. -=back +=head1 Recently done things -=head1 Possible pragmas +These are things which have been on the todo lists in previous releases +but have recently been completed. -=head2 'less' +=head2 Safe signal handling -(use less memory, CPU) +A new signal model went into 5.7.1 without much fanfare. Operations and +C<malloc>s are no longer interrupted by signals, which are handled +between opcodes. This means that C<PERL_ASYNC_CHECK> now actually does +something. However, there are still a few things that need to be done. -=head1 Optimizations +=head2 Tie Modules -=head2 constant function cache +Modules which implement arrays in terms of strings, substrings or files +can be found on the CPAN. -=head2 foreach(reverse...) +=head2 gettimeofday -=head2 Cache eval tree +C<Time::Hires> has been integrated into the core. -Unless lexical outer scope used (mark in &compiling?). +=head2 setitimer and getimiter -=head2 rcatmaybe +Adding C<Time::Hires> got us this too. -=head2 Shrink opcode tables +=head2 Testing __DIE__ hook + +Tests have been added. + +=head2 CPP equivalent in Perl -Via multiple implementations selected in peep. +A C Yardley will probably have done this by the time you can read this. +This allows for a generalization of the C constant detection used in +building C<Errno.pm>. -=head2 Cache hash value +=head2 Explicit switch statements -Not a win, according to Guido. +C<Switch.pm> has been integrated into the core to give you all manner of +C<switch...case> semantics. -=head2 Optimize away @_ where possible +=head2 autocroak -=head2 Rewrite regexp parser for better integrated optimization +This is C<Fatal.pm>. -The regexp parser was rewritten for 5.005. Ilya's the regexp guru. +=head2 UTF/EBCDIC -=head1 Vague possibilities +Nick Ing-Simmons has made UTF-EBCDIC (UTR13) work with Perl. -=over 4 + EBCDIC? http://www.unicode.org/unicode/reports/tr16/ -=item ref function in list context +=head2 UTF Regexes -This seems impossible to do without substantially breaking code. +Although there are probably some small bugs to be rooted out, Jarkko +Hietaniemi has made regular expressions polymorphic between bytes and +characters. -=item make tr/// return histogram in list context? +=head2 perlcc to produce executable -=item Loop control on do{} et al +C<perlcc> was recently rewritten, and can now produce standalone +executables. -=item compile to real threaded code +=head2 END blocks saved in compiled output -=item structured types +=head2 Secure temporary file module -=item Modifiable $1 et al +Tim Jenness' C<File::Temp> is now in core. -The intent is for this to be a means of editing the matched portions of -the target string. +=head2 Integrate Time::HiRes -=back +This module is now part of core. -=head1 To Do Or Not To Do +=head2 Turn Cwd into XS -These are things that have been discussed in the past and roundly -criticized for being of questionable value. +Benjamin Sugars has done this. -=head2 Making my() work on "package" variables +=head2 Mmap for input -Being able to say my($Foo::Bar), something that sounds ludicrous and -the 5.6 pumpking has mocked. +Nick Ing-Simmons' C<perlio> supports an C<mmap> IO method. -=head2 "or" testing defined not truth +=head2 Byte to/from UTF8 and UTF8 to/from local conversion -We tell people that C<||> can be used to give a default value to a -variable: +C<Encode> provides this. - $children = shift || 5; # default is 5 children +=head2 Add sockatmark support -which is almost (but not): +Added in 5.7.1 - $children = shift; - $children = 5 unless $children; +=head2 Mailing list archives + +http://lists.perl.org/, http://archive.develooper.com/ + +=head2 Bug tracking + +Richard Foley has written the bug tracking system at http://bugs.perl.org/ -but if the first argument was given and is "0", then it will be -considered false by C<||> and C<5> used instead. Really we want -an C<||>-like operator that behaves like: +=head2 Integrate MacPerl - $children = shift; - $children = 5 unless defined $children; +Chris Nandor and Matthias Neeracher have integrated the MacPerl changes +into 5.6.0. -Namely, a C<||> that tests defined-ness rather than truth. One was -discussed, and a patch submitted, but the objections were many. While -there were objections, many still feel the need. At least it was -decided that C<??> is the best name for the operator. +=head2 Web "nerve center" for Perl -=head2 "dynamic" lexicals +http://use.perl.org/ is what you're looking for. - my $x; - sub foo { - local $x; - } +=head2 Regular expression tutorial -Localizing, as Tim Bunce points out, is a separate concept from -whether the variable is global or lexical. Chip Salzenberg had -an implementation once, but Larry thought it had potential to -confuse. +C<perlretut>, provided by Mark Kvale. -=head2 "class"-based, rather than package-based "lexicals" +=head2 Debugging Tutorial -This is like what the Alias module provides, but the variables would -be lexicals reserved by perl at compile-time, which really are indices -pointing into the pseudo-hash object visible inside every method so -declared. +C<perldebtut>, written by Richard Foley. -=head1 Threading +=head2 Integrate new modules -=head2 Modules +Jarkko has been integrating madly into 5.7.x -Which of the standard modules are thread-safe? Which CPAN modules? -How easy is it to fix those non-safe modules? +=head2 Integrate profiler -=head2 Testing +C<Devel::DProf> is now a core module. -Threading is still experimental. Every reproducible bug identifies -something else for us to fix. Find and submit more of these problems. +=head2 Y2K error detection -=head2 $AUTOLOAD +There's a configure option to detect unsafe concatenation with "19", and +a CPAN module. (C<D'oh::Year>) -=head2 exit/die +=head2 Regular expression debugger -Consistent semantics for exit/die in threads. +While not part of core, Mark-Jason Dominus has written C<Rx> and has +also come up with a generalised strategy for regular expression +debugging. -=head2 External threads +=head2 POD checker -Better support for externally created threads. +That's, uh, F<podchecker> -=head2 Thread::Pool +=head2 "Dynamic" lexicals -=head2 thread-safety +=head2 Cache precompiled modules -Spot-check globals like statcache and global GVs for thread-safety. -"B<Part done>", says Sarathy. +=head1 Deprecated Wishes -=head2 Per-thread GVs +These are items which used to be in the todo file, but have been +deprecated for some reason. -According to Sarathy, this would make @_ be the same in threaded -and non-threaded, as well as helping solve problems like filehandles -(the same filehandle currently cannot be used in two threads). +=head2 Loop control on do{} -=head1 Compiler +This would break old code; use C<do{{ }}> instead. -=head2 Optimization +=head2 Lexically scoped typeglobs -The compiler's back-end code-generators for creating bytecode or -compilable C code could use optimization work. +Not needed now we have lexical IO handles. -=head2 Byteperl +=head2 format BOTTOM +=head2 report HANDLE -Figure out how and where byteperl will be built for the various -platforms. +Damian Conway's text formatting modules seem to be the Way To Go. -=head2 Precompiled modules +=head2 Generalised want()/caller()) +=head2 Named prototypes -Save byte-compiled modules on disk. +These both seem to be delayed until Perl 6. -=head2 Executables +=head2 Built-in globbing -Auto-produce executable. +The C<File::Glob> module has been used to replace the C<glob> function. -=head2 Typed lexicals +=head2 Regression tests for suidperl -Typed lexicals should affect B::CC::load_pad. +C<suidperl> is deprecated in favour of common sense. -=head2 Win32 +=head2 Cached hash values -Workarounds to help Win32 dynamic loading. +We have shared hash keys, which perform the same job. -=head2 END blocks +=head2 Add compression modules -END blocks need saving in compiled output, now that CHECK blocks -are available. +The compression modules are a little heavy; meanwhile, Nick Clark is +working on experimental pragmata to do transparent decompression on +input. -=head2 _AUTOLOAD +=head2 Reorganise documentation into tutorials/references -_AUTOLOAD prodding. +Could not get consensus on P5P about this. -=head2 comppadlist +=head2 Remove distinction between functions and operators + +Caution: highly flammable. + +=head2 Make XS easier to use -Fix comppadlist (names in comppad_name can have fake SvCUR -from where newASSIGNOP steals the field). +Use C<Inline> instead, or SWIG. -=head2 Cached compilation +=head2 Make embedding easier to use -Can we install modules as bytecode? +Use C<Inline::CPR>. -=head2 Filenames +=head2 man for perl -Ongoing effort: keep filenames in the distribution and in the standard -module set be 8.3 friendly where feasible. Good luck changing the -standard modules, though. +See the Perl Power Tools. (http://language.perl.com/ppt/) -=head2 Foreign lines +=head2 my $Package::variable -Perl should be more generous in accepting foreign line terminations. -Mostly B<done> in 5.005. +Use C<our> instead. -=head2 Namespace cleanup +=head2 "or" tests defined, not truth - symbol-space: "pl_" prefix for all global vars - "Perl_" prefix for all functions +Suggesting this on P5P B<will> cause a boring and interminable flamewar. - CPP-space: stop malloc()/free() pollution unless asked +=head2 "class"-based lexicals -=head2 ISA.pm +Use flyweight objects, secure hashes or, dare I say it, pseudohashes instead. -Rename and alter ISA.pm. B<Done>. It is now base.pm. +=head2 byteperl -=head2 autocroak? +C<ByteLoader> covers this. -This is the Fatal.pm module, so any builtin that does -not return success automatically die()s. If you're feeling brave, tie -this in with the unified exceptions scheme. +=head2 Lazy evaluation / tail recursion removal -=cut +C<List::Util> in core gives some of these; tail recursion removal is +done manually, with C<goto &whoami;>. (However, MJD has found that +C<goto &whoami> introduces a performance penalty, so maybe there should +be a way to do this after all: C<sub foo {START: ... goto START;> is +better.) @@ -1978,12 +1978,6 @@ PP(pp_sne) PP(pp_scmp) { dSP; dTARGET; tryAMAGICbin(scmp,0); -#ifndef NV_PRESERVES_UV - if (SvROK(TOPs) && SvROK(TOPm1s)) { - SETi(PTR2UV(SvRV(TOPs)) - PTR2UV(SvRV(TOPm1s))); - RETURN; - } -#endif { dPOPTOPssrl; int cmp = ((PL_op->op_private & OPpLOCALE) @@ -2814,6 +2808,9 @@ PP(pp_substr) sv_pos_u2b(sv, &pos, &rem); tmps += pos; sv_setpvn(TARG, tmps, rem); +#ifdef USE_LOCALE_COLLATE + sv_unmagic(TARG, 'o'); +#endif if (utf8_curlen) SvUTF8_on(TARG); if (repl) { @@ -1079,7 +1079,7 @@ PP(pp_flip) if (PL_op->op_private & OPpFLIP_LINENUM) { struct io *gp_io; flip = PL_last_in_gv - && (gp_io = GvIOp(PL_last_in_gv)) + && (gp_io = GvIO(PL_last_in_gv)) && SvIV(sv) == (IV)IoLINES(gp_io); } else { flip = SvTRUE(sv); @@ -1160,7 +1160,8 @@ PP(pp_flop) SV *targ = PAD_SV(cUNOP->op_first->op_targ); sv_inc(targ); if ((PL_op->op_private & OPpFLIP_LINENUM) - ? (PL_last_in_gv && SvIV(sv) == (IV)IoLINES(GvIOp(PL_last_in_gv))) + ? (GvIO(PL_last_in_gv) + && SvIV(sv) == (IV)IoLINES(GvIOp(PL_last_in_gv))) : SvTRUE(sv) ) { sv_setiv(PAD_SV(((UNOP*)cUNOP->op_first)->op_first->op_targ), 0); sv_catpv(targ, "E0"); @@ -396,6 +396,8 @@ PERL_CALLCONV I32 Perl_keyword(pTHX_ char* d, I32 len); PERL_CALLCONV void Perl_leave_scope(pTHX_ I32 base); PERL_CALLCONV void Perl_lex_end(pTHX); PERL_CALLCONV void Perl_lex_start(pTHX_ SV* line); +PERL_CALLCONV void Perl_op_null(pTHX_ OP* o); +PERL_CALLCONV void Perl_op_clear(pTHX_ OP* o); PERL_CALLCONV OP* Perl_linklist(pTHX_ OP* o); PERL_CALLCONV OP* Perl_list(pTHX_ OP* o); PERL_CALLCONV OP* Perl_listkids(pTHX_ OP* o); @@ -1027,8 +1029,6 @@ STATIC OP* S_no_fh_allowed(pTHX_ OP *o); STATIC OP* S_scalarboolean(pTHX_ OP *o); STATIC OP* S_too_few_arguments(pTHX_ OP *o, char* name); STATIC OP* S_too_many_arguments(pTHX_ OP *o, char* name); -STATIC void S_op_clear(pTHX_ OP* o); -STATIC void S_null(pTHX_ OP* o); STATIC PADOFFSET S_pad_addlex(pTHX_ SV* name); STATIC PADOFFSET S_pad_findlex(pTHX_ char* name, PADOFFSET newoff, U32 seq, CV* startcv, I32 cx_ix, I32 saweval, U32 flags); STATIC OP* S_newDEFSVOP(pTHX); @@ -3515,14 +3515,8 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state) ANYOF_BITMAP_SET(ret, value); #else /* EBCDIC */ for (value = 0; value < 256; value++) { - if (PL_hints & HINT_RE_ASCIIR) { - if (NATIVE_TO_ASCII(value) < 128) - ANYOF_BITMAP_SET(ret, value); - } - else { - if (isASCII(value)) - ANYOF_BITMAP_SET(ret, value); - } + if (isASCII(value)) + ANYOF_BITMAP_SET(ret, value); } #endif /* EBCDIC */ } @@ -3537,14 +3531,8 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state) ANYOF_BITMAP_SET(ret, value); #else /* EBCDIC */ for (value = 0; value < 256; value++) { - if (PL_hints & HINT_RE_ASCIIR) { - if (NATIVE_TO_ASCII(value) >= 128) - ANYOF_BITMAP_SET(ret, value); - } - else { - if (!isASCII(value)) - ANYOF_BITMAP_SET(ret, value); - } + if (!isASCII(value)) + ANYOF_BITMAP_SET(ret, value); } #endif /* EBCDIC */ } @@ -3783,9 +3771,7 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state) } /* end of namedclass \blah */ if (range) { - if (((prevvalue > value) && !(PL_hints & HINT_RE_ASCIIR)) || - ((NATIVE_TO_UNI(prevvalue) > NATIVE_TO_UNI(value)) && - (PL_hints & HINT_RE_ASCIIR))) /* b-a */ { + if (prevvalue > value) /* b-a */ { Simple_vFAIL4("Invalid [] range \"%*.*s\"", RExC_parse - rangebegin, RExC_parse - rangebegin, @@ -3823,18 +3809,8 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state) IV ceilvalue = value < 256 ? value : 255; #ifdef EBCDIC - if (PL_hints & HINT_RE_ASCIIR) { - /* New style scheme for ranges: - * use re 'asciir'; - * do ranges in ASCII/Unicode space - */ - for (i = NATIVE_TO_ASCII(prevvalue); - i <= NATIVE_TO_ASCII(ceilvalue); - i++) - ANYOF_BITMAP_SET(ret, ASCII_TO_NATIVE(i)); - } - else if ((isLOWER(prevvalue) && isLOWER(ceilvalue)) || - (isUPPER(prevvalue) && isUPPER(ceilvalue))) + if ((isLOWER(prevvalue) && isLOWER(ceilvalue)) || + (isUPPER(prevvalue) && isUPPER(ceilvalue))) { if (isLOWER(prevvalue)) { for (i = prevvalue; i <= ceilvalue; i++) @@ -114,8 +114,6 @@ S_deb_curcv(pTHX_ I32 ix) PERL_CONTEXT *cx = &cxstack[ix]; if (CxTYPE(cx) == CXt_SUB || CxTYPE(cx) == CXt_FORMAT) return cx->blk_sub.cv; - else if (CxTYPE(cx) == CXt_EVAL && CxREALEVAL(cx)) - return PL_compcv; else if (CxTYPE(cx) == CXt_EVAL && !CxTRYBLOCK(cx)) return PL_compcv; else if (ix == 0 && PL_curstackinfo->si_type == PERLSI_MAIN) @@ -8,9 +8,13 @@ $| = 1; # Cheesy version of Getopt::Std. Maybe we should replace it with that. if ($#ARGV >= 0) { foreach my $idx (0..$#ARGV) { - next unless $ARGV[$idx] =~ /^-(\w+)$/; + next unless $ARGV[$idx] =~ /^-(\S+)$/; $verbose = 1 if $1 eq 'v'; $with_utf= 1 if $1 eq 'utf8'; + if ($1 =~ /^deparse(,.+)?$/) { + $deparse = 1; + $deparse_opts = $1; + } splice(@ARGV, $idx, 1); } } @@ -42,13 +46,17 @@ $ENV{EMXSHELL} = 'sh'; # For OS/2 if ($#ARGV == -1) { @ARGV = split(/[ \n]/, - `echo base/*.t comp/*.t cmd/*.t run/*.t io/*.t; echo op/*.t pragma/*.t lib/*.t pod/*.t camel-III/*.t`); + `echo base/*.t comp/*.t cmd/*.t run/*.t io/*.t; echo op/*.t pragma/*.t lib/*.t pod/*.t`); } # %infinite = ( 'comp/require.t', 1, 'op/bop.t', 1, 'lib/hostname.t', 1 ); -_testprogs('perl', @ARGV); -_testprogs('compile', @ARGV) if (-e "../testcompile"); +if ($deparse) { + _testprogs('deparse', @ARGV); +} else { + _testprogs('perl', @ARGV); + _testprogs('compile', @ARGV) if (-e "../testcompile"); +} sub _testprogs { $type = shift @_; @@ -61,6 +69,12 @@ TESTING COMPILER -------------------------------------------------------------------------------- EOT + print <<'EOT' if ($type eq 'deparse'); +-------------------------------------------------------------------------------- +TESTING DEPARSER +-------------------------------------------------------------------------------- +EOT + $ENV{PERLCC_TIMEOUT} = 120 if ($type eq 'compile' && !$ENV{PERLCC_TIMEOUT}); @@ -86,13 +100,23 @@ EOT if ($test =~ /^$/) { next; } + if ($type eq 'deparse') { + if ($test eq "comp/redef.t") { + # Redefinition happens at compile time + next; + } + elsif ($test eq "lib/switch.t") { + # B::Deparse doesn't support source filtering + next; + } + } $te = $test; chop($te); print "$te" . '.' x ($dotdotdot - length($te)); open(SCRIPT,"<$test") or die "Can't run $test.\n"; $_ = <SCRIPT>; - close(SCRIPT); + close(SCRIPT) unless ($type eq 'deparse'); if (/#!.*perl(.*)$/) { $switch = $1; if ($^O eq 'VMS') { @@ -104,10 +128,28 @@ EOT $switch = ''; } + my $file_opts = ""; + if ($type eq 'deparse') { + # Look for #line directives which change the filename + while (<SCRIPT>) { + $file_opts .= ",-f$3$4" + if /^#\s*line\s+(\d+)\s+((\w+)|"([^"]+)")/; + } + close(SCRIPT); + } my $utf = $with_utf ? '-I../lib -Mutf8' : ''; my $testswitch = '-I. -MTestInit'; # -T will strict . from @INC - if ($type eq 'perl') { + if ($type eq 'deparse') { + my $deparse = + "./perl $testswitch $switch -I../lib -MO=-qq,Deparse,". + "-l$deparse_opts$file_opts ". + "./$test > ./$test.dp ". + "&& ./perl $testswitch $switch -I../lib ./$test.dp |"; + open(RESULTS, $deparse) + or print "can't deparse '$deparse': $!.\n"; + } + elsif ($type eq 'perl') { my $run = "./perl $testswitch $switch $utf $test |"; open(RESULTS,$run) or print "can't run '$run': $!.\n"; } @@ -161,6 +203,9 @@ EOT } } close RESULTS; + if ($type eq 'deparse') { + unlink "./$test.dp"; + } if ($ENV{PERL_3LOG}) { my $tpp = $test; $tpp =~ s:/:_:g; diff --git a/t/TestInit.pm b/t/TestInit.pm index 873c3ce878..a9322862ce 100644 --- a/t/TestInit.pm +++ b/t/TestInit.pm @@ -15,3 +15,6 @@ chdir 't' if -d 't'; @INC = '../lib'; +$0 =~ s/\.dp$//; +1; + diff --git a/t/camel-III/vstring.t b/t/camel-III/vstring.t deleted file mode 100644 index 6dec4ddd69..0000000000 --- a/t/camel-III/vstring.t +++ /dev/null @@ -1,37 +0,0 @@ -# See if the things Camel-III says are true. -BEGIN { - chdir 't' if -d 't'; - @INC = '../lib'; -} -use Test; -plan test => 5; - -# Chapter 2 pp67/68 -my $vs = v1.20.300.4000; -ok($vs,"\x{1}\x{14}\x{12c}\x{fa0}","v-string ne \\x{}"); -ok($vs,chr(1).chr(20).chr(300).chr(4000),"v-string ne chr()"); -ok('foo',((chr(193) eq 'A') ? v134.150.150 : v102.111.111),"v-string ne ''"); - -# Chapter 15, pp403 - -# See if sane addr and gethostbyaddr() work -eval { require Socket; gethostbyaddr(v127.0.0.1,Socket::AF_INET()) }; -if ($@) - { - # No - so don't test insane fails. - skip("No Socket",''); - } -else - { - my $ip = v2004.148.0.1; - my $host; - eval { $host = gethostbyaddr($ip,Socket::AF_INET()) }; - ok($@ =~ /Wide character/,1,"Non-bytes leak to gethostbyaddr"); - } - -# Chapter 28, pp671 -ok(v5.6.0 lt v5.7.0,1,"v5.6.0 lt v5.7.0 fails"); - -# floating point too messy -# my $v = ord($^V)+ord(substr($^V,1,1))/1000+ord(substr($^V,2,1))/1000000; -# ok($v,$],"\$^V and \$] do not match"); diff --git a/t/cmd/for.t b/t/cmd/for.t index d70af579fc..90b5ff0b4f 100755 --- a/t/cmd/for.t +++ b/t/cmd/for.t @@ -1,6 +1,6 @@ #!./perl -print "1..10\n"; +print "1..11\n"; for ($i = 0; $i <= 10; $i++) { $x[$i] = $i; @@ -55,3 +55,14 @@ sub foo { print foo(1) == 1 ? "ok" : "not ok", " 8\n"; print foo(2) == 2 ? "ok" : "not ok", " 9\n"; print foo(5) == 5 ? "ok" : "not ok", " 10\n"; + +sub bar { + return (1, 2, 4); +} + +$a = 0; +foreach $b (bar()) { + $a += $b; +} +print $a == 7 ? "ok" : "not ok", " 11\n"; + @@ -37,7 +37,7 @@ foreach (keys %datahandle) { } @tests = @ARGV; -@tests = <base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t lib/*.t camel-III/*.t> unless @tests; +@tests = <base/*.t comp/*.t cmd/*.t io/*.t op/*.t pragma/*.t lib/*.t pod/*.t> unless @tests; Test::Harness::runtests @tests; exit(0) unless -e "../testcompile"; diff --git a/t/lib/class-struct.t b/t/lib/class-struct.t index 26505bacfc..2dfaf85e6d 100644 --- a/t/lib/class-struct.t +++ b/t/lib/class-struct.t @@ -5,7 +5,7 @@ BEGIN { @INC = '../lib'; } -print "1..8\n"; +print "1..10\n"; package aClass; @@ -64,3 +64,13 @@ $obk->SomeElem(123); print "not " unless $obk->SomeElem() == 123; print "ok 8\n"; +$obj->a([4,5,6]); + +print "not " unless $obj->a(1) == 5; +print "ok 9\n"; + +$obj->h({h=>7,r=>8,f=>9}); + +print "not " unless $obj->h('r') == 8; +print "ok 10\n"; + diff --git a/t/lib/filefind.t b/t/lib/filefind.t index 362c1ebf07..de322f84c3 100755 --- a/t/lib/filefind.t +++ b/t/lib/filefind.t @@ -14,24 +14,35 @@ else { print "1..61\n"; } use File::Find; +cleanup(); + find(sub { print "ok 1\n" if $_ eq 'filefind.t'; }, "."); finddepth(sub { print "ok 2\n" if $_ eq 'filefind.t'; }, "."); - my $case = 2; my $FastFileTests_OK = 0; +sub cleanup { + if (-d 'for_find') { + chdir('for_find'); + } + if (-d 'fa') { + unlink 'fa/fa_ord', 'fa/fsl', 'fa/faa/faa_ord', + 'fa/fab/fab_ord', 'fa/fab/faba/faba_ord', + 'fb/fb_ord', 'fb/fba/fba_ord'; + rmdir 'fa/faa'; + rmdir 'fa/fab/faba'; + rmdir 'fa/fab'; + rmdir 'fa'; + rmdir 'fb/fba'; + rmdir 'fb'; + chdir '..'; + rmdir 'for_find'; + } +} + END { - unlink 'fa/fa_ord','fa/fsl','fa/faa/faa_ord', - 'fa/fab/fab_ord','fa/fab/faba/faba_ord','fb/fb_ord','fb/fba/fba_ord'; - rmdir 'fa/faa'; - rmdir 'fa/fab/faba'; - rmdir 'fa/fab'; - rmdir 'fa'; - rmdir 'fb/fba'; - rmdir 'fb'; - chdir '..'; - rmdir 'for_find'; + cleanup(); } sub Check($) { diff --git a/t/lib/glob-basic.t b/t/lib/glob-basic.t index fda0f721e8..6c12c2624c 100755 --- a/t/lib/glob-basic.t +++ b/t/lib/glob-basic.t @@ -138,9 +138,8 @@ chdir "pteerslt"; @f_alpha = qw(Ax.pl aY.pl Bx.pl bY.pl Cx.pl cY.pl); if ('a' lt 'A') { # EBCDIC char sets sort lower case before UPPER @f_names = sort(@f_names); - @f_alpha = qw(aY.pl Ax.pl bY.pl Bx.pl cY.pl Cx.pl); } -if ($^O eq 'VMS') { +if ($^O eq 'VMS') { # VMS is happily caseignorant @f_alpha = qw(ax.pl ay.pl bx.pl by.pl cx.pl cy.pl); @f_names = @f_alpha; } diff --git a/t/lib/io_scalar.t b/t/lib/io_scalar.t index 14bbf4d222..b1ef199a5c 100644 --- a/t/lib/io_scalar.t +++ b/t/lib/io_scalar.t @@ -10,7 +10,7 @@ BEGIN { } $| = 1; -print "1..19\n"; +print "1..20\n"; my $fh; my $var = "ok 2\n"; @@ -86,3 +86,16 @@ print $fh "is here"; print "# Got [$var], expect [Something else is here]\n"; print "not " unless $var eq "Something else is here"; print "ok 19\n"; +close $fh; + +# Check that updates to the scalar from elsewhere do not +# cause problems +$var = "line one\nline two\line three\n"; +open $fh, "<", \$var; +while (<$fh>) { + $var = "foo"; +} +close $fh; +print "# Got [$var], expect [foo]\n"; +print "not " unless $var eq "foo"; +print "ok 20\n"; diff --git a/t/lib/md5-file.t b/t/lib/md5-file.t index d0f0d034a1..2aec7e34b7 100644 --- a/t/lib/md5-file.t +++ b/t/lib/md5-file.t @@ -16,7 +16,7 @@ my $EXPECT; if (ord('A') == 193) { # EBCDIC $EXPECT = <<EOT; 95a81f17a8e6c2273aecac12d8c4cb90 ext/Digest/MD5/MD5.pm -c1eb144eccdad16fc34399cb4ab2e136 ext/Digest/MD5/MD5.xs +e9e70adad1215b8fa43b52508f425ae9 ext/Digest/MD5/MD5.xs EOT } else { # ASCII $EXPECT = <<EOT; diff --git a/t/op/append.t b/t/op/append.t index 5aa4bf9007..5e70659c07 100755 --- a/t/op/append.t +++ b/t/op/append.t @@ -43,17 +43,38 @@ if ($_ eq 'abcdef') {print "ok 3\n";} else {print "not ok 3\n";} my $t1 = $a; $t1 .= $ab; print $t1 =~ /\142/ ? "ok 6\n" : "not ok 6\t# $t1\n"; my $t2 = $a; $t2 .= $ub; - print $t2 =~ /\142/ ? "ok 7\n" : "not ok 7\t# $t2\n"; + if (ord('A') == 193) { + # print $t2 eq "\141\141\000" ? "ok 7\n" : "not ok 7\t# $t2\n"; + print $t2 =~ /\141/ ? "ok 7\n" : "not ok 7\t# $t2\n"; + } + else { + print $t2 =~ /\142/ ? "ok 7\n" : "not ok 7\t# $t2\n"; + } my $t3 = $u; $t3 .= $ab; print $t3 =~ /\142/ ? "ok 8\n" : "not ok 8\t# $t3\n"; my $t4 = $u; $t4 .= $ub; - print $t4 =~ /\142/ ? "ok 9\n" : "not ok 9\t# $t4\n"; + if (ord('A') == 193) { + print $t4 =~ /\141/ ? "ok 9\n" : "not ok 9\t# $t4\n"; + } + else { + print $t4 =~ /\142/ ? "ok 9\n" : "not ok 9\t# $t4\n"; + } my $t5 = $a; $t5 = $ab . $t5; print $t5 =~ /\142/ ? "ok 10\n" : "not ok 10\t# $t5\n"; my $t6 = $a; $t6 = $ub . $t6; - print $t6 =~ /\142/ ? "ok 11\n" : "not ok 11\t# $t6\n"; + if (ord('A') == 193) { + print $t6 =~ /\141/ ? "ok 11\n" : "not ok 11\t# $t6\n"; + } + else { + print $t6 =~ /\142/ ? "ok 11\n" : "not ok 11\t# $t6\n"; + } my $t7 = $u; $t7 = $ab . $t7; print $t7 =~ /\142/ ? "ok 12\n" : "not ok 12\t# $t7\n"; my $t8 = $u; $t8 = $ub . $t8; - print $t8 =~ /\142/ ? "ok 13\n" : "not ok 13\t# $t8\n"; + if (ord('A') == 193) { + print $t8 =~ /\141/ ? "ok 13\n" : "not ok 13\t# $t8\n"; + } + else { + print $t8 =~ /\142/ ? "ok 13\n" : "not ok 13\t# $t8\n"; + } } diff --git a/t/op/method.t b/t/op/method.t index 1f5cbb64dc..ceb39be7da 100755 --- a/t/op/method.t +++ b/t/op/method.t @@ -9,7 +9,7 @@ BEGIN { @INC = '../lib'; } -print "1..54\n"; +print "1..56\n"; @A::ISA = 'B'; @B::ISA = 'C'; @@ -46,6 +46,9 @@ test($obj->$mname("a","b","c"), "method,a,b,c"); test((method $obj ("a","b","c")), "method,a,b,c"); test((method $obj "a","b","c"), "method,a,b,c"); +test($obj->method(0), "method,0"); +test($obj->method(1), "method,1"); + test($obj->method(), "method"); test($obj->$mname(), "method"); test((method $obj ()), "method"); diff --git a/t/op/pat.t b/t/op/pat.t index 1be72346f8..0df4d786ee 100755 --- a/t/op/pat.t +++ b/t/op/pat.t @@ -13,8 +13,6 @@ BEGIN { @INC = '../lib'; } -use re 'asciirange'; # Compute ranges in ASCII space - eval 'use Config'; # Defaults assumed if this fails $x = "abc\ndef\n"; diff --git a/t/op/regexp.t b/t/op/regexp.t index 0b81e714a9..4a4d42fd98 100755 --- a/t/op/regexp.t +++ b/t/op/regexp.t @@ -36,8 +36,6 @@ BEGIN { @INC = '../lib'; } -use re 'asciirange'; # ranges are computed in ASCII - $iters = shift || 1; # Poor man performance suite, 10000 is OK. open(TESTS,'op/re_tests') || open(TESTS,'t/op/re_tests') || @@ -5,7 +5,7 @@ BEGIN { @INC = '../lib'; } -print "1..69\n"; +print "1..70\n"; $_ = "abcdefghijklmnopqrstuvwxyz"; @@ -385,3 +385,9 @@ print "ok 68\n"; print "not " if "@a" ne "1 2"; print "ok 69\n"; +# Additional test for Inaba Hiroto patch (robin@kitsite.com) +($a = "\x{100}\x{102}\x{101}") =~ tr/\x00-\377/XYZ/c; +print "not " unless $a eq "XZY"; +print "ok 70\n"; + + diff --git a/t/op/ver.t b/t/op/ver.t index 2eddabd22d..0fe7fd1bbb 100755 --- a/t/op/ver.t +++ b/t/op/ver.t @@ -5,10 +5,20 @@ BEGIN { @INC = '../lib'; } -print "1..28\n"; +print "1..33\n"; my $test = 1; +sub okeq { + my $ok = $_[0] eq $_[1];; + print "not " unless $ok; + print "ok ", $test++; + print " # $_[2]" if !$ok && @_ == 3; + print "\n"; +} + +sub skip { print "ok ", $test++, " # Skip: $_[0]\n" } + use v5.5.640; require v5.5.640; print "ok $test\n"; ++$test; @@ -45,11 +55,9 @@ if (ord("\t") == 9) { # ASCII else { $x = v212.213.214; } -print "not " unless $x eq "MNO"; -print "ok $test\n"; ++$test; +okeq($x, "MNO"); -print "not " unless v1.20.300.4000 eq "\x{1}\x{14}\x{12c}\x{fa0}"; -print "ok $test\n"; ++$test; +okeq(v1.20.300.4000, "\x{1}\x{14}\x{12c}\x{fa0}"); # # now do the same without the "v" @@ -72,108 +80,94 @@ if (ord("\t") == 9) { # ASCII else { $x = 212.213.214; } -print "not " unless $x eq "MNO"; -print "ok $test\n"; ++$test; +okeq($x, "MNO"); -print "not " unless 1.20.300.4000 eq "\x{1}\x{14}\x{12c}\x{fa0}"; -print "ok $test\n"; ++$test; +okeq(1.20.300.4000, "\x{1}\x{14}\x{12c}\x{fa0}"); # test sprintf("%vd"...) etc if (ord("\t") == 9) { # ASCII - print "not " unless sprintf("%vd", "Perl") eq '80.101.114.108'; + okeq(sprintf("%vd", "Perl"), '80.101.114.108'); } else { - print "not " unless sprintf("%vd", "Perl") eq '215.133.153.147'; + okeq(sprintf("%vd", "Perl"), '215.133.153.147'); } -print "ok $test\n"; ++$test; -print "not " unless sprintf("%vd", v1.22.333.4444) eq '1.22.333.4444'; -print "ok $test\n"; ++$test; +okeq(sprintf("%vd", v1.22.333.4444), '1.22.333.4444'); if (ord("\t") == 9) { # ASCII - print "not " unless sprintf("%vx", "Perl") eq '50.65.72.6c'; + okeq(sprintf("%vx", "Perl"), '50.65.72.6c'); } else { - print "not " unless sprintf("%vx", "Perl") eq 'd7.85.99.93'; + okeq(sprintf("%vx", "Perl"), 'd7.85.99.93'); } -print "ok $test\n"; ++$test; -print "not " unless sprintf("%vX", 1.22.333.4444) eq '1.16.14D.115C'; -print "ok $test\n"; ++$test; +okeq(sprintf("%vX", 1.22.333.4444), '1.16.14D.115C'); if (ord("\t") == 9) { # ASCII - print "not " unless sprintf("%#*vo", ":", "Perl") eq '0120:0145:0162:0154'; + okeq(sprintf("%#*vo", ":", "Perl"), '0120:0145:0162:0154'); } else { - print "not " unless sprintf("%#*vo", ":", "Perl") eq '0327:0205:0231:0223'; + okeq(sprintf("%#*vo", ":", "Perl"), '0327:0205:0231:0223'); } -print "ok $test\n"; ++$test; -print "not " unless sprintf("%*vb", "##", v1.22.333.4444) - eq '1##10110##101001101##1000101011100'; -print "ok $test\n"; ++$test; +okeq(sprintf("%*vb", "##", v1.22.333.4444), + '1##10110##101001101##1000101011100'); -print "not " unless sprintf("%vd", join("", map { chr } - unpack 'U*', pack('U*',2001,2002,2003))) - eq '2001.2002.2003'; -print "ok $test\n"; ++$test; +okeq(sprintf("%vd", join("", map { chr } + unpack 'U*', pack('U*',2001,2002,2003))), + '2001.2002.2003'); { use bytes; + if (ord("\t") == 9) { # ASCII - print "not " unless sprintf("%vd", "Perl") eq '80.101.114.108'; + okeq(sprintf("%vd", "Perl"), '80.101.114.108'); } else { - print "not " unless sprintf("%vd", "Perl") eq '215.133.153.147'; + okeq(sprintf("%vd", "Perl"), '215.133.153.147'); } - print "ok $test\n"; ++$test; if (ord("\t") == 9) { # ASCII - print "not " unless - sprintf("%vd", 1.22.333.4444) eq '1.22.197.141.225.133.156'; + okeq(sprintf("%vd", 1.22.333.4444), '1.22.197.141.225.133.156'); } else { - print "not " unless - sprintf("%vd", 1.22.333.4444) eq '1.22.142.84.187.81.112'; + okeq(sprintf("%vd", 1.22.333.4444), '1.22.142.84.187.81.112'); } - print "ok $test\n"; ++$test; if (ord("\t") == 9) { # ASCII - print "not " unless sprintf("%vx", "Perl") eq '50.65.72.6c'; + okeq(sprintf("%vx", "Perl"), '50.65.72.6c'); } else { - print "not " unless sprintf("%vx", "Perl") eq 'd7.85.99.93'; + okeq(sprintf("%vx", "Perl"), 'd7.85.99.93'); } - print "ok $test\n"; ++$test; if (ord("\t") == 9) { # ASCII - print "not " unless sprintf("%vX", v1.22.333.4444) eq '1.16.C5.8D.E1.85.9C'; + okeq(sprintf("%vX", v1.22.333.4444), '1.16.C5.8D.E1.85.9C'); } else { - print "not " unless sprintf("%vX", v1.22.333.4444) eq '1.16.8E.54.BB.51.70'; + okeq(sprintf("%vX", v1.22.333.4444), '1.16.8E.54.BB.51.70'); } - print "ok $test\n"; ++$test; if (ord("\t") == 9) { # ASCII - print "not " unless sprintf("%#*vo", ":", "Perl") eq '0120:0145:0162:0154'; + okeq(sprintf("%#*vo", ":", "Perl"), '0120:0145:0162:0154'); } else { - print "not " unless sprintf("%#*vo", ":", "Perl") eq '0327:0205:0231:0223'; + okeq(sprintf("%#*vo", ":", "Perl"), '0327:0205:0231:0223'); } - print "ok $test\n"; ++$test; if (ord("\t") == 9) { # ASCII - print "not " unless sprintf("%*vb", "##", v1.22.333.4444) - eq '1##10110##11000101##10001101##11100001##10000101##10011100'; + okeq(sprintf("%*vb", "##", v1.22.333.4444), + '1##10110##11000101##10001101##11100001##10000101##10011100'); } else { - print "not " unless sprintf("%*vb", "##", v1.22.333.4444) - eq '1##10110##10001110##1010100##10111011##1010001##1110000'; + okeq(sprintf("%*vb", "##", v1.22.333.4444), + '1##10110##10001110##1010100##10111011##1010001##1110000'); } - print "ok $test\n"; ++$test; } { + # 24..28 + # bug id 20000323.056 print "not " unless "\x{41}" eq +v65; @@ -196,3 +190,35 @@ print "ok $test\n"; ++$test; print "ok $test\n"; $test++; } + +# See if the things Camel-III says are true: 29..33 + +# Chapter 2 pp67/68 +my $vs = v1.20.300.4000; +okeq($vs,"\x{1}\x{14}\x{12c}\x{fa0}","v-string ne \\x{}"); +okeq($vs,chr(1).chr(20).chr(300).chr(4000),"v-string ne chr()"); +okeq('foo',((chr(193) eq 'A') ? v134.150.150 : v102.111.111),"v-string ne ''"); + +# Chapter 15, pp403 + +# See if sane addr and gethostbyaddr() work +eval { require Socket; gethostbyaddr(v127.0.0.1,Socket::AF_INET()) }; +if ($@) + { + # No - so don't test insane fails. + skip("No Socket"); + } +else + { + my $ip = v2004.148.0.1; + my $host; + eval { $host = gethostbyaddr($ip,Socket::AF_INET()) }; + okeq($@ =~ /Wide character/,1,"Non-bytes leak to gethostbyaddr"); + } + +# Chapter 28, pp671 +okeq(v5.6.0 lt v5.7.0,1,"v5.6.0 lt v5.7.0 fails"); + +# floating point too messy +# my $v = ord($^V)+ord(substr($^V,1,1))/1000+ord(substr($^V,2,1))/1000000; +# okeq($v,$],"\$^V and \$] do not match"); |