summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2001-12-07 15:07:15 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2001-12-07 15:07:15 +0000
commitf5f8dfbd6625bb2419938c0740041d8b74424a0f (patch)
treef2d8afee6572bdf8649221c0c71f022c198c5201
parente99cca918766541e5f35aa228351805d2bf99e8f (diff)
parent2edcc0d9244f31a2b7378da95791f37efa9301ef (diff)
downloadperl-f5f8dfbd6625bb2419938c0740041d8b74424a0f.tar.gz
Integrate mainline
p4raw-id: //depot/perlio@13514
-rw-r--r--Changes688
-rw-r--r--MANIFEST23
-rw-r--r--NetWare/Makefile2
-rw-r--r--README.vms2
-rw-r--r--configure.com6
-rw-r--r--djgpp/config.over2
-rw-r--r--djgpp/configure.bat2
-rw-r--r--djgpp/djgpp.c20
-rw-r--r--djgpp/djgpp.h55
-rw-r--r--djgpp/djgppsed.sh2
-rw-r--r--doio.c8
-rw-r--r--doop.c9
-rw-r--r--embed.h2
-rwxr-xr-xembed.pl1
-rwxr-xr-xext/Devel/PPPort/Changes18
-rw-r--r--ext/Devel/PPPort/MANIFEST15
-rw-r--r--ext/Devel/PPPort/Makefile.PL33
-rw-r--r--ext/Devel/PPPort/PPPort.pm269
-rw-r--r--ext/Devel/PPPort/PPPort.xs (renamed from ext/Devel/PPPort/harness/Harness.xs)6
-rw-r--r--ext/Devel/PPPort/README48
-rw-r--r--ext/Devel/PPPort/harness/Harness.pm21
-rw-r--r--ext/Devel/PPPort/harness/Makefile.PL36
-rw-r--r--ext/Devel/PPPort/harness/t/test.t99
-rw-r--r--ext/Devel/PPPort/module2.c (renamed from ext/Devel/PPPort/harness/module2.c)2
-rw-r--r--ext/Devel/PPPort/module3.c (renamed from ext/Devel/PPPort/harness/module3.c)2
-rw-r--r--ext/Devel/PPPort/soak160
-rw-r--r--ext/Devel/PPPort/t/test.t99
-rw-r--r--ext/Encode/Encode.pm9
-rw-r--r--ext/I18N/Langinfo/Langinfo.t68
-rw-r--r--ext/I18N/Langinfo/Langinfo.xs10
-rw-r--r--ext/List/Util/Makefile.PL43
-rw-r--r--ext/Opcode/Safe.pm2
-rw-r--r--ext/Time/HiRes/HiRes.xs2
-rw-r--r--global.sym2
-rw-r--r--hints/solaris_2.sh3
-rw-r--r--hints/super-ux.sh20
-rw-r--r--hv.c4
-rw-r--r--hv.h4
-rw-r--r--lib/AutoSplit.t4
-rw-r--r--lib/Carp.pm91
-rw-r--r--lib/Carp/Heavy.pm7
-rw-r--r--lib/DB.t698
-rw-r--r--lib/Exporter/Heavy.pm9
-rw-r--r--lib/File/Basename.pm12
-rwxr-xr-xlib/File/Basename.t4
-rw-r--r--lib/File/Spec/VMS.pm2
-rw-r--r--[-rwxr-xr-x]lib/File/Spec/t/Functions.t (renamed from lib/File/Spec/Functions.t)0
-rw-r--r--[-rwxr-xr-x]lib/File/Spec/t/Spec.t (renamed from lib/File/Spec.t)0
-rw-r--r--lib/File/Spec/t/rel2abs2rel.t27
-rw-r--r--lib/Math/BigFloat.pm217
-rw-r--r--lib/Math/BigInt.pm265
-rw-r--r--lib/Math/BigInt/Calc.pm640
-rw-r--r--lib/Math/BigInt/t/bare_mbi.t42
-rw-r--r--lib/Math/BigInt/t/bigfltpm.inc54
-rwxr-xr-xlib/Math/BigInt/t/bigfltpm.t2
-rw-r--r--lib/Math/BigInt/t/bigintc.t20
-rw-r--r--lib/Math/BigInt/t/bigintpm.inc153
-rwxr-xr-xlib/Math/BigInt/t/bigintpm.t5
-rwxr-xr-xlib/Math/BigInt/t/sub_mbf.t2
-rwxr-xr-xlib/Math/BigInt/t/sub_mbi.t10
-rw-r--r--lib/Net/Ping.pm501
-rw-r--r--lib/Net/t/config.t5
-rw-r--r--lib/Net/t/ftp.t3
-rw-r--r--lib/Net/t/hostname.t3
-rw-r--r--lib/Net/t/netrc.t3
-rw-r--r--lib/Net/t/nntp.t3
-rw-r--r--lib/Net/t/require.t3
-rw-r--r--lib/Net/t/smtp.t3
-rw-r--r--lib/Net/t/time.t3
-rw-r--r--lib/Term/Cap.pm29
-rw-r--r--lib/Unicode/UCD.t315
-rw-r--r--lib/open.pm7
-rw-r--r--lib/open.t2
-rw-r--r--mg.c11
-rw-r--r--op.c10
-rw-r--r--patchlevel.h2
-rw-r--r--pod/buildtoc.PL1
-rw-r--r--pod/perl.pod1
-rw-r--r--pod/perl561delta.pod3646
-rw-r--r--pod/perldelta.pod302
-rw-r--r--pod/perlnewmod.pod2
-rw-r--r--pod/perlpacktut.pod73
-rw-r--r--pod/perlport.pod27
-rw-r--r--pod/perltoc.pod557
-rw-r--r--pp.c29
-rw-r--r--pp_hot.c6
-rw-r--r--pp_sys.c1
-rw-r--r--proto.h1
-rw-r--r--regexec.c14
-rw-r--r--sv.c4
-rwxr-xr-xt/TEST2
-rwxr-xr-xt/base/lex.t4
-rwxr-xr-xt/base/term.t2
-rwxr-xr-xt/comp/script.t17
-rwxr-xr-xt/io/open.t368
-rw-r--r--t/lib/Math/BigFloat/Subclass.pm7
-rw-r--r--t/lib/Math/BigInt/BareCalc.pm35
-rw-r--r--t/lib/Math/BigInt/Subclass.pm5
-rw-r--r--t/lib/strict/subs8
-rwxr-xr-xt/op/exec.t102
-rwxr-xr-xt/op/inc.t160
-rwxr-xr-xt/op/magic.t5
-rw-r--r--t/op/re_tests1
-rwxr-xr-xt/op/ref.t2
-rwxr-xr-xt/op/tr.t376
-rw-r--r--t/run/kill_perl.t15
-rw-r--r--t/test.pl55
-rw-r--r--utf8.c7
-rw-r--r--util.c2
-rw-r--r--vms/descrip_mms.template13
-rw-r--r--vms/ext/filespec.t113
-rw-r--r--vms/test.com14
-rw-r--r--vms/vms.c108
-rw-r--r--vms/vmsish.h4
-rw-r--r--win32/perlhost.h10
115 files changed, 8505 insertions, 2558 deletions
diff --git a/Changes b/Changes
index 8c3613ca84..1a4aed4982 100644
--- a/Changes
+++ b/Changes
@@ -31,6 +31,694 @@ or any other branch.
Version v5.7.2 Development release working toward v5.8
--------------
____________________________________________________________________________
+[ 13491] By: jhi on 2001/12/06 15:43:22
+ Log: Subject: [PATCH Perl@13462, on top of prev. multiplicity patch] MY_RAND workaround update
+ From: lane@DUPHY4.Physics.Drexel.Edu (Charles Lane)
+ Date: Thu, 6 Dec 2001 11:41:25 EST
+ Message-Id: <011206114105.67cab@DUPHY4.Physics.Drexel.Edu>
+ Branch: perl
+ ! vms/vms.c vms/vmsish.h
+____________________________________________________________________________
+[ 13490] By: jhi on 2001/12/06 15:08:40
+ Log: Subject: [PATCH] Re: weirdness in regexps
+ From: Robin Houston <robin@kitsite.com>
+ Date: Thu, 6 Dec 2001 14:44:01 +0000
+ Message-ID: <20011206144401.A27752@puffinry.freeserve.co.uk>
+ Branch: perl
+ ! op.c t/lib/strict/subs
+____________________________________________________________________________
+[ 13489] By: jhi on 2001/12/06 15:07:18
+ Log: Make the -b -c -S tests count all of the /dev, not just
+ check the first one, as suggested by Benjamin Goldberg.
+ Branch: perl
+ ! t/op/stat.t
+____________________________________________________________________________
+[ 13488] By: jhi on 2001/12/06 14:41:02
+ Log: Subject: Re: [PATCH: bleadperl] casefold backref
+ From: "Jeff 'japhy' Pinyan" <jeffp@crusoe.net>
+ Date: Thu, 6 Dec 2001 10:39:45 -0500 (EST)
+ Message-ID: <Pine.GSO.4.21.0112061038490.14590-100000@crusoe.crusoe.net>
+ Branch: perl
+ ! regexec.c
+____________________________________________________________________________
+[ 13487] By: jhi on 2001/12/06 14:30:45
+ Log: Nits noticed by Philip Newton, and de-tab DB.t.
+ Branch: perl
+ ! lib/DB.t
+____________________________________________________________________________
+[ 13486] By: jhi on 2001/12/06 14:23:06
+ Log: Subject: [PATCH] Re: counting tr thinks it's modifying
+ From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
+ Date: 6 Dec 2001 11:06:01 -0000
+ Message-Id: <slrna0ukap.kbt.rgarciasuarez@rafael.kazibao.net>
+ Branch: perl
+ ! op.c t/op/tr.t
+____________________________________________________________________________
+[ 13485] By: jhi on 2001/12/06 14:07:54
+ Log: Subject: [PATCH: bleadperl] casefold backref
+ From: Hugo van der Sanden <hv@crypt.compulink.co.uk>
+ Date: Wed, 05 Dec 2001 17:27:05 +0000
+ Message-Id: <200112051727.fB5HR5422706@crypt.compulink.co.uk>
+ Branch: perl
+ ! regexec.c t/op/re_tests
+____________________________________________________________________________
+[ 13484] By: jhi on 2001/12/06 03:04:18
+ Log: Subject: [PATCH Perl@13440] MULTIPLICITY fixups
+ From: lane@DUPHY4.Physics.Drexel.Edu (Charles Lane)
+ Date: Wed, 5 Dec 2001 22:34:53 EST
+ Message-Id: <011205223453.8122e@DUPHY4.Physics.Drexel.Edu>
+ Branch: perl
+ ! mg.c vms/vms.c vms/vmsish.h
+____________________________________________________________________________
+[ 13483] By: jhi on 2001/12/06 02:59:40
+ Log: Subject: [PATCH lib/File/Spec* MANIFEST] Better abs2rel/rel2abs/canonpath tests
+ From: Michael G Schwern <schwern@pobox.com>
+ Date: Wed, 5 Dec 2001 19:52:58 -0500
+ Message-ID: <20011205195257.A903@blackrider>
+ Branch: perl
+ + lib/File/Spec/t/Functions.t lib/File/Spec/t/Spec.t
+ + lib/File/Spec/t/rel2abs2rel.t
+ - lib/File/Spec.t lib/File/Spec/Functions.t
+ ! MANIFEST
+____________________________________________________________________________
+[ 13482] By: jhi on 2001/12/06 02:48:27
+ Log: Subject: Re: Silly stat() portability questions
+ From: Benjamin Goldberg <goldbb2@earthlink.net>
+ Date: Wed, 05 Dec 2001 22:52:35 -0500
+ Message-ID: <3C0EEB83.8CE93CA2@earthlink.net>
+ Branch: perl
+ ! pod/perlport.pod
+____________________________________________________________________________
+[ 13481] By: jhi on 2001/12/06 02:39:43
+ Log: Subject: [PATCH perl@13462]] VMS-only File::Spec->canonpath fix
+ From: "Craig A. Berry" <craigberry@mac.com>
+ Date: Wed, 05 Dec 2001 16:41:59 -0600
+ Message-Id: <5.1.0.14.2.20011205160043.02160e90@exchi01>
+ Branch: perl
+ ! README.vms configure.com lib/File/Spec/VMS.pm
+ ! vms/ext/filespec.t
+____________________________________________________________________________
+[ 13480] By: jhi on 2001/12/05 19:53:05
+ Log: $apply->('club', $glibc_maintainers);
+
+ (Nick Clark just reported that <langinfo.h> YESSTR
+ is an empty string in Linux 2.4.16-rmk glibc 2.2.4-5)
+ Branch: perl
+ ! ext/I18N/Langinfo/Langinfo.t
+____________________________________________________________________________
+[ 13479] By: jhi on 2001/12/05 19:49:16
+ Log: Admonish against assuming A^HUNIX fs/uid/gid semantics.
+ Branch: perl
+ ! pod/perlport.pod
+____________________________________________________________________________
+[ 13477] By: jhi on 2001/12/05 17:53:13
+ Log: Restore the /dev -b -c -S part of the test.
+ Branch: perl
+ ! t/op/stat.t
+____________________________________________________________________________
+[ 13476] By: jhi on 2001/12/05 17:29:36
+ Log: Retract #13475 until Arthur gets back to the mine.
+ Branch: perl
+ ! op.c t/run/kill_perl.t
+____________________________________________________________________________
+[ 13475] By: jhi on 2001/12/05 17:07:00
+ Log: (retracted by #13476)
+
+ Manually apply #13474; fixes stale reference to dead
+ CvOUTSIDE(); this can happen when anonymous subroutines
+ that aren't closures are returned from an eval""
+
+ (threads/shared/sv_refs.t is coredump-unhappy about this change)
+ Branch: perl
+ ! op.c t/run/kill_perl.t
+____________________________________________________________________________
+[ 13472] By: jhi on 2001/12/05 13:30:47
+ Log: Subject: Re: [PATCH] File::Basename pod and .t (was: perlpacktut.pod v0.0 (split))
+ From: Wolfgang Laun <Wolfgang.Laun@alcatel.at>
+ Date: Wed, 05 Dec 2001 10:49:20 +0100
+ Message-ID: <3C0DEDA0.C58A8A9E@alcatel.at>
+ Branch: perl
+ ! lib/File/Basename.pm lib/File/Basename.t
+____________________________________________________________________________
+[ 13471] By: jhi on 2001/12/05 13:22:50
+ Log: Subject: [PATCH t/op/magic.t] Removing a TODO
+ From: Michael G Schwern <schwern@pobox.com>
+ Date: Wed, 5 Dec 2001 02:47:59 -0500
+ Message-ID: <20011205024759.H14333@blackrider>
+ Branch: perl
+ ! t/op/magic.t
+____________________________________________________________________________
+[ 13470] By: jhi on 2001/12/05 13:21:09
+ Log: Subject: [PATCH t/op/stat.t vms/test.com] stat.t portability, the LAST VMS exception!
+ From: Michael G Schwern <schwern@pobox.com>
+ Date: Wed, 5 Dec 2001 02:22:05 -0500
+ Message-ID: <20011205022205.F14333@blackrider>
+ Branch: perl
+ ! t/op/stat.t vms/test.com
+____________________________________________________________________________
+[ 13469] By: jhi on 2001/12/05 03:44:59
+ Log: Subject: Re: [PATCH t/op/stat.t t/test.pl] stat.t cleanup, first pass
+ From: Michael G Schwern <schwern@pobox.com>
+ Date: Tue, 4 Dec 2001 23:40:10 -0500
+ Message-ID: <20011204234010.B14333@blackrider>
+ Branch: perl
+ ! t/op/stat.t
+____________________________________________________________________________
+[ 13468] By: jhi on 2001/12/05 01:37:04
+ Log: Subject: [PATCH t/op/stat.t t/test.pl] stat.t cleanup, first pass
+ From: Michael G Schwern <schwern@pobox.com>
+ Date: Tue, 4 Dec 2001 21:09:18 -0500
+ Message-ID: <20011204210918.D13279@blackrider>
+
+ t/test.
+ Branch: perl
+ ! t/test.pl
+____________________________________________________________________________
+[ 13467] By: jhi on 2001/12/05 01:36:44
+ Log: (accidentally empty check-in)
+ Branch: perl
+ ! t/op/stat.t
+____________________________________________________________________________
+[ 13466] By: jhi on 2001/12/04 22:51:19
+ Log: Subject: [PATCH] $., $%, $=, and $- are IV's now
+ From: "H.Merijn Brand" <h.m.brand@hccnet.nl>
+ Date: Tue, 04 Dec 2001 23:40:27 +0100
+ Message-Id: <20011204233412.304B.H.M.BRAND@hccnet.nl>
+ Branch: perl
+ ! mg.c
+____________________________________________________________________________
+[ 13465] By: jhi on 2001/12/04 22:50:26
+ Log: Subject: [PATCH] minor pod fix in Safe.pm
+ From: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
+ Date: Tue, 4 Dec 2001 22:02:34 +0100
+ Message-ID: <20011204220234.A17293@rafael>
+ Branch: perl
+ ! ext/Opcode/Safe.pm
+____________________________________________________________________________
+[ 13464] By: jhi on 2001/12/04 22:47:43
+ Log: CRLF GRRR.
+ Branch: perl
+ ! djgpp/configure.bat
+____________________________________________________________________________
+[ 13463] By: jhi on 2001/12/04 22:46:28
+ Log: DJGPP fixes from Laszlo Molnar.
+ Branch: perl
+ ! djgpp/configure.bat djgpp/djgpp.h
+____________________________________________________________________________
+[ 13462] By: jhi on 2001/12/04 14:56:22
+ Log: Update Changes.
+ Branch: perl
+ ! Changes patchlevel.h
+____________________________________________________________________________
+[ 13461] By: jhi on 2001/12/04 14:49:45
+ Log: Must wipe out the memory of real Socket before starting
+ to use the old one.
+ Branch: perl
+ ! lib/Net/t/config.t
+____________________________________________________________________________
+[ 13460] By: jhi on 2001/12/04 14:40:28
+ Log: LC_ALL might trump LANG.
+ Branch: perl
+ ! lib/open.t
+____________________________________________________________________________
+[ 13459] By: jhi on 2001/12/04 14:39:38
+ Log: Make the eval runtime.
+ Branch: perl
+ ! lib/open.pm
+____________________________________________________________________________
+[ 13458] By: jhi on 2001/12/04 14:08:17
+ Log: Make the Langinfo test both more lenient (allow
+ for any symbol not to exists) and stricter (add
+ more symbols).
+ Branch: perl
+ ! ext/I18N/Langinfo/Langinfo.t
+____________________________________________________________________________
+[ 13457] By: gsar on 2001/12/04 14:07:01
+ Log: integrate change#13453 from maint-5.6
+
+ tweak change#11399 to use an explicit flag rather than
+ ass_u_ming w32_pseudo_id will only be zero for the real
+ toplevel interpreter; avoids multiple hosts from diddling
+ the environment at the same time
+ Branch: perl
+ !> win32/perlhost.h
+____________________________________________________________________________
+[ 13456] By: jhi on 2001/12/04 13:35:58
+ Log: Subject: [PATCH] VMS update for perldelta.pod
+ From: "Craig A. Berry" <craigberry@mac.com>
+ Date: Tue, 4 Dec 2001 00:23:12 -0600
+ Message-Id: <a05101002b83218be190d@[172.16.52.1]>
+ Branch: perl
+ ! pod/perldelta.pod
+____________________________________________________________________________
+[ 13455] By: jhi on 2001/12/04 13:23:19
+ Log: NetWare tweak from Ananth Kesari.
+ Branch: perl
+ ! NetWare/Makefile
+____________________________________________________________________________
+[ 13454] By: jhi on 2001/12/04 13:17:38
+ Log: Upgrade to Net::Ping 2.07, from Rob Brown.
+ Not adding the test suite because of its many assumptions.
+ Branch: perl
+ ! lib/Net/Ping.pm
+____________________________________________________________________________
+[ 13452] By: jhi on 2001/12/04 04:28:29
+ Log: Add hints file for SUPER-UX: the UNIX of NEC SX series,
+ from Len Makin.
+ Branch: perl
+ + hints/super-ux.sh
+ ! MANIFEST
+____________________________________________________________________________
+[ 13451] By: jhi on 2001/12/04 01:58:03
+ Log: Add Mac OS X known failures to perldelta.
+ Branch: perl
+ ! pod/perldelta.pod
+____________________________________________________________________________
+[ 13450] By: jhi on 2001/12/04 01:26:38
+ Log: I think it's time to call the utf8 code non-test.
+ Branch: perl
+ ! utf8.c
+____________________________________________________________________________
+[ 13449] By: jhi on 2001/12/04 00:59:27
+ Log: Retract #13303, need rethink.
+ Branch: perl
+ ! utf8.c
+____________________________________________________________________________
+[ 13448] By: jhi on 2001/12/03 22:40:22
+ Log: Subject: [PATCH perl@13440] VMS install fix-ups: add libnetcfg and xsubpp as utility commands
+ From: "Craig A. Berry" <craigberry@mac.com>
+ Date: Mon, 03 Dec 2001 16:28:06 -0600
+ Message-Id: <5.1.0.14.2.20011202223303.01c3ab98@exchi01>
+ Branch: perl
+ ! configure.com lib/File/Basename.pm vms/descrip_mms.template
+____________________________________________________________________________
+[ 13447] By: jhi on 2001/12/03 22:37:12
+ Log: Subject: [PATCH] Solaris/longdouble needs /opt/SUNWspro/lib
+ From: Andy Dougherty <doughera@lafayette.edu>
+ Date: Mon, 3 Dec 2001 15:48:26 -0500 (EST)
+ Message-ID: <Pine.SOL.4.10.10112031543520.5207-100000@maxwell.phys.lafayette.edu>
+ Branch: perl
+ ! hints/solaris_2.sh
+____________________________________________________________________________
+[ 13446] By: jhi on 2001/12/03 22:29:58
+ Log: This test is not very robust on 8.3-constrained systems:
+ all the "with truncated name" lines between "Autosplitting ..."
+ and "some names are not unique" lines are unexpected,
+ and the truncation message becomes:
+ testtest.al, testtest.al truncate to testtest
+ Branch: perl
+ ! lib/AutoSplit.t
+____________________________________________________________________________
+[ 13445] By: jhi on 2001/12/03 22:13:07
+ Log: DOS/DJGPP has nl_langinfo() but nothing much in it.
+ Branch: perl
+ ! ext/I18N/Langinfo/Langinfo.t
+____________________________________________________________________________
+[ 13444] By: jhi on 2001/12/03 22:02:52
+ Log: Test::Morify UCD.t
+ Branch: perl
+ ! lib/Unicode/UCD.t
+____________________________________________________________________________
+[ 13443] By: jhi on 2001/12/03 21:50:13
+ Log: If Socket has not been built (e.g. DJGPP) the libnet
+ tests fall over with (too) much noise.
+ Branch: perl
+ ! lib/Net/t/config.t lib/Net/t/ftp.t lib/Net/t/hostname.t
+ ! lib/Net/t/netrc.t lib/Net/t/nntp.t lib/Net/t/require.t
+ ! lib/Net/t/smtp.t lib/Net/t/time.t
+____________________________________________________________________________
+[ 13442] By: jhi on 2001/12/03 17:22:08
+ Log: Subject: [PATCH] shared hash keys and ++/--
+ From: Nicholas Clark <nick@ccl4.org>
+ Date: Mon, 3 Dec 2001 16:37:16 +0000
+ Message-ID: <20011203163716.C21702@plum.flirble.org>
+ Branch: perl
+ ! pp.c pp_hot.c sv.c t/op/inc.t
+____________________________________________________________________________
+[ 13441] By: jhi on 2001/12/03 17:15:52
+ Log: Subject: [PATCH lib/Term/Cap.pm] was Re: [PATCH] Shared hash keys
+ From: Jonathan Stowe <jns@gellyfish.com>
+ Date: Mon, 3 Dec 2001 15:48:38 +0000 (GMT)
+ Message-ID: <Pine.LNX.4.33.0112031543290.386-100000@orpheus.gellyfish.com>
+ Branch: perl
+ ! lib/Term/Cap.pm
+____________________________________________________________________________
+[ 13440] By: jhi on 2001/12/03 14:26:58
+ Log: Update Changes.
+ Branch: perl
+ ! Changes patchlevel.h
+____________________________________________________________________________
+[ 13439] By: jhi on 2001/12/03 14:22:05
+ Log: perldelta tweaks.
+ Branch: perl
+ ! pod/perldelta.pod
+____________________________________________________________________________
+[ 13438] By: jhi on 2001/12/03 14:12:08
+ Log: Subject: [PATCH] perlnewmod.pod: Fixed URL for Ken William's Tutorial
+ From: Sam Tregar <sam@tregar.com>
+ Date: Mon, 3 Dec 2001 00:04:07 -0500 (EST)
+ Message-ID: <Pine.LNX.4.33.0112030002210.24619-100000@localhost.localdomain>
+ Branch: perl
+ ! pod/perlnewmod.pod
+____________________________________________________________________________
+[ 13437] By: jhi on 2001/12/03 14:08:59
+ Log: microperl casting nit.
+ Branch: perl
+ ! utf8.c
+____________________________________________________________________________
+[ 13436] By: jhi on 2001/12/03 14:03:21
+ Log: Make sharepvn a macro since all it does is a deref.
+ Branch: perl
+ ! embed.h embed.pl global.sym hv.c hv.h proto.h
+____________________________________________________________________________
+[ 13435] By: jhi on 2001/12/03 13:38:14
+ Log: perldelta updates.
+ Branch: perl
+ ! pod/perldelta.pod
+____________________________________________________________________________
+[ 13434] By: jhi on 2001/12/03 13:13:02
+ Log: PPPort update from Paul Marquess.
+ Branch: perl
+ + ext/Devel/PPPort/Changes ext/Devel/PPPort/PPPort.xs
+ + ext/Devel/PPPort/module2.c ext/Devel/PPPort/module3.c
+ + ext/Devel/PPPort/t/test.t
+ - ext/Devel/PPPort/harness/Harness.pm
+ - ext/Devel/PPPort/harness/Harness.xs
+ - ext/Devel/PPPort/harness/Makefile.PL
+ - ext/Devel/PPPort/harness/module2.c
+ - ext/Devel/PPPort/harness/module3.c
+ - ext/Devel/PPPort/harness/t/test.t
+ ! MANIFEST ext/Devel/PPPort/MANIFEST
+ ! ext/Devel/PPPort/Makefile.PL ext/Devel/PPPort/PPPort.pm
+ ! ext/Devel/PPPort/README ext/Devel/PPPort/TODO
+ ! ext/Devel/PPPort/soak
+____________________________________________________________________________
+[ 13433] By: jhi on 2001/12/03 12:57:23
+ Log: No use talking about dynamic library search patch
+ unless we are having a dynamic build.
+ Branch: perl
+ ! t/TEST
+____________________________________________________________________________
+[ 13432] By: jhi on 2001/12/02 22:35:04
+ Log: Be more explicit on the List::Util build trick,
+ should also stop unneeded rebuilds on static builds.
+ Branch: perl
+ ! ext/List/Util/Makefile.PL
+____________________________________________________________________________
+[ 13431] By: jhi on 2001/12/02 22:18:45
+ Log: We need to replace the optimize (-O1) with
+ the -h scalar0 -h vector0, not append them
+ to the ccflags.
+ Branch: perl
+ ! hints/unicos.sh hints/unicosmk.sh
+____________________________________________________________________________
+[ 13430] By: jhi on 2001/12/02 20:01:24
+ Log: Subject: [PATCH] Shared hash keys
+ From: Nicholas Clark <nick@ccl4.org>
+ Date: Sun, 2 Dec 2001 20:52:32 +0000
+ Message-ID: <20011202205232.U21702@plum.flirble.org>
+ Branch: perl
+ ! doop.c t/op/tr.t
+____________________________________________________________________________
+[ 13429] By: jhi on 2001/12/02 19:19:54
+ Log: Better add new files to MANIFEST, too.
+ Branch: perl
+ ! MANIFEST
+____________________________________________________________________________
+[ 13428] By: jhi on 2001/12/02 18:38:18
+ Log: Subject: {PATCH] perlpacktut.pod
+ From: "Wolfgang Laun" <wolfgang.laun@chello.at>
+ Date: Sun, 02 Dec 2001 19:55:06 +0100
+ Message-ID: <200112021955060600.009C0EF9@smtp.chello.at>
+ Branch: perl
+ ! pod/perlpacktut.pod
+____________________________________________________________________________
+[ 13427] By: jhi on 2001/12/02 17:07:57
+ Log: Various small nits found by DJGPP build.
+ Branch: perl
+ ! doio.c mg.c pp.c util.c
+____________________________________________________________________________
+[ 13426] By: jhi on 2001/12/02 16:55:21
+ Log: Subject: RE: More verbose POD for Carp
+ From: "Benjamin J. Tilly" <ben_tilly@operamail.com>
+ Date: Sun, 2 Dec 2001 11:32:51 -0500
+ Message-ID: <3C0A9748@operamail.com>
+ Branch: perl
+ ! lib/Carp.pm
+____________________________________________________________________________
+[ 13425] By: jhi on 2001/12/02 16:54:06
+ Log: Add a header for DJGPP with the function prototypes.
+ Branch: perl
+ + djgpp/djgpp.h
+ ! MANIFEST djgpp/djgpp.c
+____________________________________________________________________________
+[ 13424] By: jhi on 2001/12/02 01:17:43
+ Log: Subject: [PATCH] chdir() with an empty tainted argument on Win32
+ From: Abe Timmerman <abe@ztreet.demon.nl>
+ Date: Sun, 02 Dec 2001 02:41:25 +0100
+ Message-ID: <j8vi0uorud2fa9vp0q2dpmn7tpr5hqec1d@4ax.com>
+ Branch: perl
+ ! pp_sys.c
+____________________________________________________________________________
+[ 13423] By: jhi on 2001/12/02 01:05:43
+ Log: There isn't PTR2INT(), there's PTR2IV().
+ Branch: perl
+ ! ext/Time/HiRes/HiRes.xs
+____________________________________________________________________________
+[ 13422] By: jhi on 2001/12/02 00:56:05
+ Log: Subject: [ID 20011201.170] Time::HiRes in devel-perl causes segfaults for xs users
+ From: Marc Lehmann <root@schmorp.de>
+ Date: Sun, 02 Dec 2001 02:44:53 +0100
+ Message-Id: <E16ALgb-0006Yw-00.pgcc-forever-2001-12-02-02-44-53@fuji.laendle>
+ Branch: perl
+ ! ext/Time/HiRes/HiRes.xs
+____________________________________________________________________________
+[ 13421] By: jhi on 2001/12/02 00:25:35
+ Log: encode()/decode() examples.
+ Branch: perl
+ ! ext/Encode/Encode.pm
+____________________________________________________________________________
+[ 13420] By: jhi on 2001/12/02 00:14:38
+ Log: DJGPP tweaks from Laszlo Molnar.
+ Branch: perl
+ ! djgpp/config.over djgpp/djgppsed.sh
+____________________________________________________________________________
+[ 13419] By: jhi on 2001/12/01 20:52:19
+ Log: Update Changes.
+ Branch: perl
+ ! Changes patchlevel.h
+____________________________________________________________________________
+[ 13418] By: jhi on 2001/12/01 20:40:03
+ Log: Integrate perlio;
+
+ Skip socket-ness tests on handles (e.g. PerlIO::Scalar)
+ which do not have file descriptors. Noticed a possibly
+ worse problem in the process ...
+ Branch: perl
+ !> doio.c
+____________________________________________________________________________
+[ 13417] By: jhi on 2001/12/01 20:37:40
+ Log: Non-VMS-fixed and Win32-skipped version of
+
+ Subject: [PATCH t/op/exec.t] Portabilty fix
+ From: Michael G Schwern <schwern@pobox.com>
+ Date: Fri, 30 Nov 2001 16:09:27 -0500
+ Message-ID: <20011130160927.A10406@blackrider>
+ Branch: perl
+ ! t/op/exec.t
+____________________________________________________________________________
+[ 13416] By: jhi on 2001/12/01 20:35:31
+ Log: Subject: Enabling strict on Carp/Heavy, + internal documentation
+ From: "Benjamin J. Tilly" <ben_tilly@operamail.com>
+ Date: Sat, 1 Dec 2001 07:01:09 -0500
+ Message-ID: <3C0D2E39@operamail.com>
+
+ Subject: More verbose POD for Carp
+ From: "Benjamin J. Tilly" <ben_tilly@operamail.com>
+ Date: Sat, 1 Dec 2001 08:04:16 -0500
+ Message-ID: <3C285C2B@operamail.com>
+ Branch: perl
+ ! lib/Carp.pm lib/Carp/Heavy.pm
+____________________________________________________________________________
+[ 13415] By: jhi on 2001/12/01 20:31:06
+ Log: Subject: [PATCH lib/DB.t] Strictures, dual variables
+ From: chromatic <chromatic@rmci.net>
+ Date: Sat, 01 Dec 2001 12:41:58 -0700
+ Message-ID: <20011201194946.50449.qmail@onion.perl.org>
+ Branch: perl
+ ! lib/DB.t
+____________________________________________________________________________
+[ 13414] By: jhi on 2001/12/01 20:30:17
+ Log: Try to make a missing RADIXCHAR a softer kinder error.
+ Branch: perl
+ ! ext/I18N/Langinfo/Langinfo.t
+____________________________________________________________________________
+[ 13413] By: jhi on 2001/12/01 20:21:27
+ Log: Have a little faith on nl_langinfo() itself.
+ Branch: perl
+ ! ext/I18N/Langinfo/Langinfo.xs
+____________________________________________________________________________
+[ 13412] By: jhi on 2001/12/01 18:47:07
+ Log: Typo (a missing endparen) and thinko (_MAXSTRMSG is
+ the max, not max plus one)
+ Branch: perl
+ ! ext/I18N/Langinfo/Langinfo.xs
+____________________________________________________________________________
+[ 13411] By: jhi on 2001/12/01 18:45:32
+ Log: Make reality agree with the comment.
+ Branch: perl
+ ! ext/I18N/Langinfo/Langinfo.xs
+____________________________________________________________________________
+[ 13410] By: jhi on 2001/12/01 18:43:11
+ Log: Try to protect against wild langinfo() arguments.
+ Branch: perl
+ ! ext/I18N/Langinfo/Langinfo.xs
+____________________________________________________________________________
+[ 13408] By: jhi on 2001/12/01 18:18:34
+ Log: If we are inside an eval, let's be silent about
+ separate symbols and just croak() in the end.
+ Branch: perl
+ ! lib/Exporter/Heavy.pm
+____________________________________________________________________________
+[ 13406] By: jhi on 2001/12/01 16:31:02
+ Log: Subject: Fix for Exporter error reporting behaviour
+ From: "Benjamin J. Tilly" <ben_tilly@operamail.com>
+ Date: Sat, 1 Dec 2001 06:34:48 -0500
+ Message-ID: <3C0D1B9A@operamail.com>
+ Branch: perl
+ ! lib/Exporter.pm lib/Exporter/Heavy.pm
+____________________________________________________________________________
+[ 13405] By: jhi on 2001/12/01 16:29:27
+ Log: Need to hide behind an eval to avoid a warning
+ about :utf8 on non-perlio configs.
+ Branch: perl
+ ! lib/open.t
+____________________________________________________________________________
+[ 13404] By: jhi on 2001/12/01 15:55:51
+ Log: Subject: [PATCH 20010902.002] parser panics on lvalue methods
+ From: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
+ Date: Fri, 30 Nov 2001 23:46:58 +0100
+ Message-ID: <20011130234658.A717@rafael>
+ Branch: perl
+ ! op.c t/op/method.t
+____________________________________________________________________________
+[ 13403] By: jhi on 2001/12/01 15:54:23
+ Log: Subject: Re: [ID 20011129.163] B::Xref- $top corrupt
+ From: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
+ Date: Thu, 29 Nov 2001 22:46:12 +0100
+ Message-ID: <20011129224612.A699@rafael>
+ Branch: perl
+ ! ext/B/B/Xref.pm
+____________________________________________________________________________
+[ 13402] By: jhi on 2001/12/01 15:52:13
+ Log: Subject: Re: [PATCH] [ID 20011130.166] "in memory" file handles via scalas not documented in perldoc -f open
+ From: Tels <perl_dummy@bloodgate.com>
+ Date: Sat, 01 Dec 2001 10:29:11 +0100 (CET)
+ Message-Id: <200112010931.LAA29309@tiku.hut.fi>
+ Branch: perl
+ ! pod/perlfunc.pod
+____________________________________________________________________________
+[ 13401] By: jhi on 2001/12/01 15:48:13
+ Log: Subject: [REPATCH] reference pointer comparison
+ From: Nicholas Clark <nick@ccl4.org>
+ Date: Sat, 1 Dec 2001 13:00:17 +0000
+ Message-ID: <20011201130017.I21702@plum.flirble.org>
+ Branch: perl
+ ! pp.c
+____________________________________________________________________________
+[ 13400] By: jhi on 2001/12/01 15:43:15
+ Log: Upgrade to Storable 1.0.14.
+ Branch: perl
+ ! ext/Storable/ChangeLog ext/Storable/Storable.pm
+____________________________________________________________________________
+[ 13399] By: jhi on 2001/12/01 15:40:13
+ Log: Add simple caches for ::viacode() and ::vianame().
+ Branch: perl
+ ! lib/charnames.pm lib/charnames.t
+____________________________________________________________________________
+[ 13397] By: jhi on 2001/12/01 04:35:39
+ Log: Regen toc and modlib.
+ Branch: perl
+ ! pod/perlmodlib.pod pod/perltoc.pod
+____________________________________________________________________________
+[ 13396] By: jhi on 2001/12/01 04:31:53
+ Log: Upgrade to podlators-1.18.
+ Branch: perl
+ ! lib/Pod/ParseLink.pm lib/Pod/Text/Termcap.pm
+____________________________________________________________________________
+[ 13395] By: jhi on 2001/11/30 23:03:20
+ Log: -h scalar0 -h vector0 seems to help for both
+ UNICOS and UNICOS/mk on the unpack %65c problems.
+
+ (replaces #13393)
+ Branch: perl
+ ! hints/unicos.sh hints/unicosmk.sh
+____________________________________________________________________________
+[ 13394] By: jhi on 2001/11/30 22:51:17
+ Log: More Socket constants.
+ Branch: perl
+ ! ext/Socket/Makefile.PL ext/Socket/Socket.pm
+____________________________________________________________________________
+[ 13393] By: jhi on 2001/11/30 22:00:04
+ Log: (replaced by #13395)
+ Branch: perl
+ ! hints/unicosmk.sh
+____________________________________________________________________________
+[ 13392] By: jhi on 2001/11/30 20:26:22
+ Log: Subject: Re: -P and Incredible Disappearing $Config{cppstdin} (was Re: perl@13385)
+ From: Andy Dougherty <doughera@lafayette.edu>
+ Date: Fri, 30 Nov 2001 13:49:48 -0500 (EST)
+ Message-ID: <Pine.SOL.4.10.10111301304220.13302-100000@maxwell.phys.lafayette.edu>
+
+ Simplify the test skippage criterion now that we are
+ no more dependent on sed.
+ Branch: perl
+ ! t/comp/cpp.t t/run/switchPx.t
+____________________________________________________________________________
+[ 13391] By: jhi on 2001/11/30 20:19:37
+ Log: Subject: Re: [ID 20011130.164] Not OK: perl v5.7.2 +DEVEL13363 on i686-linux-2.4.8-26mdk
+ From: Michael G Schwern <schwern@pobox.com>
+ Date: Fri, 30 Nov 2001 11:48:44 -0500
+ Message-ID: <20011130114844.C1303@blackrider>
+
+ (replaces #13381)
+ Branch: perl
+ ! t/op/stat.t
+____________________________________________________________________________
+[ 13390] By: jhi on 2001/11/30 18:12:54
+ Log: Let's not assume how much memory has been allocated
+ to PVs.
+ Branch: perl
+ ! ext/Devel/Peek/Peek.t
+____________________________________________________________________________
+[ 13389] By: jhi on 2001/11/30 17:38:37
+ Log: VOS needs to know the modules, including pp_sort.
+ Branch: perl
+ ! vos/perl.bind
+____________________________________________________________________________
+[ 13388] By: jhi on 2001/11/30 15:18:51
+ Log: Unused variables.
+ Branch: perl
+ ! ext/Unicode/Normalize/Normalize.xs
+____________________________________________________________________________
+[ 13387] By: jhi on 2001/11/30 14:57:19
+ Log: Subject: [PATCH] Cygwin failures with lib/ExtUtils/Embed.t
+ From: John Peacock <jpeacock@rowman.com>
+ Date: Fri, 30 Nov 2001 10:24:00 -0500
+ Message-ID: <3C07A490.A22A76B0@rowman.com>
+ Branch: perl
+ ! lib/ExtUtils/Embed.t
+____________________________________________________________________________
+[ 13386] By: jhi on 2001/11/30 14:55:02
+ Log: Tweak for the VOS building script from Paul Green.
+ Branch: perl
+ ! vos/configure_perl.cm
+____________________________________________________________________________
+[ 13385] By: jhi on 2001/11/30 14:11:18
+ Log: Update Changes.
+ Branch: perl
+ ! Changes patchlevel.h
+____________________________________________________________________________
[ 13384] By: jhi on 2001/11/30 14:00:55
Log: Cannot test if cppstdin has not yet been installed.
Branch: perl
diff --git a/MANIFEST b/MANIFEST
index e3bfc125c7..64e87cf847 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -32,6 +32,7 @@ deb.c Debugging routines
djgpp/config.over DOS/DJGPP port
djgpp/configure.bat DOS/DJGPP port
djgpp/djgpp.c DOS/DJGPP port
+djgpp/djgpp.h DOS/DJGPP port
djgpp/djgppsed.sh DOS/DJGPP port
djgpp/fixpmain DOS/DJGPP port
doio.c I/O operations
@@ -139,17 +140,16 @@ ext/Devel/Peek/Makefile.PL Data debugging tool, makefile writer
ext/Devel/Peek/Peek.pm Data debugging tool, module and pod
ext/Devel/Peek/Peek.t See if Devel::Peek works
ext/Devel/Peek/Peek.xs Data debugging tool, externals
-ext/Devel/PPPort/harness/Harness.pm Devel::PPPort test harness
-ext/Devel/PPPort/harness/Harness.xs Devel::PPPort test harness
-ext/Devel/PPPort/harness/Makefile.PL Devel::PPPort::harness makefile writer
-ext/Devel/PPPort/harness/module2.c Devel::PPPort test file
-ext/Devel/PPPort/harness/module3.c Devel::PPPort test file
-ext/Devel/PPPort/harness/t/test.t See if Devel::PPPort works
-ext/Devel/PPPort/MANIFEST Devel::PPPort Manifest
+ext/Devel/PPPort/Changes Devel::PPPort changes
ext/Devel/PPPort/Makefile.PL Devel::PPPort makefile writer
+ext/Devel/PPPort/MANIFEST Devel::PPPort Manifest
+ext/Devel/PPPort/module2.c Devel::PPPort test file
+ext/Devel/PPPort/module3.c Devel::PPPort test file
ext/Devel/PPPort/PPPort.pm Devel::PPPort
+ext/Devel/PPPort/PPPort.xs Devel::PPPort
ext/Devel/PPPort/README Devel::PPPort Readme
ext/Devel/PPPort/soak Test Harness to run Devel::PPPort other Perls
+ext/Devel/PPPort/t/test.t See if Devel::PPPort works
ext/Devel/PPPort/TODO Devel::PPPort Todo
ext/Digest/MD5/Changes Digest::MD5 extension changes
ext/Digest/MD5/hints/irix_6.pl Hints for named architecture
@@ -719,6 +719,7 @@ hints/solaris_2.sh Hints for named architecture
hints/stellar.sh Hints for named architecture
hints/sunos_4_0.sh Hints for named architecture
hints/sunos_4_1.sh Hints for named architecture
+hints/super-ux.sh Hints for named architecture
hints/svr4.sh Hints for named architecture
hints/svr5.sh Hints for named architecture
hints/ti1500.sh Hints for named architecture
@@ -964,12 +965,13 @@ lib/File/Find/t/taint.t See if File::Find works with taint
lib/File/Path.pm Do things like `mkdir -p' and `rm -r'
lib/File/Path.t See if File::Path works
lib/File/Spec.pm portable operations on file names
-lib/File/Spec.t See if File::Spec works
lib/File/Spec/Epoc.pm portable operations on EPOC file names
lib/File/Spec/Functions.pm Function interface to File::Spec object methods
-lib/File/Spec/Functions.t See if File::Spec::Functions works
lib/File/Spec/Mac.pm portable operations on Mac file names
lib/File/Spec/OS2.pm portable operations on OS2 file names
+lib/File/Spec/t/Functions.t See if File::Spec::Functions works
+lib/File/Spec/t/rel2abs2rel.t See if File::Spec->rel2abs/abs2rel works
+lib/File/Spec/t/Spec.t See if File::Spec works
lib/File/Spec/Unix.pm portable operations on Unix file names
lib/File/Spec/VMS.pm portable operations on VMS file names
lib/File/Spec/Win32.pm portable operations on Win32 file names
@@ -1055,6 +1057,7 @@ lib/look.pl A "look" equivalent
lib/Math/BigFloat.pm An arbitrary precision floating-point arithmetic package
lib/Math/BigInt.pm An arbitrary precision integer arithmetic package
lib/Math/BigInt/Calc.pm Pure Perl module to support Math::BigInt
+lib/Math/BigInt/t/bare_mbi.t Test Math::BigInt::CareCalc
lib/Math/BigInt/t/bigfltpm.inc Shared tests for bigfltpm.t and sub_mbf.t
lib/Math/BigInt/t/bigfltpm.t See if BigFloat.pm works
lib/Math/BigInt/t/bigintc.t See if BigInt/Calc.pm works
@@ -1850,6 +1853,7 @@ pod/Makefile.SH generate Makefile whichs makes pods into something else
pod/perl.pod Top level perl documentation
pod/perl5004delta.pod Changes from 5.003 to 5.004
pod/perl5005delta.pod Changes from 5.004 to 5.005
+pod/perl561delta.pod Changes from 5.6.0 to 5.6.1
pod/perl56delta.pod Changes from 5.005 to 5.6
pod/perl570delta.pod Changes from 5.6 to 5.7.0
pod/perl571delta.pod Changes from 5.7.0 to 5.7.1
@@ -2093,6 +2097,7 @@ t/lib/h2ph.pht Generated output from h2ph.h by h2ph, for comparison
t/lib/locale/latin1 Part of locale.t in Latin 1
t/lib/locale/utf8 Part of locale.t in UTF8
t/lib/Math/BigFloat/Subclass.pm Empty subclass of BigFloat for test
+t/lib/Math/BigInt/BareCalc.pm Bigint's simulation of Calc
t/lib/Math/BigInt/Subclass.pm Empty subclass of BigInt for test
t/lib/sample-tests/bailout Test data for Test::Harness
t/lib/sample-tests/combined Test data for Test::Harness
diff --git a/NetWare/Makefile b/NetWare/Makefile
index 921a0171da..d71cd47155 100644
--- a/NetWare/Makefile
+++ b/NetWare/Makefile
@@ -1443,7 +1443,7 @@ distclean: clean nwclean
-del /f $(LIBDIR)\.exists $(LIBDIR)\attrs.pm $(LIBDIR)\DynaLoader.pm
-del /f $(LIBDIR)\XSLoader.pm
-del /f $(LIBDIR)\Fcntl.pm $(LIBDIR)\IO.pm $(LIBDIR)\Opcode.pm
- -del /f $(LIBDIR)\ops.pm $(LIBDIR)\Safe.pm $(LIBDIR)\Thread.pm
+ -del /f $(LIBDIR)\ops.pm $(LIBDIR)\Safe.pm
-del /f $(LIBDIR)\SDBM_File.pm $(LIBDIR)\Socket.pm $(LIBDIR)\POSIX.pm
-del /f $(LIBDIR)\B.pm $(LIBDIR)\O.pm $(LIBDIR)\re.pm
-del /f $(LIBDIR)\Data\Dumper.pm $(LIBDIR)\ByteLoader.pm
diff --git a/README.vms b/README.vms
index 6be5385bb6..8d20758af4 100644
--- a/README.vms
+++ b/README.vms
@@ -178,8 +178,6 @@ troublesome logicals and symbols are:
T "LOGICAL"
FOO "LOGICAL"
EXT "LOGICAL"
- SOME_LOGICAL_NAME_NOT_LIKELY "LOGICAL"
- DOWN_LOGICAL_NAME_NOT_LIKELY "LOGICAL"
TEST "SYMBOL"
As a handy shortcut, the command:
diff --git a/configure.com b/configure.com
index d8833d33c1..98e586756a 100644
--- a/configure.com
+++ b/configure.com
@@ -6065,8 +6065,6 @@ $ CALL Bad_environment "LIB"
$ CALL Bad_environment "T"
$ CALL Bad_environment "FOO"
$ CALL Bad_environment "EXT"
-$ CALL Bad_environment "SOME_LOGICAL_NAME_NOT_LIKELY"
-$ CALL Bad_environment "DOWN_LOGICAL_NAME_NOT_LIKELY"
$ CALL Bad_environment "TEST" "SYMBOL"
$ IF f$search("config.msg") .eqs. "" THEN echo "OK."
$!
@@ -6169,9 +6167,11 @@ $ WRITE CONFIG "$ dprofpp == ""'"+"'Perl' ''vms_prefix':[utils]dprofpp.c
$ ENDIF
$ WRITE CONFIG "$ h2ph == ""'"+"'Perl' ''vms_prefix':[utils]h2ph.com"""
$ WRITE CONFIG "$ h2xs == ""'"+"'Perl' ''vms_prefix':[utils]h2xs.com"""
+$ WRITE CONFIG "$ libnetcfg == ""'"+"'Perl' ''vms_prefix':[utils]libnetcfg.com"""
$ WRITE CONFIG "$!perlcc == ""'"+"'Perl' ''vms_prefix':[utils]perlcc.com"""
$ WRITE CONFIG "$ perlivp == ""'"+"'Perl' ''vms_prefix':[utils]perlivp.com"""
$ WRITE CONFIG "$ splain == ""'"+"'Perl' ''vms_prefix':[utils]splain.com"""
+$ WRITE CONFIG "$ xsubpp == ""'"+"'Perl' ''vms_prefix':[utils]xsubpp.com"""
$ ELSE
$ WRITE CONFIG "$ Perldoc == ""Perl ''vms_prefix':[lib.pod]Perldoc.com -t"""
$ WRITE CONFIG "$ pod2text == ""Perl pod2text"""
@@ -6186,9 +6186,11 @@ $ WRITE CONFIG "$ dprofpp == ""Perl ''vms_prefix':[utils]dprofpp.com"""
$ ENDIF
$ WRITE CONFIG "$ h2ph == ""Perl ''vms_prefix':[utils]h2ph.com"""
$ WRITE CONFIG "$ h2xs == ""Perl ''vms_prefix':[utils]h2xs.com"""
+$ WRITE CONFIG "$ libnetcfg == ""Perl ''vms_prefix':[utils]libnetcfg.com"""
$ WRITE CONFIG "$!perlcc == ""Perl ''vms_prefix':[utils]perlcc.com"""
$ WRITE CONFIG "$ perlivp == ""Perl ''vms_prefix':[utils]perlivp.com"""
$ WRITE CONFIG "$ splain == ""Perl ''vms_prefix':[utils]splain.com"""
+$ WRITE CONFIG "$ xsubpp == ""Perl ''vms_prefix':[utils]xsubpp.com"""
$ ENDIF
$ CLOSE CONFIG
$!
diff --git a/djgpp/config.over b/djgpp/config.over
index 55eef9b9d5..8d6bb3e89b 100644
--- a/djgpp/config.over
+++ b/djgpp/config.over
@@ -46,7 +46,7 @@ repair()
-e 's=cwd=Cwd=' \
-e 's=perlio/via=PerlIO/Via=' \
-e 's=xs/typemap=XS/Typemap=' \
- -e 's=unicode/normalize=Unicode/Normalize=' \
+ -e 's=unicode/normalize?=Unicode/Normalize=' \
-e 's=i18n/langinfo=I18N/Langinfo='
}
static_ext=$(repair "$static_ext")
diff --git a/djgpp/configure.bat b/djgpp/configure.bat
index e7d41d7130..4d73cd1dfe 100644
--- a/djgpp/configure.bat
+++ b/djgpp/configure.bat
@@ -27,7 +27,7 @@ goto end
:shell_ok
sh -c 'if test ! -d /tmp; then mkdir /tmp; fi'
-cp djgpp.c config.over ..
+cp djgpp.[hc] config.over ..
cd ..
echo Running sed...
sh djgpp/djgppsed.sh
diff --git a/djgpp/djgpp.c b/djgpp/djgpp.c
index 73573c37ea..0e465b0f82 100644
--- a/djgpp/djgpp.c
+++ b/djgpp/djgpp.c
@@ -1,20 +1,5 @@
#define PERLIO_NOT_STDIO 0
-#include <libc/stubs.h>
-#include <io.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <libc/file.h>
-#include <process.h>
-#include <fcntl.h>
-#include <glob.h>
-#include <sys/fsext.h>
-#include <crt0.h>
-#include "EXTERN.h"
-#include "perl.h"
-#include "XSUB.h"
+#include "djgpp.h"
/* hold file pointer, command, mode, and the status of the command */
struct pipe_list {
@@ -400,7 +385,8 @@ static char *perlprefix;
#define PERL5 "/perl5"
-char *djgpp_pathexp (const char *p)
+char *
+djgpp_pathexp (const char *p)
{
static char expp[PATH_MAX];
strcpy (expp,perlprefix);
diff --git a/djgpp/djgpp.h b/djgpp/djgpp.h
new file mode 100644
index 0000000000..a020ae91a1
--- /dev/null
+++ b/djgpp/djgpp.h
@@ -0,0 +1,55 @@
+#ifndef PERL_DJGPP_DJGPP_H
+#define PERL_DJGPP_DJGPP_H
+
+#include <libc/stubs.h>
+#include <io.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <libc/file.h>
+#include <process.h>
+#include <fcntl.h>
+#include <glob.h>
+#include <sys/fsext.h>
+#include <crt0.h>
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+FILE *
+djgpp_popen (const char *cm, const char *md);
+
+int
+djgpp_pclose (FILE *pp);
+
+int
+do_aspawn (pTHX_ SV *really,SV **mark,SV **sp);
+
+int
+do_spawn2 (pTHX_ char *cmd,int execf);
+
+int
+do_spawn (pTHX_ char *cmd);
+
+bool
+Perl_do_exec (pTHX_ char *cmd);
+
+void
+Perl_init_os_extras(pTHX);
+
+char
+*djgpp_pathexp (const char *p);
+
+void
+Perl_DJGPP_init (int *argcp,char ***argvp);
+
+int
+djgpp_fflush (FILE *fp);
+
+/* DJGPP utility functions without prototypes? */
+
+int _is_unixy_shell(char *s);
+
+#endif
diff --git a/djgpp/djgppsed.sh b/djgpp/djgppsed.sh
index bb35eb0720..fb140a3beb 100644
--- a/djgpp/djgppsed.sh
+++ b/djgpp/djgppsed.sh
@@ -17,7 +17,7 @@ SCOR='s=c\\\.c|=c\_c|=g'
SHSED='s=\.\(hsed\)=_\1=g'
SDEPTMP='s=\.\(deptmp\)=_\1=g'
SCPP='s=\.\(cpp\.\)=_\1=g'
-SARGV='s=\.\(argv\)\.=_\1_=g'
+SARGV='s=Io_argv\(.\)\.=i\1_=g'
SABC='s=\.\([abc][^a]\)=_\1=g'
SDBMX='s=\.\(dbmx\)=_\1=g'
SDBHASH='s=dbhash\.tmp=dbhash_tmp=g'
diff --git a/doio.c b/doio.c
index 27582d95e2..abf9ae5a17 100644
--- a/doio.c
+++ b/doio.c
@@ -691,11 +691,11 @@ Perl_nextargv(pTHX_ register GV *gv)
sv_catpv(sv,PL_inplace);
}
#ifndef FLEXFILENAMES
- if (PerlLIO_stat(SvPVX(sv),&PL_statbuf) >= 0
- && PL_statbuf.st_dev == filedev
- && PL_statbuf.st_ino == fileino
+ if ((PerlLIO_stat(SvPVX(sv),&PL_statbuf) >= 0
+ && PL_statbuf.st_dev == filedev
+ && PL_statbuf.st_ino == fileino)
#ifdef DJGPP
- || (_djstat_fail_bits & _STFAIL_TRUENAME)!=0
+ || ((_djstat_fail_bits & _STFAIL_TRUENAME)!=0)
#endif
)
{
diff --git a/doop.c b/doop.c
index 8600b7c93e..bc772018bb 100644
--- a/doop.c
+++ b/doop.c
@@ -599,9 +599,12 @@ Perl_do_trans(pTHX_ SV *sv)
I32 hasutf = (PL_op->op_private &
(OPpTRANS_FROM_UTF|OPpTRANS_TO_UTF));
- if (SvREADONLY(sv) && !(PL_op->op_private & OPpTRANS_IDENTICAL))
- Perl_croak(aTHX_ PL_no_modify);
-
+ if (SvREADONLY(sv)) {
+ if (SvFAKE(sv))
+ sv_force_normal(sv);
+ if (SvREADONLY(sv) && !(PL_op->op_private & OPpTRANS_IDENTICAL))
+ Perl_croak(aTHX_ PL_no_modify);
+ }
(void)SvPV(sv, len);
if (!len)
return 0;
diff --git a/embed.h b/embed.h
index ca01a8d900..3a82bc7e19 100644
--- a/embed.h
+++ b/embed.h
@@ -629,7 +629,6 @@
#define setenv_getix Perl_setenv_getix
#endif
#define setdefout Perl_setdefout
-#define sharepvn Perl_sharepvn
#define share_hek Perl_share_hek
#define sighandler Perl_sighandler
#define stack_grow Perl_stack_grow
@@ -2147,7 +2146,6 @@
#define setenv_getix(a) Perl_setenv_getix(aTHX_ a)
#endif
#define setdefout(a) Perl_setdefout(aTHX_ a)
-#define sharepvn(a,b,c) Perl_sharepvn(aTHX_ a,b,c)
#define share_hek(a,b,c) Perl_share_hek(aTHX_ a,b,c)
#define sighandler Perl_sighandler
#define stack_grow(a,b,c) Perl_stack_grow(aTHX_ a,b,c)
diff --git a/embed.pl b/embed.pl
index 5e9a8b2fa3..629772a0cd 100755
--- a/embed.pl
+++ b/embed.pl
@@ -1714,7 +1714,6 @@ Ap |char* |screaminstr |SV* bigsv|SV* littlesv|I32 start_shift \
p |I32 |setenv_getix |char* nam
#endif
p |void |setdefout |GV* gv
-Ap |char* |sharepvn |const char* sv|I32 len|U32 hash
p |HEK* |share_hek |const char* sv|I32 len|U32 hash
np |Signal_t |sighandler |int sig
Ap |SV** |stack_grow |SV** sp|SV**p|int n
diff --git a/ext/Devel/PPPort/Changes b/ext/Devel/PPPort/Changes
new file mode 100755
index 0000000000..d29cc71d41
--- /dev/null
+++ b/ext/Devel/PPPort/Changes
@@ -0,0 +1,18 @@
+
+2.002 - 2nd December 2001
+
+ * More portability issues in Makefile.PL addresed.
+ * Merged the Harness sub-module into Devel::PPPort
+ * More documentation in PPPort.pm
+
+2.001
+
+ * Some portability issues in Makefile.PL addresed.
+
+2.000
+
+ * Initial port to the perl core.
+
+1.007
+
+ * Original version of the module by Kenneth Albanowski.
diff --git a/ext/Devel/PPPort/MANIFEST b/ext/Devel/PPPort/MANIFEST
index df9710ccda..ce524bc5ad 100644
--- a/ext/Devel/PPPort/MANIFEST
+++ b/ext/Devel/PPPort/MANIFEST
@@ -1,12 +1,11 @@
-PPPort.pm
+Changes
MANIFEST
Makefile.PL
+PPPort.pm
+PPPort.xs
README
-soak
TODO
-harness/Harness.pm
-harness/Harness.xs
-harness/module2.c
-harness/module3.c
-harness/Makefile.PL
-harness/t/test.t
+module2.c
+module3.c
+soak
+t/test.t
diff --git a/ext/Devel/PPPort/Makefile.PL b/ext/Devel/PPPort/Makefile.PL
index f67a1f0c2a..cd1217e253 100644
--- a/ext/Devel/PPPort/Makefile.PL
+++ b/ext/Devel/PPPort/Makefile.PL
@@ -2,11 +2,30 @@
use ExtUtils::MakeMaker;
WriteMakefile(
- NAME => "Devel::PPPort",
- DISTNAME => "Devel-PPPort",
- VERSION_FROM => 'PPPort.pm',
-
- #PM => {'PPPort.pm' => '$(INST_LIBDIR)/PPPort.pm'},
- XSPROTOARG => '-noprototypes',
- 'dist' => { COMPRESS=>"gzip", SUFFIX=>"gz" }
+ NAME => "Devel::PPPort",
+ DISTNAME => "Devel-PPPort",
+ VERSION_FROM=> 'PPPort.pm',
+
+ #PM => {'PPPort.pm' => '$(INST_LIBDIR)/PPPort.pm'},
+ OBJECT => 'PPPort$(OBJ_EXT) module2$(OBJ_EXT) module3$(OBJ_EXT)',
+ XSPROTOARG => '-noprototypes',
+ 'dist' => { COMPRESS=>"gzip", SUFFIX=>"gz" },
+ 'clean' => { FILES => 'ppport.h'},
);
+
+sub MY::postamble {
+
+ my $pmfile = 'PPPort.pm' ;
+
+ my $retval = <<"EOM";
+
+ppport.h: $pmfile
+ \$(PERL) "-I\$(PERL_ARCHLIB)" "-I\$(PERL_LIB)" -e "require qq{$pmfile}; package Devel::PPPort ; sub bootstrap {} ; WriteFile(qq{ppport.h})"
+
+PPPort.xs module2.c module3.c : ppport.h
+ \$(TOUCH) \$@
+
+EOM
+
+ return $retval;
+}
diff --git a/ext/Devel/PPPort/PPPort.pm b/ext/Devel/PPPort/PPPort.pm
index 5bcabdd177..eef2512fb1 100644
--- a/ext/Devel/PPPort/PPPort.pm
+++ b/ext/Devel/PPPort/PPPort.pm
@@ -12,12 +12,36 @@ Perl/Pollution/Portability
=head1 DESCRIPTION
-This modules contains a single function, called C<WriteFile>. It is
-used to write a 'C' header file that is used when writing XS modules. The
-file contains a series of macros that allow XS modules to be built using
-older versions of Perl.
-
-This module is primarily used by h2xs to write the file F<ppport.h>.
+Perl has changed over time, gaining new features, new functions,
+increasing its flexibility, and reducing the impact on the C namespace
+environment (reduced pollution). The header file, typicaly C<ppport.h>,
+written by this module attempts to bring some of the newer Perl
+features to older versions of Perl, so that you can worry less about
+keeping track of old releases, but users can still reap the benefit.
+
+Why you should use C<ppport.h> in modern code: so that your code will work
+with the widest range of Perl interpreters possible, without significant
+additional work.
+
+Why you should attempt older code to fully use C<ppport.h>: because
+the reduced pollution of newer Perl versions is an important thing, so
+important that the old polluting ways of original Perl modules will not be
+supported very far into the future, and your module will almost certainly
+break! By adapting to it now, you'll gained compatibility and a sense of
+having done the electronic ecology some good.
+
+How to use ppport.h: Don't direct the user to download C<Devel::PPPort>,
+and don't make C<ppport.h> optional. Rather, just take the most recent
+copy of C<ppport.h> that you can find (probably in C<Devel::PPPort>
+on CPAN), copy it into your project, adjust your project to use it,
+and distribute the header along with your module.
+
+C<Devel::PPPort> contains a single function, called C<WriteFile>. It's
+purpose is to write a 'C' header file that is used when writing XS
+modules. The file contains a series of macros that allow XS modules to
+be built using older versions of Perl.
+
+This module is used by h2xs to write the file F<ppport.h>.
=head2 WriteFile
@@ -28,6 +52,61 @@ parameters, it defults to the filename C<./pport.h>.
The function returns TRUE if the file was written successfully. Otherwise
it returns FALSE.
+=head1 ppport.h
+
+The file written by this module, typically C<ppport.h>, provides access
+to the following Perl API if not already available:
+
+ DEFSV
+ ERRSV
+ INT2PTR(any,d)
+ MY_CXT
+ MY_CXT_INIT
+ NOOP
+ PERL_REVISION
+ PERL_SUBVERSION
+ PERL_UNUSED_DECL
+ PERL_VERSION
+ PL_Sv
+ PL_compiling
+ PL_copline
+ PL_curcop
+ PL_curstash
+ PL_defgv
+ PL_dirty
+ PL_hints
+ PL_na
+ PL_perldb
+ PL_rsfp_filters
+ PL_rsfpv
+ PL_stdingv
+ PL_sv_no
+ PL_sv_undef
+ PL_sv_yes
+ PTR2IV(d)
+ SAVE_DEFSV
+ START_MY_CXT
+ _aMY_CXT
+ _pMY_CXT
+ aMY_CXT
+ aMY_CXT_
+ aTHX
+ aTHX_
+ boolSV(b)
+ dMY_CXT
+ dMY_CXT_SV
+ dNOOP
+ dTHR
+ gv_stashpvn(str,len,flags)
+ newCONSTSUB(stash,name,sv)
+ newRV_inc(sv)
+ newRV_noinc(sv)
+ newSVpvn(data,len)
+ pMY_CXT
+ pMY_CXT_
+ pTHX
+ pTHX_
+
=head1 AUTHOR
Version 1.x of Devel::PPPort was written by Kenneth Albanowski.
@@ -40,11 +119,25 @@ See L<h2xs>.
=cut
+
+package Devel::PPPort;
+
+require Exporter;
+require DynaLoader;
#use warnings;
use strict;
-use vars qw( $VERSION $data );
+use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK $data );
+
+$VERSION = "2.0002";
+
+@ISA = qw(Exporter DynaLoader);
+@EXPORT = qw();
+# Other items we are prepared to export if requested
+@EXPORT_OK = qw( );
-$VERSION = "2.0001";
+bootstrap Devel::PPPort;
+
+package Devel::PPPort;
{
local $/ = undef;
@@ -70,64 +163,84 @@ sub WriteFile
1;
__DATA__;
-/* Perl/Pollution/Portability Version __VERSION__ */
-
-/* Automatically Created by __PKG__ on __DATE__ */
-
-/* Do NOT edit this file directly! -- edit PPPort.pm instead. */
-
-
-#ifndef _P_P_PORTABILITY_H_
-#define _P_P_PORTABILITY_H_
-
-/* Copyright (C) 1999, Kenneth Albanowski. This code may be used and
- distributed under the same license as any version of Perl. */
-
-/* For the latest version of this code, please retreive the Devel::PPPort
- module from CPAN, contact the author at <kjahds@kjahds.com>, or check
- with the Perl maintainers. */
-
-/* If you needed to customize this file for your project, please mention
- your changes, and visible alter the version number. */
+/* ppport.h -- Perl/Pollution/Portability Version __VERSION__
+ *
+ * Automatically Created by __PKG__ on __DATE__
+ *
+ * Do NOT edit this file directly! -- Edit PPPort.pm instead.
+ *
+ * Version 2.x, Copyright (C) 2001, Paul Marquess.
+ * Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
+ * This code may be used and distributed under the same license as any
+ * version of Perl.
+ *
+ * This version of ppport.h is designed to support operation with Perl
+ * installations back to 5.004, and has been tested up to 5.8.0.
+ *
+ * If this version of ppport.h is failing during the compilation of this
+ * module, please check if a newer version of Devel::PPPort is available
+ * on CPAN before sending a bug report.
+ *
+ * If you are using the latest version of Devel::PPPort and it is failing
+ * during compilation of this module, please send a report to perlbug@perl.com
+ *
+ * Include all following information:
+ *
+ * 1. The complete output from running "perl -V"
+ *
+ * 2. This file.
+ *
+ * 3. The name & version of the module you were trying to build.
+ *
+ * 4. A full log of the build that failed.
+ *
+ * 5. Any other information that you think could be relevant.
+ *
+ *
+ * For the latest version of this code, please retreive the Devel::PPPort
+ * module from CPAN.
+ *
+ */
/*
- In order for a Perl extension module to be as portable as possible
- across differing versions of Perl itself, certain steps need to be taken.
- Including this header is the first major one, then using dTHR is all the
- appropriate places and using a PL_ prefix to refer to global Perl
- variables is the second.
-*/
+ * In order for a Perl extension module to be as portable as possible
+ * across differing versions of Perl itself, certain steps need to be taken.
+ * Including this header is the first major one, then using dTHR is all the
+ * appropriate places and using a PL_ prefix to refer to global Perl
+ * variables is the second.
+ *
+ */
/* If you use one of a few functions that were not present in earlier
- versions of Perl, please add a define before the inclusion of ppport.h
- for a static include, or use the GLOBAL request in a single module to
- produce a global definition that can be referenced from the other
- modules.
-
- Function: Static define: Extern define:
- newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL
-
-*/
+ * versions of Perl, please add a define before the inclusion of ppport.h
+ * for a static include, or use the GLOBAL request in a single module to
+ * produce a global definition that can be referenced from the other
+ * modules.
+ *
+ * Function: Static define: Extern define:
+ * newCONSTSUB() NEED_newCONSTSUB NEED_newCONSTSUB_GLOBAL
+ *
+ */
/* To verify whether ppport.h is needed for your module, and whether any
- special defines should be used, ppport.h can be run through Perl to check
- your source code. Simply say:
-
- perl -x ppport.h *.c *.h *.xs foo/*.c [etc]
-
- The result will be a list of patches suggesting changes that should at
- least be acceptable, if not necessarily the most efficient solution, or a
- fix for all possible problems. It won't catch where dTHR is needed, and
- doesn't attempt to account for global macro or function definitions,
- nested includes, typemaps, etc.
-
- In order to test for the need of dTHR, please try your module under a
- recent version of Perl that has threading compiled-in.
-
-*/
+ * special defines should be used, ppport.h can be run through Perl to check
+ * your source code. Simply say:
+ *
+ * perl -x ppport.h *.c *.h *.xs foo/*.c [etc]
+ *
+ * The result will be a list of patches suggesting changes that should at
+ * least be acceptable, if not necessarily the most efficient solution, or a
+ * fix for all possible problems. It won't catch where dTHR is needed, and
+ * doesn't attempt to account for global macro or function definitions,
+ * nested includes, typemaps, etc.
+ *
+ * In order to test for the need of dTHR, please try your module under a
+ * recent version of Perl that has threading compiled-in.
+ *
+ */
/*
@@ -217,6 +330,9 @@ foreach $filename (map(glob($_),@ARGV)) {
__DATA__
*/
+#ifndef _P_P_PORTABILITY_H_
+#define _P_P_PORTABILITY_H_
+
#ifndef PERL_REVISION
# ifndef __PATCHLEVEL_H_INCLUDED__
# include "patchlevel.h"
@@ -233,6 +349,13 @@ __DATA__
#define PERL_BCDVERSION ((PERL_REVISION * 0x1000000L) + (PERL_VERSION * 0x1000L) + PERL_SUBVERSION)
+/* It is very unlikely that anyone will try to use this with Perl 6
+ (or greater), but who knows.
+ */
+#if PERL_REVISION != 5
+# error ppport.h only works with Perl version 5
+#endif /* PERL_REVISION != 5 */
+
#ifndef ERRSV
# define ERRSV perl_get_sv("@",FALSE)
#endif
@@ -388,6 +511,19 @@ SV *sv;
#endif /* newCONSTSUB */
+#ifndef NOOP
+# define NOOP (void)0
+#endif
+
+#ifdef HASATTRIBUTE
+# define PERL_UNUSED_DECL __attribute__((unused))
+#else
+# define PERL_UNUSED_DECL
+#endif
+
+#ifndef dNOOP
+# define dNOOP extern int Perl___notused PERL_UNUSED_DECL
+#endif
#ifndef START_MY_CXT
@@ -418,8 +554,7 @@ SV *sv;
* case below uses it to declare the data as static. */
#define START_MY_CXT
-#if PERL_REVISION == 5 && \
- (PERL_VERSION < 4 || (PERL_VERSION == 4 && PERL_SUBVERSION < 68 ))
+#if (PERL_VERSION < 4 || (PERL_VERSION == 4 && PERL_SUBVERSION < 68 ))
/* Fetches the SV that keeps the per-interpreter data. */
#define dMY_CXT_SV \
SV *my_cxt_sv = perl_get_sv(MY_CXT_KEY, FALSE)
@@ -460,19 +595,6 @@ SV *sv;
#else /* single interpreter */
-#ifndef NOOP
-# define NOOP (void)0
-#endif
-
-#ifdef HASATTRIBUTE
-# define PERL_UNUSED_DECL __attribute__((unused))
-#else
-# define PERL_UNUSED_DECL
-#endif
-
-#ifndef dNOOP
-# define dNOOP extern int Perl___notused PERL_UNUSED_DECL
-#endif
#define START_MY_CXT static my_cxt_t my_cxt;
#define dMY_CXT_SV dNOOP
@@ -491,5 +613,6 @@ SV *sv;
#endif /* START_MY_CXT */
-
#endif /* _P_P_PORTABILITY_H_ */
+
+/* End of File ppport.h */
diff --git a/ext/Devel/PPPort/harness/Harness.xs b/ext/Devel/PPPort/PPPort.xs
index 683475ae9b..b50dab731e 100644
--- a/ext/Devel/PPPort/harness/Harness.xs
+++ b/ext/Devel/PPPort/PPPort.xs
@@ -8,7 +8,7 @@
/* Global Data */
-#define MY_CXT_KEY "Devel::PPPort::Harness::_guts" XS_VERSION
+#define MY_CXT_KEY "Devel::PPPort::_guts" XS_VERSION
typedef struct {
/* Put Global Data in here */
@@ -19,13 +19,13 @@ START_MY_CXT
void test1(void)
{
- newCONSTSUB(gv_stashpv("Devel::PPPort::Harness", FALSE), "test_value_1", newSViv(1));
+ newCONSTSUB(gv_stashpv("Devel::PPPort", FALSE), "test_value_1", newSViv(1));
}
extern void test2(void);
extern void test3(void);
-MODULE = Devel::PPPort::Harness PACKAGE = Devel::PPPort::Harness
+MODULE = Devel::PPPort PACKAGE = Devel::PPPort
BOOT:
{
diff --git a/ext/Devel/PPPort/README b/ext/Devel/PPPort/README
index 3828773ef0..dc8cb2ff31 100644
--- a/ext/Devel/PPPort/README
+++ b/ext/Devel/PPPort/README
@@ -1,44 +1,14 @@
Perl/Pollution/Portability Version 1.0005
- Copyright (C) 1999, Kenneth Albanowski. This archive may be used and
- distributed under the same license as any version of Perl.
+ Copyright (C) 2001, Paul Marquess.
+ Copyright (C) 1999, Kenneth Albanowski.
+ This archive may be used and distributed under the same license as any
+ version of Perl.
- This is not an actual Perl module, but rather a distribution containing a
- small header file designed to aid the portability of the XS modules you
- write. The Makefile.PL is provided primarily to aid in testing the code.
- (Please notify me about any compile warnings or errors, or test failures.)
-
- Perl has changed over time, gaining new features, new functions, increasing
- its flexibility, and reducing the impact on the C namespace environment
- (reduced pollution). This header attempts to bring some of the newer Perl
- features to older versions of Perl, so that you can worry less about
- keeping track of old releases, but users can still reap the benefit.
-
- Why you should use ppport.h in modern code: so that your code will work
- with the widest range of Perl interpreters possible, without significant
- additional work.
-
- Why you should attempt older code to fully use ppport.h: because the
- reduced pollution of newer Perl versions is an important thing, so
- important that the old polluting ways of original Perl modules will not be
- supported very far into the future, and your module will almost certainly
- break! By adapting to it now, you'll gained compatibility and a sense of
- having done the electronic ecology some good.
-
+This module is used to create a 'C' header file that can be used by XS
+authors. It allows XS module authors to use the latest version of the
+Perl API, but still allow their module to be built with older versions
+of Perl.
- How to use ppport.h: Don't direct the user to download Devel::PPPort, and
- don't make ppport.h optional. Rather, just take the most recent copy of
- ppport.h that you can find (probably in Devel::PPPort on CPAN), copy it
- into your project, adjust your project to use it, and distribute the header
- along with your module.
-
- The file may be able to help you make use of itself. It's got some internal
- documentation, and even an automated script to determine how it could be
- used. However, ppport.h is a work in progress, and may not include every
- feature or macro definition. Feel free to add missing parts, just make sure
- to adjust the version mark so that its clear you've branched from the
- original version.
-
- - Kenneth Albanowski <kjahds@kjahds.com>,
- February, 1999
+For more details see PPPort.pm.
diff --git a/ext/Devel/PPPort/harness/Harness.pm b/ext/Devel/PPPort/harness/Harness.pm
deleted file mode 100644
index 365fdfecf6..0000000000
--- a/ext/Devel/PPPort/harness/Harness.pm
+++ /dev/null
@@ -1,21 +0,0 @@
-
-package Devel::PPPort::Harness;
-
-require Exporter;
-require DynaLoader;
-use Carp;
-use strict;
-use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK $data );
-
-$VERSION = "2.0000";
-
-@ISA = qw(Exporter DynaLoader);
-@EXPORT = qw();
-# Other items we are prepared to export if requested
-@EXPORT_OK = qw( );
-
-bootstrap Devel::PPPort::Harness;
-
-package Devel::PPPort::Harness;
-
-1;
diff --git a/ext/Devel/PPPort/harness/Makefile.PL b/ext/Devel/PPPort/harness/Makefile.PL
deleted file mode 100644
index 8b23eb5f00..0000000000
--- a/ext/Devel/PPPort/harness/Makefile.PL
+++ /dev/null
@@ -1,36 +0,0 @@
-
-use ExtUtils::MakeMaker;
-
-WriteMakefile(
- NAME => "Devel::PPPort::Harness",
- VERSION_FROM=> 'Harness.pm',
- XSPROTOARG => '-noprototypes',
- OBJECT => 'Harness$(OBJ_EXT) module2$(OBJ_EXT) module3$(OBJ_EXT)',
- 'dist' => { COMPRESS=>"gzip", SUFFIX=>"gz" },
- 'clean' => { FILES => 'ppport.h'},
-
-);
-
-sub MY::postamble {
-
- my $pmfile;
-
- if ($^O eq 'VMS') {
- $pmfile = '[-]PPPort.pm';
- }
- else {
- $pmfile = '../PPPort.pm';
- }
-
- my $retval = <<"EOM";
-
-ppport.h: $pmfile
- \$(PERL) "-I\$(PERL_ARCHLIB)" "-I\$(PERL_LIB)" -e "require qq{$pmfile}; Devel::PPPort::WriteFile(qq{ppport.h})"
-
-Harness.xs module2.c module3.c : ppport.h
- \$(TOUCH) \$@
-
-EOM
-
- return $retval;
-}
diff --git a/ext/Devel/PPPort/harness/t/test.t b/ext/Devel/PPPort/harness/t/test.t
deleted file mode 100644
index 315e611fdf..0000000000
--- a/ext/Devel/PPPort/harness/t/test.t
+++ /dev/null
@@ -1,99 +0,0 @@
-
-use Devel::PPPort::Harness;
-
-use strict;
-
-print "1..17\n";
-
-BEGIN {
- chdir 't' if -d 't';
- @INC = '../lib' if -d '../lib';
-
-}
-
-my $total = 0;
-my $good = 0;
-
-my $test = 0;
-sub ok {
- my ($name, $test_sub) = @_;
- my $line = (caller)[2];
- my $value;
-
- eval { $value = &{ $test_sub }() } ;
-
- ++ $test ;
-
- if ($@) {
- printf "not ok $test # Testing '$name', line $line $@\n";
- }
- elsif ($value != 1){
- printf "not ok $test # Testing '$name', line $line, value != 1 ($value)\n";
- }
- else {
- print "ok $test\n";
- }
-
-}
-
-ok "Static newCONSTSUB()",
- sub { Devel::PPPort::Harness::test1(); Devel::PPPort::Harness::test_value_1() == 1} ;
-
-ok "Global newCONSTSUB()",
- sub { Devel::PPPort::Harness::test2(); Devel::PPPort::Harness::test_value_2() == 2} ;
-
-ok "Extern newCONSTSUB()",
- sub { Devel::PPPort::Harness::test3(); Devel::PPPort::Harness::test_value_3() == 3} ;
-
-ok "newRV_inc()", sub { Devel::PPPort::Harness::test4()} ;
-
-ok "newRV_noinc()", sub { Devel::PPPort::Harness::test5()} ;
-
-ok "PL_sv_undef", sub { not defined Devel::PPPort::Harness::test6()} ;
-
-ok "PL_sv_yes", sub { Devel::PPPort::Harness::test7()} ;
-
-ok "PL_sv_no", sub { !Devel::PPPort::Harness::test8()} ;
-
-ok "PL_na", sub { Devel::PPPort::Harness::test9("abcd") == 4} ;
-
-ok "boolSV 1", sub { Devel::PPPort::Harness::test10(1) } ;
-
-ok "boolSV 0", sub { ! Devel::PPPort::Harness::test10(0) } ;
-
-ok "newSVpvn", sub { Devel::PPPort::Harness::test11("abcde", 3) eq "abc" } ;
-
-ok "DEFSV", sub { $_ = "Fred"; Devel::PPPort::Harness::test12() eq "Fred" } ;
-
-ok "ERRSV", sub { eval { 1; }; ! Devel::PPPort::Harness::test13() };
-
-ok "ERRSV", sub { eval { fred() }; Devel::PPPort::Harness::test13() };
-
-ok "CXT 1", sub { Devel::PPPort::Harness::test14()} ;
-
-ok "CXT 2", sub { Devel::PPPort::Harness::test15()} ;
-
-__END__
-# TODO
-
-PERL_VERSION
-PERL_BCDVERSION
-
-PL_stdingv
-PL_hints
-PL_curcop
-PL_curstash
-PL_copline
-PL_Sv
-PL_compiling
-PL_dirty
-
-PTR2IV
-INT2PTR
-
-dTHR
-gv_stashpvn
-NOOP
-SAVE_DEFSV
-PERL_UNUSED_DECL
-dNOOP
diff --git a/ext/Devel/PPPort/harness/module2.c b/ext/Devel/PPPort/module2.c
index c1907ba88d..b0778a78a8 100644
--- a/ext/Devel/PPPort/harness/module2.c
+++ b/ext/Devel/PPPort/module2.c
@@ -8,5 +8,5 @@
void test2(void)
{
- newCONSTSUB(gv_stashpv("Devel::PPPort::Harness", FALSE), "test_value_2", newSViv(2));
+ newCONSTSUB(gv_stashpv("Devel::PPPort", FALSE), "test_value_2", newSViv(2));
}
diff --git a/ext/Devel/PPPort/harness/module3.c b/ext/Devel/PPPort/module3.c
index ae0be83dee..bf8fad56ad 100644
--- a/ext/Devel/PPPort/harness/module3.c
+++ b/ext/Devel/PPPort/module3.c
@@ -7,5 +7,5 @@
void test3(void)
{
- newCONSTSUB(gv_stashpv("Devel::PPPort::Harness", FALSE), "test_value_3", newSViv(3));
+ newCONSTSUB(gv_stashpv("Devel::PPPort", FALSE), "test_value_3", newSViv(3));
}
diff --git a/ext/Devel/PPPort/soak b/ext/Devel/PPPort/soak
index 35afd320df..5ff5b41c9d 100644
--- a/ext/Devel/PPPort/soak
+++ b/ext/Devel/PPPort/soak
@@ -1,56 +1,41 @@
+# soak: Test Devel::PPPort with multiple versions of Perl.
+#
+# Author: Paul Marquess
+#
+
+require 5.006001;
use strict ;
+use warnings ;
use ExtUtils::MakeMaker;
+use Getopt::Long;
+
+my $VERSION = "1.000";
$| = 1 ;
my $verbose = 0 ;
-# TODO -- Get MM->new to output less MakeMaker progress guff
-my $mm = MM->new( { NAME => 'dummy' });
-
# TODO -- determine what "make" program to run.
my $MAKE = 'make';
+my $result = GetOptions(
+ "verbose" => \$verbose,
+ "make=s" => \$MAKE,
+ ) or Usage();
-# TODO -- need to decide how far back we go.
+my @GoodPerls = ();
-# find all version of Perl that are available
-my @PerlBinaries = qw(
- 5.004
- 5.00401
- 5.00402
- 5.00403
- 5.00404
- 5.00405
- 5.005
- 5.00501
- 5.00502
- 5.00503
- 5.6.0
- 5.6.1
- 5.7.0
- 5.7.1
- 5.7.2
- );
+if (@ARGV)
+ { @GoodPerls = @ARGV }
+else
+ { @GoodPerls = FindPerls() }
-print "Searching for Perl binaries...\n" ;
-my @GoodPerls = ();
my $maxlen = 0;
-my @path = $mm->path();
-foreach my $perl (@PerlBinaries) {
- # TODO -- find_perl will send a warning to STDOUT if it can't find
- # the requested perl, so need to temporarily close STDOUT.
-
- if (my $abs = $mm->find_perl($perl, ["perl$perl"], [@path], 0)) {
- push @GoodPerls, $abs ;
- $maxlen = length $abs
- if length $abs > $maxlen ;
- }
+foreach (@GoodPerls) {
+ $maxlen = length $_
+ if length $_ > $maxlen ;
}
-print "\n\nFound ";
-foreach (@GoodPerls) { print "$_\n" }
-print "\n\n";
$maxlen += 3 ;
# run each through the test harness
@@ -83,7 +68,7 @@ foreach my $perl (@GoodPerls)
}
-print "\n\nPassed with $good of $total versions of Perl.\n";
+print "\n\nPassed with $good of $total versions of Perl.\n\n";
exit $bad ;
@@ -93,17 +78,102 @@ sub runit
my $cmd = shift ;
print "\n Running [$cmd]\n" if $verbose ;
- my $file = "/tmp/abc.$$" ;
- unlink $file ;
my $output = `$cmd 2>&1` ;
+ $output = "\n" unless defined $output;
$output =~ s/^/ /gm;
- print " Output\n$output\n" if $verbose || $? ;
+ print "\n Output\n$output\n" if $verbose || $? ;
if ($?)
{
- return 0 unless $verbose ;
- warn " $cmd failed: $?\n" ;
- exit ;
+ warn " Running '$cmd' failed: $?\n" ;
+ return 0 ;
}
- unlink $file ;
return 1 ;
}
+
+sub Usage
+{
+ die <<EOM;
+
+usage: soak [OPT] [perl...]
+
+ OPT
+ -m make - the name of the make program. Default "make"
+ -v - verbose
+
+EOM
+
+}
+
+sub FindPerls
+{
+ # TODO -- need to decide how far back we go.
+ # TODO -- get list of user releases prior to 5.004
+
+ # find all version of Perl that are available
+ my @PerlBinaries = qw(
+ 5.000
+ 5.001
+ 5.002
+ 5.003
+ 5.004
+ 5.00401
+ 5.00402
+ 5.00403
+ 5.00404
+ 5.00405
+ 5.005
+ 5.00501
+ 5.00502
+ 5.00503
+ 5.6.0
+ 5.6.1
+ 5.7.0
+ 5.7.1
+ 5.7.2
+ );
+
+ print "Searching for Perl binaries...\n" ;
+ my @GoodPerls = ();
+ my $maxlen = 0;
+ my $mm = MM->new( { NAME => 'dummy' });
+ my @path = $mm->path();
+
+ # find_perl will send a warning to STDOUT if it can't find
+ # the requested perl, so need to temporarily silence STDOUT.
+ tie(*STDOUT, 'NoSTDOUT');
+
+ foreach my $perl (@PerlBinaries) {
+ if (my $abs = $mm->find_perl($perl, ["perl$perl"], [@path], 0)) {
+ push @GoodPerls, $abs ;
+ }
+ }
+ untie *STDOUT;
+
+ print "\n\nFound\n";
+ foreach (@GoodPerls) { print " $_\n" }
+ print "\n\n";
+
+ return @GoodPerls;
+}
+
+package NoSTDOUT;
+
+use Tie::Handle;
+our @ISA = qw(Tie::Handle);
+
+sub TIEHANDLE
+{
+ my ($class) = @_;
+ my $buf = "";
+ bless \$buf, $class;
+}
+
+sub PRINT
+{
+ my $self = shift;
+}
+
+sub WRITE
+{
+ my $self = shift;
+}
diff --git a/ext/Devel/PPPort/t/test.t b/ext/Devel/PPPort/t/test.t
new file mode 100644
index 0000000000..bdac50b3b7
--- /dev/null
+++ b/ext/Devel/PPPort/t/test.t
@@ -0,0 +1,99 @@
+
+use Devel::PPPort;
+
+use strict;
+
+print "1..17\n";
+
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib' if -d '../lib';
+
+}
+
+my $total = 0;
+my $good = 0;
+
+my $test = 0;
+sub ok {
+ my ($name, $test_sub) = @_;
+ my $line = (caller)[2];
+ my $value;
+
+ eval { $value = &{ $test_sub }() } ;
+
+ ++ $test ;
+
+ if ($@) {
+ printf "not ok $test # Testing '$name', line $line $@\n";
+ }
+ elsif ($value != 1){
+ printf "not ok $test # Testing '$name', line $line, value != 1 ($value)\n";
+ }
+ else {
+ print "ok $test\n";
+ }
+
+}
+
+ok "Static newCONSTSUB()",
+ sub { Devel::PPPort::test1(); Devel::PPPort::test_value_1() == 1} ;
+
+ok "Global newCONSTSUB()",
+ sub { Devel::PPPort::test2(); Devel::PPPort::test_value_2() == 2} ;
+
+ok "Extern newCONSTSUB()",
+ sub { Devel::PPPort::test3(); Devel::PPPort::test_value_3() == 3} ;
+
+ok "newRV_inc()", sub { Devel::PPPort::test4()} ;
+
+ok "newRV_noinc()", sub { Devel::PPPort::test5()} ;
+
+ok "PL_sv_undef", sub { not defined Devel::PPPort::test6()} ;
+
+ok "PL_sv_yes", sub { Devel::PPPort::test7()} ;
+
+ok "PL_sv_no", sub { !Devel::PPPort::test8()} ;
+
+ok "PL_na", sub { Devel::PPPort::test9("abcd") == 4} ;
+
+ok "boolSV 1", sub { Devel::PPPort::test10(1) } ;
+
+ok "boolSV 0", sub { ! Devel::PPPort::test10(0) } ;
+
+ok "newSVpvn", sub { Devel::PPPort::test11("abcde", 3) eq "abc" } ;
+
+ok "DEFSV", sub { $_ = "Fred"; Devel::PPPort::test12() eq "Fred" } ;
+
+ok "ERRSV", sub { eval { 1; }; ! Devel::PPPort::test13() };
+
+ok "ERRSV", sub { eval { fred() }; Devel::PPPort::test13() };
+
+ok "CXT 1", sub { Devel::PPPort::test14()} ;
+
+ok "CXT 2", sub { Devel::PPPort::test15()} ;
+
+__END__
+# TODO
+
+PERL_VERSION
+PERL_BCDVERSION
+
+PL_stdingv
+PL_hints
+PL_curcop
+PL_curstash
+PL_copline
+PL_Sv
+PL_compiling
+PL_dirty
+
+PTR2IV
+INT2PTR
+
+dTHR
+gv_stashpvn
+NOOP
+SAVE_DEFSV
+PERL_UNUSED_DECL
+dNOOP
diff --git a/ext/Encode/Encode.pm b/ext/Encode/Encode.pm
index ddde0f2df4..76257d4724 100644
--- a/ext/Encode/Encode.pm
+++ b/ext/Encode/Encode.pm
@@ -700,6 +700,11 @@ Miscellaneous:
Encodes string from Perl's internal form into I<ENCODING> and returns
a sequence of octets. For CHECK see L</"Handling Malformed Data">.
+For example to convert (internally UTF-8 encoded) Unicode data
+to octets:
+
+ $octets = encode("utf8", $unicode);
+
=item *
$string = decode(ENCODING, $bytes[, CHECK])
@@ -708,6 +713,10 @@ Decode sequence of octets assumed to be in I<ENCODING> into Perl's
internal form and returns the resulting string. For CHECK see
L</"Handling Malformed Data">.
+For example to convert ISO 8859-1 data to UTF-8:
+
+ $utf8 = decode("latin1", $latin1);
+
=item *
from_to($string, FROM_ENCODING, TO_ENCODING[, CHECK])
diff --git a/ext/I18N/Langinfo/Langinfo.t b/ext/I18N/Langinfo/Langinfo.t
index b2e97f9d8f..2f5172d11d 100644
--- a/ext/I18N/Langinfo/Langinfo.t
+++ b/ext/I18N/Langinfo/Langinfo.t
@@ -11,41 +11,43 @@ BEGIN {
exit 0;
}
}
-
-use I18N::Langinfo qw(langinfo ABDAY_1 DAY_1 ABMON_1 MON_1 RADIXCHAR);
+
+use I18N::Langinfo qw(langinfo);
use POSIX qw(setlocale LC_ALL);
-use Config;
-
-setlocale(LC_ALL, "C");
-
-print "1..5\n";
-
-print "not " unless langinfo(ABDAY_1) eq "Sun";
-print "ok 1\n";
-
-print "not " unless langinfo(DAY_1) eq "Sunday";
-print "ok 2\n";
-
-print "not " unless langinfo(ABMON_1) eq "Jan";
-print "ok 3\n";
-
-print "not " unless langinfo(MON_1) eq "January";
-print "ok 4\n";
-unless (eval { langinfo(RADIXCHAR) } eq ".") {
- print "not ok 5 - RADIXCHAR undefined\n";
- if ($Config{d_gnulibc} || $Config{cppsymbols} =~ /__GNU_LIBRARY_/) {
- print <<EOM;
-#
-# You are probably using GNU libc. The RADIXCHAR not getting defined
-# by I18N::Langinfo is a known problem in some older versions of the
-# GNU libc (caused by the combination of using only enums, not cpp
-# definitions, and of hiding the definitions behind rather obscure
-# feature tests). Upgrading your libc is strongly suggested.
-#
-EOM
+setlocale(LC_ALL, $ENV{LC_ALL} = $ENV{LANG} = "C");
+
+my %want =
+ (
+ ABDAY_1 => "Sun",
+ DAY_1 => "Sunday",
+ ABMON_1 => "Jan",
+ MON_1 => "January",
+ RADIXCHAR => ".",
+ AM_STR => qr{^(?:am|a\.m\.)$}i,
+ THOUSEP => "",
+ D_T_FMT => qr{^%a %b %[de] %H:%M:%S %Y$},
+ D_FMT => qr{^%m/%d/%y$},
+ T_FMT => qr{^%H:%M:%S$},
+ );
+
+
+my @want = sort keys %want;
+
+print "1..", scalar @want, "\n";
+
+for my $i (1..@want) {
+ my $try = $want[$i-1];
+ eval { I18N::Langinfo->import($try) };
+ unless ($@) {
+ my $got = langinfo(&$try);
+ if (ref $want{$try} && $got =~ $want{$try} || $got eq $want{$try}) {
+ print qq[ok $i - $try is "$got"\n];
+ } else {
+ print qq[not ok $i - $try is "$got" not "$want{$try}"\n];
+ }
+ } else {
+ print qq[ok $i - Skip: $try not defined\n];
}
-} else {
- print "ok 5\n";
}
diff --git a/ext/I18N/Langinfo/Langinfo.xs b/ext/I18N/Langinfo/Langinfo.xs
index d335eec71e..f1a0a1728b 100644
--- a/ext/I18N/Langinfo/Langinfo.xs
+++ b/ext/I18N/Langinfo/Langinfo.xs
@@ -19,8 +19,14 @@ langinfo(code)
int code
CODE:
#ifdef HAS_NL_LANGINFO
- char *s = nl_langinfo(code);
- RETVAL = newSVpvn(s, strlen(s));
+ {
+ char *s;
+
+ if ((s = nl_langinfo(code)))
+ RETVAL = newSVpvn(s, strlen(s));
+ else
+ RETVAL = &PL_sv_undef;
+ }
#else
croak("nl_langinfo() not implemented on this architecture");
#endif
diff --git a/ext/List/Util/Makefile.PL b/ext/List/Util/Makefile.PL
index 93f1d4fc54..eed19f9c5a 100644
--- a/ext/List/Util/Makefile.PL
+++ b/ext/List/Util/Makefile.PL
@@ -8,6 +8,15 @@ WriteMakefile(
package MY;
+# We go through the ListUtil.c trickery to foil platforms
+# that have the feature combination of
+# (1) static builds
+# (2) allowing only one object by the same name in the static library
+# (3) the object name matching being case-blind
+# This means that we can't have the top-level util.o
+# and the extension-level Util.o in the same build.
+# One such platform is the POSIX-BC BS2000 EBCDIC mainframe platform.
+
BEGIN {
use Config;
unless (defined $Config{usedl}) {
@@ -16,41 +25,19 @@ sub xs_c {
my($self) = shift;
return '' unless $self->needs_linking();
'
-.xs.c:
- $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > List$*.xsc && $(MV) List$*.xsc List$*.c
-';
-}
-
-sub c_o {
- my($self) = shift;
- return '' unless $self->needs_linking();
-'
-.c$(OBJ_EXT):
- $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) List$*.c
- $(MV) List$*$(OBJ_EXT) $*$(OBJ_EXT)
+ListUtil.c: Util.xs
+ $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) Util.xs > ListUtil.xsc && $(MV) ListUtil.xsc ListUtil.c
';
}
-sub xs_o { # many makes are too dumb to use xs_c then c_o
+sub xs_o {
my($self) = shift;
return '' unless $self->needs_linking();
'
-.xs$(OBJ_EXT):
- $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs > List$*.xsc && $(MV) List$*.xsc List$*.c
- $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) List$*.c
- $(MV) List$*$(OBJ_EXT) $*$(OBJ_EXT)
-';
-}
-
-sub top_targets { # many makes are too dumb to use xs_c then c_o
- my($self) = shift;
- my $out = $self->SUPER::top_targets(@_);
- $out .
-'
-
-ListUtil.c: Util.c
- @$(NOOP)
+Util$(OBJ_EXT): ListUtil.c
+ $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) ListUtil.c
+ $(MV) ListUtil$(OBJ_EXT) Util$(OBJ_EXT)
';
}
diff --git a/ext/Opcode/Safe.pm b/ext/Opcode/Safe.pm
index 5a5e220614..22ba03fe12 100644
--- a/ext/Opcode/Safe.pm
+++ b/ext/Opcode/Safe.pm
@@ -380,7 +380,7 @@ respectfully.
=item share (NAME, ...)
This shares the variable(s) in the argument list with the compartment.
-This is almost identical to exporting variables using the L<Exporter(3)>
+This is almost identical to exporting variables using the L<Exporter>
module.
Each NAME must be the B<name> of a variable, typically with the leading
diff --git a/ext/Time/HiRes/HiRes.xs b/ext/Time/HiRes/HiRes.xs
index e1e13e143a..4981741430 100644
--- a/ext/Time/HiRes/HiRes.xs
+++ b/ext/Time/HiRes/HiRes.xs
@@ -560,7 +560,7 @@ BOOT:
#ifdef HAS_GETTIMEOFDAY
{
UV auv[2];
- hv_store(PL_modglobal, "Time::NVtime", 12, newSViv((IV) myNVtime()), 0);
+ hv_store(PL_modglobal, "Time::NVtime", 12, newSViv(PTR2IV(myNVtime)), 0);
if (myU2time(auv) == 0)
hv_store(PL_modglobal, "Time::U2time", 12, newSViv((IV) auv[0]), 0);
}
diff --git a/global.sym b/global.sym
index 802dd25da7..b2a9225100 100644
--- a/global.sym
+++ b/global.sym
@@ -174,6 +174,7 @@ Perl_is_uni_xdigit
Perl_to_uni_upper
Perl_to_uni_title
Perl_to_uni_lower
+Perl_to_uni_fold
Perl_is_uni_alnum_lc
Perl_is_uni_alnumc_lc
Perl_is_uni_idfirst_lc
@@ -387,7 +388,6 @@ Perl_scan_hex
Perl_scan_num
Perl_scan_oct
Perl_screaminstr
-Perl_sharepvn
Perl_stack_grow
Perl_start_subparse
Perl_sv_2bool
diff --git a/hints/solaris_2.sh b/hints/solaris_2.sh
index 86a375bdc5..01a0d10c2a 100644
--- a/hints/solaris_2.sh
+++ b/hints/solaris_2.sh
@@ -519,6 +519,9 @@ cat > UU/uselongdouble.cbu <<'EOCBU'
case "$uselongdouble" in
"$define"|true|[yY]*)
if test -f /opt/SUNWspro/lib/libsunmath.so; then
+ # Unfortunately libpth has already been set and
+ # searched, so we need to add in everything manually.
+ libpth="$libpth /opt/SUNWspro/lib"
libs="$libs -lsunmath"
ldflags="$ldflags -L/opt/SUNWspro/lib -R/opt/SUNWspro/lib"
d_sqrtl=define
diff --git a/hints/super-ux.sh b/hints/super-ux.sh
new file mode 100644
index 0000000000..8f9592b893
--- /dev/null
+++ b/hints/super-ux.sh
@@ -0,0 +1,20 @@
+# Len Makin <len@hpc.CSIRO.AU>
+
+# No dynamically loaded libraries
+so='none'
+
+case "$optimize" in
+# No compile option -O
+'') optimize='-h2' ;;
+esac
+
+# size_t is 32 bits. Next version of compiler will have -hsize_t64
+# enabling size_t to be 64 bits.
+# Current cc version 4.80 allows -hsubscript64 for 64 bit array subscripts.
+ccflags="$ccflags -hxint -hmath vector -hsubscript64"
+
+case "$usemymalloc" in
+'') # The perl malloc.c SHOULD work
+ usemymalloc='y'
+ ;;
+esac
diff --git a/hv.c b/hv.c
index 11992f4572..5d7b49fb74 100644
--- a/hv.c
+++ b/hv.c
@@ -1640,12 +1640,16 @@ Perl_hv_magic(pTHX_ HV *hv, GV *gv, int how)
sv_magic((SV*)hv, (SV*)gv, how, Nullch, 0);
}
+#if 0 /* use the macro from hv.h instead */
+
char*
Perl_sharepvn(pTHX_ const char *sv, I32 len, U32 hash)
{
return HEK_KEY(share_hek(sv, len, hash));
}
+#endif
+
/* possibly free a shared string if no one has access to it
* len and hash must both be valid for str.
*/
diff --git a/hv.h b/hv.h
index 9d6be7fce9..3475c87238 100644
--- a/hv.h
+++ b/hv.h
@@ -197,3 +197,7 @@ C<SV*>.
? (size) * sizeof(HE*) \
: (size) * sizeof(HE*) * 2 - MALLOC_OVERHEAD)
#endif
+
+/* available as a function in hv.c */
+#define Perl_sharepvn(sv, len, hash) HEK_KEY(share_hek(sv, len, hash))
+#define sharepvn(sv, len, hash) Perl_sharepvn(sv, len, hash)
diff --git a/lib/AutoSplit.t b/lib/AutoSplit.t
index 8d764c1eef..e5466a46e9 100644
--- a/lib/AutoSplit.t
+++ b/lib/AutoSplit.t
@@ -7,6 +7,10 @@ my $incdir;
my $lib = '"-I../lib"'; # ok on unix, nt, The extra \" are for VMS
BEGIN {
chdir 't' if -d 't';
+ if ($^O eq 'dos') {
+ print "1..0 # This test is not 8.3-aware.\n";
+ exit 0;
+ }
if ($^O eq 'MacOS') {
$incdir = ":auto-$$";
$lib = '-x -I::lib:'; # -x overcomes MPW $Config{startperl} anomaly
diff --git a/lib/Carp.pm b/lib/Carp.pm
index cd2cfdb087..5dbae299fd 100644
--- a/lib/Carp.pm
+++ b/lib/Carp.pm
@@ -1,6 +1,6 @@
package Carp;
-our $VERSION = '1.00';
+our $VERSION = '1.01';
=head1 NAME
@@ -13,6 +13,10 @@ croak - die of errors (from perspective of caller)
confess - die of errors with stack backtrace
+shortmess - return the message that carp and croak produce
+
+longmess - return the message that cluck and confess produce
+
=head1 SYNOPSIS
use Carp;
@@ -27,16 +31,54 @@ confess - die of errors with stack backtrace
=head1 DESCRIPTION
The Carp routines are useful in your own modules because
-they act like die() or warn(), but report where the error
-was in the code they were called from. Thus if you have a
-routine Foo() that has a carp() in it, then the carp()
-will report the error as occurring where Foo() was called,
-not where carp() was called.
+they act like die() or warn(), but with a message which is more
+likely to be useful to a user of your module. In the case of
+cluck, confess, and longmess that context is a summary of every
+call in the call-stack. For a shorter message you can use carp,
+croak or shortmess which report the error as being from where
+your module was called. There is no guarantee that that is where
+the error was, but it is a good educated guess.
+
+Here is a more complete description of how shortmess works. What
+it does is search the call-stack for a function call stack where
+it hasn't been told that there shouldn't be an error. If every
+call is marked safe, it then gives up and gives a full stack
+backtrace instead. In other words it presumes that the first likely
+looking potential suspect is guilty. Its rules for telling whether
+a call shouldn't generate errors work as follows:
+
+=over 4
+
+=item 1.
+
+Any call from a package to itself is safe.
+
+=item 2.
+
+Packages claim that there won't be errors on calls to or from
+packages explicitly marked as safe by inclusion in @CARP_NOT, or
+(if that array is empty) @ISA. The ability to override what
+@ISA says is new in 5.8.
+
+=item 3.
-The routine shortmess() can be used to generate the string that
-carp/croak would have produced. The routine longmess() can be
-used to generate the backtrace that cluck/confess would have
-produced.
+The trust in item 2 is transitive. If A trusts B, and B
+trusts C, then A trusts C. So if you do not override @ISA
+with @CARP_NOT, then this trust relationship is identical to,
+"inherits from".
+
+=item 4.
+
+Any call from an internal Perl module is safe. (Nothing keeps
+user modules from marking themselves as internal to Perl, but
+this practice is discouraged.)
+
+=item 5.
+
+Any call to Carp is safe. (This rule is what keeps it from
+reporting the error where you call carp/croak/shortmess.)
+
+=back
=head2 Forcing a Stack Trace
@@ -67,19 +109,25 @@ call die() or warn(), as appropriate.
# _almost_ complete understanding of the package. Corrections and
# comments are welcome.
-# The $CarpLevel variable can be set to "strip off" extra caller levels for
-# those times when Carp calls are buried inside other functions. The
+# The members of %Internal are packages that are internal to perl.
+# Carp will not report errors from within these packages if it
+# can. The members of %CarpInternal are internal to Perl's warning
+# system. Carp will not report errors from within these packages
+# either, and will not report calls *to* these packages for carp and
+# croak. They replace $CarpLevel, which is deprecated. The
# $Max(EvalLen|(Arg(Len|Nums)) variables are used to specify how the eval
# text and function arguments should be formatted when printed.
+$CarpInternal{Carp}++;
$CarpLevel = 0; # How many extra package levels to skip on carp.
+ # How many calls to skip on confess.
+ # Reconciling these notions is hard, use
+ # %Internal and %CarpInternal instead.
$MaxEvalLen = 0; # How much eval '...text...' to show. 0 = all.
$MaxArgLen = 64; # How much of each argument to print. 0 = all.
$MaxArgNums = 8; # How many arguments to print. 0 = all.
$Verbose = 0; # If true then make shortmess call longmess instead
-$CarpInternal{Carp}++;
-
require Exporter;
@ISA = ('Exporter');
@EXPORT = qw(confess croak carp);
@@ -107,7 +155,15 @@ sub export_fail {
sub longmess {
{ local $@; require Carp::Heavy; } # XXX fix require to not clear $@?
- goto &longmess_heavy;
+ # Icky backwards compatibility wrapper. :-(
+ my $call_pack = caller();
+ if ($Internal{$call_pack} or $CarpInternal{$call_pack}) {
+ return longmess_heavy(@_);
+ }
+ else {
+ local $CarpLevel = $CarpLevel + 1;
+ return longmess_heavy(@_);
+ }
}
@@ -119,7 +175,10 @@ sub longmess {
sub shortmess { # Short-circuit &longmess if called via multiple packages
{ local $@; require Carp::Heavy; } # XXX fix require to not clear $@?
- goto &shortmess_heavy;
+ # Icky backwards compatibility wrapper. :-(
+ my $call_pack = caller();
+ local @CARP_NOT = caller();
+ shortmess_heavy(@_);
}
diff --git a/lib/Carp/Heavy.pm b/lib/Carp/Heavy.pm
index 06d57b5be0..5228b9b3a9 100644
--- a/lib/Carp/Heavy.pm
+++ b/lib/Carp/Heavy.pm
@@ -28,7 +28,7 @@ sub caller_info {
my $sub_name = Carp::get_subname(\%call_info);
if ($call_info{has_args}) {
- my @args = map {Carp::format_arg($_)} @args;
+ my @args = map {Carp::format_arg($_)} @DB::args;
if ($MaxArgNums and @args > $MaxArgNums) { # More than we want to show?
$#args = $MaxArgNums;
push @args, '...';
@@ -236,7 +236,10 @@ sub trusts {
# Takes a package and gives a list of those trusted directly
sub trusts_directly {
my $class = shift;
- return @{"$class\::ISA"};
+ no strict 'refs';
+ return @{"$class\::CARP_NOT"}
+ ? @{"$class\::CARP_NOT"}
+ : @{"$class\::ISA"};
}
1;
diff --git a/lib/DB.t b/lib/DB.t
index 0b4548cf2e..d5237a94fe 100644
--- a/lib/DB.t
+++ b/lib/DB.t
@@ -1,73 +1,81 @@
-#!./perl
+#!./perl -w
BEGIN {
- chdir 't' if -d 't';
- @INC = '../lib';
+ chdir 't' if -d 't';
+ @INC = '../lib';
}
+# symbolic references used later
+use strict qw( vars subs );
+
+# @DB::dbline values have both integer and string components (Benjamin Goldberg)
+use Scalar::Util qw( dualvar );
+my $dualfalse = dualvar(0, 'false');
+my $dualtrue = dualvar(1, 'true');
+
use Test::More tests => 106;
# must happen at compile time for DB:: package variable localizations to work
BEGIN {
- use_ok( 'DB' );
+ use_ok( 'DB' );
}
# test DB::sub()
{
- my $callflag = 0;
- local $DB::sub = sub {
- $callflag += shift || 1;
- my @vals = (1, 4, 9);
- return @vals;
- };
- my $ret = DB::sub;
- is( $ret, 3, 'DB::sub() should handle scalar context' );
- is( $callflag, 1, '... should call $DB::sub contents' );
- $ret = join(' ', DB::sub(2));
- is( $ret, '1 4 9', '... should handle scalar context' );
- is( $callflag, 3, '... should pass along arguments to the sub' );
- ok( defined($DB::ret),'$DB::ret should be defined after successful return');
- DB::sub;
- ok( !defined($DB::ret), '... should respect void context' );
- $DB::sub = '::DESTROY';
- ok( !defined($DB::ret), '... should return undef for DESTROY()' );
+ my $callflag = 0;
+ local $DB::sub = sub {
+ $callflag += shift || 1;
+ my @vals = (1, 4, 9);
+ return @vals;
+ };
+ my $ret = DB::sub;
+ is( $ret, 3, 'DB::sub() should handle scalar context' );
+ is( $callflag, 1, '... should call $DB::sub contents' );
+ $ret = join(' ', DB::sub(2));
+ is( $ret, '1 4 9', '... should handle scalar context' );
+ is( $callflag, 3, '... should pass along arguments to the sub' );
+ ok( defined($DB::ret),'$DB::ret should be defined after successful return');
+ DB::sub;
+ ok( !defined($DB::ret), '... should respect void context' );
+ $DB::sub = '::DESTROY';
+ ok( !defined($DB::ret), '... should return undef for DESTROY()' );
}
# test DB::DB()
{
- ok( ! defined DB::DB(),
- 'DB::DB() should return undef if $DB::ready is false');
- is( DB::catch(), 1, 'DB::catch() should work' );
- is( DB->skippkg('foo'), 1, 'DB->skippkg() should push args' );
+ ok( ! defined DB::DB(),
+ 'DB::DB() should return undef if $DB::ready is false');
+ is( DB::catch(), 1, 'DB::catch() should work' );
+ is( DB->skippkg('foo'), 1, 'DB->skippkg() should push args' );
- # change packages to mess with caller()
- package foo;
- ::ok( ! defined DB::DB(), 'DB::DB() should skip skippable packages' );
+ # change packages to mess with caller()
+ package foo;
+ ::ok( ! defined DB::DB(), 'DB::DB() should skip skippable packages' );
- package main;
- is( $DB::filename, $0, '... should set $DB::filename' );
- is( $DB::lineno, __LINE__ - 4, '... should set $DB::lineno' );
+ package main;
+ is( $DB::filename, $0, '... should set $DB::filename' );
+ is( $DB::lineno, __LINE__ - 4, '... should set $DB::lineno' );
- DB::DB();
- # stops at line 94
+ DB::DB();
+ # stops at line 94
}
# test DB::save()
{
no warnings 'uninitialized';
- # assigning a number to $! seems to produce an error message, when read
- local ($@, $,, $/, $\, $^W, $!) = (1 .. 5);
- DB::save();
- is( "$@$!$,$/$\$^W", "1\n0", 'DB::save() should reset punctuation vars' );
+ # assigning a number to $! seems to produce an error message, when read
+ local ($@, $,, $/, $\, $^W, $!) = (1 .. 5);
+ DB::save();
+ is( "$@$!$,$/$\$^W", "1\n0", 'DB::save() should reset punctuation vars' );
}
# test DB::catch()
{
- local $DB::signal;
- DB::catch();
- ok( $DB::signal, 'DB::catch() should set $DB::signal' );
- # add clients and test to see if they are awakened
+ local $DB::signal;
+ DB::catch();
+ ok( $DB::signal, 'DB::catch() should set $DB::signal' );
+ # add clients and test to see if they are awakened
}
# test DB::_clientname()
@@ -76,61 +84,61 @@ is( DB::_clientname('bar'), '','DB::_clientname should not return non refname');
# test DB::next() and DB::step()
{
- local $DB::single;
- DB->next();
- is( $DB::single, 2, 'DB->next() should set $DB::single to 2' );
- DB->step();
- is( $DB::single, 1, 'DB->step() should set $DB::single to 1' );
+ local $DB::single;
+ DB->next();
+ is( $DB::single, 2, 'DB->next() should set $DB::single to 2' );
+ DB->step();
+ is( $DB::single, 1, 'DB->step() should set $DB::single to 1' );
}
# test DB::cont()
{
- # cannot test @stack
+ # cannot test @stack
- local $DB::single = 1;
- my $fdb = FakeDB->new();
- DB::cont($fdb, 2);
- is( $fdb->{tbreak}, 2, 'DB::cont() should set tbreak in object' );
- is( $DB::single, 0, '... should set $DB::single to 0' );
+ local $DB::single = 1;
+ my $fdb = FakeDB->new();
+ DB::cont($fdb, 2);
+ is( $fdb->{tbreak}, 2, 'DB::cont() should set tbreak in object' );
+ is( $DB::single, 0, '... should set $DB::single to 0' );
}
# test DB::ret()
{
- # cannot test @stack
+ # cannot test @stack
- local $DB::single = 1;
- DB::ret();
- is( $DB::single, 0, 'DB::ret() should set $DB::single to 0' );
+ local $DB::single = 1;
+ DB::ret();
+ is( $DB::single, 0, 'DB::ret() should set $DB::single to 0' );
}
# test DB::backtrace()
{
- local (@DB::args, $DB::signal);
-
- my $line = __LINE__ + 1;
- my @ret = eval { DB->backtrace() };
- like( $ret[0], qr/file.+\Q$0\Q/, 'DB::backtrace() should report current file');
- like( $ret[0], qr/line $line/, '... should report calling line number' );
- like( $ret[0], qr/eval {...}/, '... should catch eval BLOCK' );
-
- @ret = eval "one(2)";
- is( scalar @ret, 1, '... should report from provided stack frame number' );
- like( $ret[0], qr/\@ = &eval \'one.+?2\)\'/, #'
- '... should find eval STRING construct');
- $ret[0] = check_context(1);
- like( $ret[0], qr/\$ = &main::check_context/,
- '... should respect context of calling construct');
-
- $DB::signal = 1;
- @DB::args = (1, 7);
- @ret = three(1);
- is( scalar @ret, 1, '... should end loop if $DB::signal is true' );
-
- # does not check 'require' or @DB::args mangling
+ local (@DB::args, $DB::signal);
+
+ my $line = __LINE__ + 1;
+ my @ret = eval { DB->backtrace() };
+ like( $ret[0], qr/file.+\Q$0\E/, 'DB::backtrace() should report current file');
+ like( $ret[0], qr/line $line/, '... should report calling line number' );
+ like( $ret[0], qr/eval {...}/, '... should catch eval BLOCK' );
+
+ @ret = eval "one(2)";
+ is( scalar @ret, 1, '... should report from provided stack frame number' );
+ like( $ret[0], qr/\@ = &eval \'one.+?2\)\'/, #'
+ '... should find eval STRING construct');
+ $ret[0] = check_context(1);
+ like( $ret[0], qr/\$ = &main::check_context/,
+ '... should respect context of calling construct');
+
+ $DB::signal = 1;
+ @DB::args = (1, 7);
+ @ret = three(1);
+ is( scalar @ret, 1, '... should end loop if $DB::signal is true' );
+
+ # does not check 'require' or @DB::args mangling
}
sub check_context {
- return (eval "one($_[0])")[-1];
+ return (eval "one($_[0])")[-1];
}
sub one { DB->backtrace(@_) }
sub two { one(@_) }
@@ -138,330 +146,334 @@ sub three { two(@_) }
# test DB::trace_toggle
{
- local $DB::trace = 0;
- DB->trace_toggle;
- ok( $DB::trace, 'DB::trace_toggle() should toggle $DB::trace' );
- DB->trace_toggle;
- ok( !$DB::trace, '... should toggle $DB::trace (back)' );
+ local $DB::trace = 0;
+ DB->trace_toggle;
+ ok( $DB::trace, 'DB::trace_toggle() should toggle $DB::trace' );
+ DB->trace_toggle;
+ ok( !$DB::trace, '... should toggle $DB::trace (back)' );
}
# test DB::subs()
{
- local %DB::sub;
- my $subs = DB->subs;
- is( $subs, 0, 'DB::subs() should return keys of %DB::subs' );
- %DB::sub = ( foo => 'foo:23-45' , bar => 'ba:r:7-890' );
- $subs = DB->subs;
- is( $subs, 2, '... same song, different key' );
- my @subs = DB->subs( 'foo', 'boo', 'bar' );
- is( scalar @subs, 2, '... should report only for requested subs' );
- my @expected = ( [ 'foo', 23, 45 ], [ 'ba:r', 7, 890 ] );
- ok( eq_array( \@subs, \@expected ), '... find file, start, end for subs' );
+ local %DB::sub;
+ my $subs = DB->subs;
+ is( $subs, 0, 'DB::subs() should return keys of %DB::subs' );
+ %DB::sub = ( foo => 'foo:23-45' , bar => 'ba:r:7-890' );
+ $subs = DB->subs;
+ is( $subs, 2, '... same song, different key' );
+ my @subs = DB->subs( 'foo', 'boo', 'bar' );
+ is( scalar @subs, 2, '... should report only for requested subs' );
+ my @expected = ( [ 'foo', 23, 45 ], [ 'ba:r', 7, 890 ] );
+ ok( eq_array( \@subs, \@expected ), '... find file, start, end for subs' );
}
# test DB::filesubs()
{
- local ($DB::filename, %DB::sub);
- $DB::filename = 'baz';
- %DB::sub = map { $_ => $_ } qw( bazbar bazboo boobar booboo boobaz );
- my @ret = DB->filesubs();
- is( scalar @ret, 2, 'DB::filesubs() should use $DB::filename with no args');
- @ret = grep { /^baz/ } @ret;
- is( scalar @ret, 2, '... should pick up subs in proper file' );
- @ret = DB->filesubs('boo');
- is( scalar @ret, 3, '... should use argument to find subs' );
- @ret = grep { /^boo/ } @ret;
- is( scalar @ret, 3, '... should pick up subs in proper file with argument');
+ local ($DB::filename, %DB::sub);
+ $DB::filename = 'baz';
+ %DB::sub = map { $_ => $_ } qw( bazbar bazboo boobar booboo boobaz );
+ my @ret = DB->filesubs();
+ is( scalar @ret, 2, 'DB::filesubs() should use $DB::filename with no args');
+ @ret = grep { /^baz/ } @ret;
+ is( scalar @ret, 2, '... should pick up subs in proper file' );
+ @ret = DB->filesubs('boo');
+ is( scalar @ret, 3, '... should use argument to find subs' );
+ @ret = grep { /^boo/ } @ret;
+ is( scalar @ret, 3, '... should pick up subs in proper file with argument');
}
# test DB::files()
{
- my $dbf = () = DB::files();
- my $main = () = grep ( m!^_<!, keys %main:: );
- is( $dbf, $main, 'DB::files() should pick up filenames from %main::' );
+ my $dbf = () = DB::files();
+ my $main = () = grep ( m!^_<!, keys %main:: );
+ is( $dbf, $main, 'DB::files() should pick up filenames from %main::' );
}
# test DB::lines()
{
- local @DB::dbline = ( 'foo' );
- is( DB->lines->[0], 'foo', 'DB::lines() should return ref to @DB::dbline' );
+ local @DB::dbline = ( 'foo' );
+ is( DB->lines->[0], 'foo', 'DB::lines() should return ref to @DB::dbline' );
}
# test DB::loadfile()
SKIP: {
- local (*DB::dbline, $DB::filename);
- ok( ! defined DB->loadfile('notafile'),
- 'DB::loadfile() should not find unloaded file' );
- my $file = (grep { m|^_<.+\.pm| } keys %main:: )[0];
- skip('cannot find loaded file', 3) unless $file;
- $file =~ s/^_<..//;
-
- my $db = DB->loadfile($file);
- like( $db, qr!$file\z!, '... should find loaded file from partial name');
- is( *DB::dbline, *{ "_<$db" } ,
- '... should set *DB::dbline to associated glob');
- is( $DB::filename, $db, '... should set $DB::filename to file name' );
-
- # test clients
+ local (*DB::dbline, $DB::filename);
+ ok( ! defined DB->loadfile('notafile'),
+ 'DB::loadfile() should not find unloaded file' );
+ my $file = (grep { m|^_<.+\.pm| } keys %main:: )[0];
+ skip('cannot find loaded file', 3) unless $file;
+ $file =~ s/^_<..//;
+
+ my $db = DB->loadfile($file);
+ like( $db, qr!$file\z!, '... should find loaded file from partial name');
+
+ is( *DB::dbline, *{ "_<$db" } ,
+ '... should set *DB::dbline to associated glob');
+ is( $DB::filename, $db, '... should set $DB::filename to file name' );
+
+ # test clients
}
# test DB::lineevents()
{
- local $DB::filename = 'baz';
- local *baz = *{ "main::_<baz" };
- @baz = ( 1 .. 5 );
- %baz = (
- 1 => "foo\0bar",
- 3 => "boo\0far",
- 4 => "fazbaz",
- );
- my %ret = DB->lineevents();
- is( scalar keys %ret, 3, 'DB::lineevents() should pick up defined lines' );
-
- # array access in DB::lineevents() starts at element 1, not 0
- is( join(' ', @{ $ret{1} }), '2 foo bar', '... should stash data in hash');
+ use vars qw( *baz );
+
+ local $DB::filename = 'baz';
+ local *baz = *{ "main::_<baz" };
+
+ @baz = map { dualvar(1, $_) } qw( one two three four five );
+ %baz = (
+ 1 => "foo\0bar",
+ 3 => "boo\0far",
+ 4 => "fazbaz",
+ );
+ my %ret = DB->lineevents();
+ is( scalar keys %ret, 3, 'DB::lineevents() should pick up defined lines' );
+
+ # array access in DB::lineevents() starts at element 1, not 0
+ is( join(' ', @{ $ret{1} }), 'two foo bar', '... should stash data in hash');
}
# test DB::set_break()
{
- local ($DB::lineno, *DB::dbline, $DB::package);
-
- %DB::dbline = (
- 1 => "\0",
- 2 => undef,
- 3 => "123\0\0\0abc",
- 4 => "\0abc",
- );
-
- *DB::dbline = [ 0, 1, 0, 0, 1 ];
-
- local %DB::sub = (
- 'main::foo' => 'foo:1-4',
- );
-
- DB->set_break(1, 'foo');
- is( $DB::dbline{1}, "foo\0", 'DB::set_break() should set break condition' );
-
- $DB::lineno = 1;
- DB->set_break(undef, 'bar');
- is( $DB::dbline{1}, "bar\0",
- '... should use $DB::lineno without specified line' );
-
- DB->set_break(4);
- is( $DB::dbline{4}, "1\0abc", '... should use default condition if needed');
-
- local %DB::sub = (
- 'main::foo' => 'foo:1-4',
- );
- DB->set_break('foo', 'baz');
- is( $DB::dbline{4}, "baz\0abc",
- '... should use _find_subline() to resolve subname' );
-
- my $db = FakeDB->new();
- DB::set_break($db, 2);
- like( $db->{output}, qr/2 not break/, '... should respect @DB::dbline' );
-
- DB::set_break($db, 'nonfoo');
- like( $db->{output}, qr/not found/, '... should warn on unfound sub' );
+ local ($DB::lineno, *DB::dbline, $DB::package);
+
+ %DB::dbline = (
+ 1 => "\0",
+ 2 => undef,
+ 3 => "123\0\0\0abc",
+ 4 => "\0abc",
+ );
+
+ *DB::dbline = [ $dualfalse, $dualtrue, $dualfalse, $dualfalse, $dualtrue ];
+
+ local %DB::sub = (
+ 'main::foo' => 'foo:1-4',
+ );
+
+ DB->set_break(1, 'foo');
+ is( $DB::dbline{1}, "foo\0", 'DB::set_break() should set break condition' );
+
+ $DB::lineno = 1;
+ DB->set_break(undef, 'bar');
+ is( $DB::dbline{1}, "bar\0",
+ '... should use $DB::lineno without specified line' );
+
+ DB->set_break(4);
+ is( $DB::dbline{4}, "1\0abc", '... should use default condition if needed');
+
+ local %DB::sub = (
+ 'main::foo' => 'foo:1-4',
+ );
+ DB->set_break('foo', 'baz');
+ is( $DB::dbline{4}, "baz\0abc",
+ '... should use _find_subline() to resolve subname' );
+
+ my $db = FakeDB->new();
+ DB::set_break($db, 2);
+ like( $db->{output}, qr/2 not break/, '... should respect @DB::dbline' );
+
+ DB::set_break($db, 'nonfoo');
+ like( $db->{output}, qr/not found/, '... should warn on unfound sub' );
}
# test DB::set_tbreak()
{
- local ($DB::lineno, *DB::dbline, $DB::package);
- *DB::dbline = [ 0, 1, 0, 0, 1 ];
+ local ($DB::lineno, *DB::dbline, $DB::package);
+ *DB::dbline = [ $dualfalse, $dualtrue, $dualfalse, $dualfalse, $dualtrue ];
- DB->set_tbreak(1);
- is( $DB::dbline{1}, ';9', 'DB::set_tbreak() should set tbreak condition' );
+ DB->set_tbreak(1);
+ is( $DB::dbline{1}, ';9', 'DB::set_tbreak() should set tbreak condition' );
- local %DB::sub = (
- 'main::foo' => 'foo:1-4',
- );
- DB->set_tbreak('foo', 'baz');
- is( $DB::dbline{4}, ';9',
- '... should use _find_subline() to resolve subname' );
+ local %DB::sub = (
+ 'main::foo' => 'foo:1-4',
+ );
+ DB->set_tbreak('foo', 'baz');
+ is( $DB::dbline{4}, ';9',
+ '... should use _find_subline() to resolve subname' );
- my $db = FakeDB->new();
- DB::set_tbreak($db, 2);
- like( $db->{output}, qr/2 not break/, '... should respect @DB::dbline' );
+ my $db = FakeDB->new();
+ DB::set_tbreak($db, 2);
+ like( $db->{output}, qr/2 not break/, '... should respect @DB::dbline' );
- DB::set_break($db, 'nonfoo');
- like( $db->{output}, qr/not found/, '... should warn on unfound sub' );
+ DB::set_break($db, 'nonfoo');
+ like( $db->{output}, qr/not found/, '... should warn on unfound sub' );
}
# test DB::_find_subline()
{
- my @foo;
- local *{ "::_<foo" } = \@foo;
-
- local $DB::package;
- local %DB::sub = (
- 'TEST::foo' => 'foo:10-15',
- 'main::foo' => 'foo:11-12',
- 'bar::bar' => 'foo:10-16',
- );
-
- $foo[11] = 1;
-
- is( DB::_find_subline('TEST::foo'), 11,
- 'DB::_find_subline() should find fully qualified sub' );
- is( DB::_find_subline("TEST'foo"), 11, '... should handle old package sep');
- is( DB::_find_subline('foo'), 11,
- '... should resolve unqualified package name to main::' );
-
- $DB::package = 'bar';
- is( DB::_find_subline('bar'), 11,
- '... should resolve unqualified name with $DB::package, if defined' );
-
- $foo[11] = 0;
-
- is( DB::_find_subline('TEST::foo'), 15,
- '... should increment past lines with no events' );
-
- ok( ! defined DB::_find_subline('sirnotappearinginthisfilm'),
- '... should not find nonexistant sub' );
+ my @foo;
+ local *{ "::_<foo" } = \@foo;
+
+ local $DB::package;
+ local %DB::sub = (
+ 'TEST::foo' => 'foo:10-15',
+ 'main::foo' => 'foo:11-12',
+ 'bar::bar' => 'foo:10-16',
+ );
+
+ $foo[11] = $dualtrue;
+
+ is( DB::_find_subline('TEST::foo'), 11,
+ 'DB::_find_subline() should find fully qualified sub' );
+ is( DB::_find_subline("TEST'foo"), 11, '... should handle old package sep');
+ is( DB::_find_subline('foo'), 11,
+ '... should resolve unqualified package name to main::' );
+
+ $DB::package = 'bar';
+ is( DB::_find_subline('bar'), 11,
+ '... should resolve unqualified name with $DB::package, if defined' );
+
+ $foo[11] = $dualfalse;
+
+ is( DB::_find_subline('TEST::foo'), 15,
+ '... should increment past lines with no events' );
+
+ ok( ! defined DB::_find_subline('sirnotappearinginthisfilm'),
+ '... should not find nonexistant sub' );
}
# test DB::clr_breaks()
{
- local *DB::dbline;
- my %lines = (
- 1 => "\0",
- 2 => undef,
- 3 => "123\0\0\0abc",
- 4 => "\0\0\0abc",
- );
-
- %DB::dbline = %lines;
- DB->clr_breaks(1 .. 4);
- is( scalar keys %DB::dbline, 3, 'DB::clr_breaks() should clear breaks' );
- ok( ! exists($DB::dbline{1}), '... should delete empty actions' );
- is( $DB::dbline{3}, "\0\0\0abc", '... should remove break, leaving action');
- is( $DB::dbline{4}, "\0\0\0abc", '... should not remove set actions' );
-
- local *{ "::_<foo" } = [ 0, 0, 0, 1 ];
-
- local $DB::package;
- local %DB::sub = (
- 'main::foo' => 'foo:1-3',
- );
-
- %DB::dbline = %lines;
- DB->clr_breaks('foo');
-
- is( $DB::dbline{3}, "\0\0\0abc",
- '... should find lines via _find_subline()' );
-
- my $db = FakeDB->new();
- DB::clr_breaks($db, 'abadsubname');
- is( $db->{output}, "Subroutine not found.\n",
- '... should output warning if sub cannot be found');
-
- @DB::dbline = (1 .. 4);
- %DB::dbline = (%lines, 5 => "\0" );
-
- DB::clr_breaks();
-
- is( scalar keys %DB::dbline, 4,
- 'Relying on @DB::dbline in DB::clr_breaks() should clear breaks' );
- ok( ! exists($DB::dbline{1}), '... should delete empty actions' );
- is( $DB::dbline{3}, "\0\0\0abc", '... should remove break, leaving action');
- is( $DB::dbline{4}, "\0\0\0abc", '... should not remove set actions' );
- ok( exists($DB::dbline{5}),
- '... should only go to last index of @DB::dbline' );
+ local *DB::dbline;
+ my %lines = (
+ 1 => "\0",
+ 2 => undef,
+ 3 => "123\0\0\0abc",
+ 4 => "\0\0\0abc",
+ );
+
+ %DB::dbline = %lines;
+ DB->clr_breaks(1 .. 4);
+ is( scalar keys %DB::dbline, 3, 'DB::clr_breaks() should clear breaks' );
+ ok( ! exists($DB::dbline{1}), '... should delete empty actions' );
+ is( $DB::dbline{3}, "\0\0\0abc", '... should remove break, leaving action');
+ is( $DB::dbline{4}, "\0\0\0abc", '... should not remove set actions' );
+
+ local *{ "::_<foo" } = [ 0, 0, 0, 1 ];
+
+ local $DB::package;
+ local %DB::sub = (
+ 'main::foo' => 'foo:1-3',
+ );
+
+ %DB::dbline = %lines;
+ DB->clr_breaks('foo');
+
+ is( $DB::dbline{3}, "\0\0\0abc",
+ '... should find lines via _find_subline()' );
+
+ my $db = FakeDB->new();
+ DB::clr_breaks($db, 'abadsubname');
+ is( $db->{output}, "Subroutine not found.\n",
+ '... should output warning if sub cannot be found');
+
+ @DB::dbline = (1 .. 4);
+ %DB::dbline = (%lines, 5 => "\0" );
+
+ DB::clr_breaks();
+
+ is( scalar keys %DB::dbline, 4,
+ 'Relying on @DB::dbline in DB::clr_breaks() should clear breaks' );
+ ok( ! exists($DB::dbline{1}), '... should delete empty actions' );
+ is( $DB::dbline{3}, "\0\0\0abc", '... should remove break, leaving action');
+ is( $DB::dbline{4}, "\0\0\0abc", '... should not remove set actions' );
+ ok( exists($DB::dbline{5}),
+ '... should only go to last index of @DB::dbline' );
}
# test DB::set_action()
{
- local *DB::dbline;
+ local *DB::dbline;
- %DB::dbline = (
- 2 => "\0abc",
- );
+ %DB::dbline = (
+ 2 => "\0abc",
+ );
- *DB::dbline = [ 0, 0, 1, 1 ];
+ *DB::dbline = [ $dualfalse, $dualfalse, $dualtrue, $dualtrue ];
- DB->set_action(2, 'def');
- is( $DB::dbline{2}, "\0def",
- 'DB::set_action() should replace existing action' );
- DB->set_action(3, '');
- is( $DB::dbline{3}, "\0", '... should set new action' );
+ DB->set_action(2, 'def');
+ is( $DB::dbline{2}, "\0def",
+ 'DB::set_action() should replace existing action' );
+ DB->set_action(3, '');
+ is( $DB::dbline{3}, "\0", '... should set new action' );
- my $db = FakeDB->new();
- DB::set_action($db, 'abadsubname');
- is( $db->{output}, "Subroutine not found.\n",
- '... should output warning if sub cannot be found');
+ my $db = FakeDB->new();
+ DB::set_action($db, 'abadsubname');
+ is( $db->{output}, "Subroutine not found.\n",
+ '... should output warning if sub cannot be found');
- DB::set_action($db, 1);
- like( $db->{output}, qr/1 not action/,
- '... should warn if line cannot be actionivated' );
+ DB::set_action($db, 1);
+ like( $db->{output}, qr/1 not action/,
+ '... should warn if line cannot be actionivated' );
}
# test DB::clr_actions()
{
- local *DB::dbline;
- my %lines = (
- 1 => "\0",
- 2 => undef,
- 3 => "123\0abc",
- 4 => "abc\0",
- );
-
- %DB::dbline = %lines;
- *DB::dbline = [ 1, 1, 1, 1 ];
-
- DB->clr_actions(1 .. 4);
-
- is( scalar keys %DB::dbline, 2, 'DB::clr_actions() should clear actions' );
- ok( ! exists($DB::dbline{1}), '... should delete empty actions' );
- is( $DB::dbline{3}, "123", '... should remove action, leaving break');
- is( $DB::dbline{4}, "abc\0", '... should not remove set breaks' );
-
- local *{ "::_<foo" } = [ 0, 0, 0, 1 ];
-
- local $DB::package;
- local %DB::sub = (
- 'main::foo' => 'foo:1-3',
- );
-
- %DB::dbline = %lines;
- DB->clr_actions('foo');
-
- is( $DB::dbline{3}, "123", '... should find lines via _find_subline()' );
-
- my $db = FakeDB->new();
- DB::clr_actions($db, 'abadsubname');
- is( $db->{output}, "Subroutine not found.\n",
- '... should output warning if sub cannot be found');
-
- @DB::dbline = (1 .. 4);
- %DB::dbline = (%lines, 5 => "\0" );
-
- DB::clr_actions();
-
- is( scalar keys %DB::dbline, 4,
- 'Relying on @DB::dbline in DB::clr_actions() should clear actions' );
- ok( ! exists($DB::dbline{1}), '... should delete empty actions' );
- is( $DB::dbline{3}, "123", '... should remove action, leaving break');
- is( $DB::dbline{4}, "abc\0", '... should not remove set breaks' );
- ok( exists($DB::dbline{5}),
- '... should only go to last index of @DB::dbline' );
+ local *DB::dbline;
+ my %lines = (
+ 1 => "\0",
+ 2 => undef,
+ 3 => "123\0abc",
+ 4 => "abc\0",
+ );
+
+ %DB::dbline = %lines;
+ *DB::dbline = [ ($dualtrue) x 4 ];
+
+ DB->clr_actions(1 .. 4);
+
+ is( scalar keys %DB::dbline, 2, 'DB::clr_actions() should clear actions' );
+ ok( ! exists($DB::dbline{1}), '... should delete empty actions' );
+ is( $DB::dbline{3}, "123", '... should remove action, leaving break');
+ is( $DB::dbline{4}, "abc\0", '... should not remove set breaks' );
+
+ local *{ "::_<foo" } = [ 0, 0, 0, 1 ];
+
+ local $DB::package;
+ local %DB::sub = (
+ 'main::foo' => 'foo:1-3',
+ );
+
+ %DB::dbline = %lines;
+ DB->clr_actions('foo');
+
+ is( $DB::dbline{3}, "123", '... should find lines via _find_subline()' );
+
+ my $db = FakeDB->new();
+ DB::clr_actions($db, 'abadsubname');
+ is( $db->{output}, "Subroutine not found.\n",
+ '... should output warning if sub cannot be found');
+
+ @DB::dbline = (1 .. 4);
+ %DB::dbline = (%lines, 5 => "\0" );
+
+ DB::clr_actions();
+
+ is( scalar keys %DB::dbline, 4,
+ 'Relying on @DB::dbline in DB::clr_actions() should clear actions' );
+ ok( ! exists($DB::dbline{1}), '... should delete empty actions' );
+ is( $DB::dbline{3}, "123", '... should remove action, leaving break');
+ is( $DB::dbline{4}, "abc\0", '... should not remove set breaks' );
+ ok( exists($DB::dbline{5}),
+ '... should only go to last index of @DB::dbline' );
}
# test DB::prestop()
ok( ! defined DB::prestop('test'),
- 'DB::prestop() should return undef for undef value' );
+ 'DB::prestop() should return undef for undef value' );
DB::prestop('test', 897);
is( DB::prestop('test'), 897, '... should return value when set' );
# test DB::poststop(), not exactly parallel
ok( ! defined DB::poststop('tset'),
- 'DB::prestop() should return undef for undef value' );
+ 'DB::prestop() should return undef for undef value' );
DB::poststop('tset', 987);
is( DB::poststop('tset'), 987, '... should return value when set' );
# test DB::evalcode()
ok( ! defined DB::evalcode('foo'),
- 'DB::evalcode() should return undef for undef value' );
+ 'DB::evalcode() should return undef for undef value' );
DB::evalcode('foo', 'bar');
is( DB::evalcode('foo'), 'bar', '... should return value when set' );
@@ -472,11 +484,11 @@ DB::register( FakeDB->new() ) for ( 1 .. 2);
DB::_outputall(1, 2, 3);
is( $FakeDB::output, '123123123',
- 'DB::_outputall() should call output(@_) on all clients' );
+ 'DB::_outputall() should call output(@_) on all clients' );
# test virtual methods
for my $method (qw( cprestop cpoststop awaken init stop idle cleanup output )) {
- ok( defined &{ "DB::$method" }, "DB::$method() should be defined" );
+ ok( defined &{ "DB::$method" }, "DB::$method() should be defined" );
}
# DB::skippkg() uses lexical
@@ -487,19 +499,19 @@ package FakeDB;
use vars qw( $output );
sub new {
- bless({}, $_[0]);
+ bless({}, $_[0]);
}
sub set_tbreak {
- my ($self, $val) = @_;
- $self->{tbreak} = $val;
+ my ($self, $val) = @_;
+ $self->{tbreak} = $val;
}
sub output {
- my $self = shift;
- if (ref $self) {
- $self->{output} = join('', @_);
- } else {
- $output .= join('', @_);
- }
+ my $self = shift;
+ if (ref $self) {
+ $self->{output} = join('', @_);
+ } else {
+ $output .= join('', @_);
+ }
}
diff --git a/lib/Exporter/Heavy.pm b/lib/Exporter/Heavy.pm
index abdae6c4b6..76a5bad17c 100644
--- a/lib/Exporter/Heavy.pm
+++ b/lib/Exporter/Heavy.pm
@@ -126,8 +126,13 @@ sub heavy_export {
last;
}
} elsif ($sym !~ s/^&// || !$export_cache->{$sym}) {
- require Carp;
- Carp::carp(qq["$sym" is not exported by the $pkg module]);
+ unless ($^S) {
+ # If we are trying to trap import of non-existent
+ # symbols using eval, let's be silent for now and
+ # just croak in the end.
+ require Carp;
+ Carp::carp(qq["$sym" is not exported by the $pkg module]);
+ }
$oops++;
}
}
diff --git a/lib/File/Basename.pm b/lib/File/Basename.pm
index c7657881b9..035c597991 100644
--- a/lib/File/Basename.pm
+++ b/lib/File/Basename.pm
@@ -17,9 +17,9 @@ dirname - extract just the directory from a path
$basename = basename($fullname,@suffixlist);
$dirname = dirname($fullname);
- ($name,$path,$suffix) = fileparse("lib/File/Basename.pm","\.pm");
+ ($name,$path,$suffix) = fileparse("lib/File/Basename.pm",qr{\.pm});
fileparse_set_fstype("VMS");
- $basename = basename("lib/File/Basename.pm",".pm");
+ $basename = basename("lib/File/Basename.pm",qr{\.pm});
$dirname = dirname("lib/File/Basename.pm");
=head1 DESCRIPTION
@@ -60,7 +60,8 @@ B<path> contains everything up to and including the last directory
separator in the input file specification. The remainder of the input
file specification is then divided into B<name> and B<suffix> based on
the optional patterns you specify in C<@suffixlist>. Each element of
-this list is interpreted as a regular expression, and is matched
+this list can be a qr-quoted pattern (or a string which is interpreted
+as a regular expression), and is matched
against the end of B<name>. If this succeeds, the matching portion of
B<name> is removed and prepended to B<suffix>. By proper use of
C<@suffixlist>, you can remove file types or versions for examination.
@@ -76,7 +77,7 @@ file as the input file specification.
Using Unix file syntax:
($base,$path,$type) = fileparse('/virgil/aeneid/draft.book7',
- '\.book\d+');
+ qr{\.book\d+});
would yield
@@ -87,7 +88,7 @@ would yield
Similarly, using VMS syntax:
($name,$dir,$type) = fileparse('Doc_Root:[Help]Rhetoric.Rnh',
- '\..*');
+ qr{\..*});
would yield
@@ -197,6 +198,7 @@ sub fileparse {
my $devspec = $1;
my $remainder = $3;
($dirpath,$basename) = ($remainder =~ m#^(.*/)?(.*)#s);
+ $dirpath ||= ''; # should always be defined
$dirpath = $devspec.$dirpath;
}
$dirpath = './' unless $dirpath;
diff --git a/lib/File/Basename.t b/lib/File/Basename.t
index 9bee1bfb8b..32d9bfba0c 100755
--- a/lib/File/Basename.t
+++ b/lib/File/Basename.t
@@ -18,7 +18,7 @@ print +(length(File::Basename::fileparse_set_fstype('unix')) ?
'' : 'not '),"ok 2\n";
# Unix syntax tests
-($base,$path,$type) = fileparse('/virgil/aeneid/draft.book7','\.book\d+');
+($base,$path,$type) = fileparse('/virgil/aeneid/draft.book7',qr'\.book\d+');
if ($base eq 'draft' and $path eq '/virgil/aeneid/' and $type eq '.book7') {
print "ok 3\n";
}
@@ -37,7 +37,7 @@ print +(File::Basename::fileparse_set_fstype('VMS') eq 'unix' ?
'' : 'not '),"ok 8\n";
# VMS syntax tests
-($base,$path,$type) = fileparse('virgil:[aeneid]draft.book7','\.book\d+');
+($base,$path,$type) = fileparse('virgil:[aeneid]draft.book7',qr{\.book\d+});
if ($base eq 'draft' and $path eq 'virgil:[aeneid]' and $type eq '.book7') {
print "ok 9\n";
}
diff --git a/lib/File/Spec/VMS.pm b/lib/File/Spec/VMS.pm
index 325af08290..f21ff5ecee 100644
--- a/lib/File/Spec/VMS.pm
+++ b/lib/File/Spec/VMS.pm
@@ -157,7 +157,7 @@ sub canonpath {
}
else {
$path =~ s/([\[<])000000\./$1/g; # [000000.foo ==> [foo
- $path =~ s/([^-]+)\.000000([\]\>])/$1$2/g; # foo.000000] ==> foo]
+ $path =~ s/([^-]+)\.(\]\[|><)?000000([\]\>])/$1$3/g; # foo.000000] ==> foo]
$path =~ s-\]\[--g; $path =~ s/><//g; # foo.][bar ==> foo.bar
1 while $path =~ s{([\[<-])\.-}{$1-}; # [.-.- ==> [--
$path =~ s/\.[^\[<\.]+\.-([\]\>])/$1/; # bar.foo.-] ==> bar]
diff --git a/lib/File/Spec/Functions.t b/lib/File/Spec/t/Functions.t
index 926812248c..926812248c 100755..100644
--- a/lib/File/Spec/Functions.t
+++ b/lib/File/Spec/t/Functions.t
diff --git a/lib/File/Spec.t b/lib/File/Spec/t/Spec.t
index 306a131b34..306a131b34 100755..100644
--- a/lib/File/Spec.t
+++ b/lib/File/Spec/t/Spec.t
diff --git a/lib/File/Spec/t/rel2abs2rel.t b/lib/File/Spec/t/rel2abs2rel.t
new file mode 100644
index 0000000000..69232d94c8
--- /dev/null
+++ b/lib/File/Spec/t/rel2abs2rel.t
@@ -0,0 +1,27 @@
+#!./perl -w
+
+# Herein we apply abs2rel, rel2abs and canonpath against various real
+# world files and make sure it all actually works.
+
+BEGIN {
+ chdir 't';
+ @INC = '../lib';
+}
+
+use Test::More tests => 5;
+use File::Spec;
+
+# Here we make sure File::Spec can properly deal with executables.
+# VMS has some trouble with these.
+my $perl = File::Spec->rel2abs($^X);
+is( `$^X -le "print 'ok'"`, "ok\n", '`` works' );
+is( `$perl -le "print 'ok'"`, "ok\n", 'rel2abs($^X)' );
+
+$perl = File::Spec->canonpath($perl);
+is( `$perl -le "print 'ok'"`, "ok\n", 'canonpath on abs executable' );
+
+$perl = File::Spec->abs2rel($perl);
+is( `$perl -le "print 'ok'"`, "ok\n", 'abs2rel()' );
+
+$perl = File::Spec->canonpath($^X);
+is( `$perl -le "print 'ok'"`, "ok\n", 'canonpath on rel executable' );
diff --git a/lib/Math/BigFloat.pm b/lib/Math/BigFloat.pm
index a490e6256e..a2587777f4 100644
--- a/lib/Math/BigFloat.pm
+++ b/lib/Math/BigFloat.pm
@@ -7,27 +7,24 @@
# _a: accuracy
# _p: precision
# _f: flags, used to signal MBI not to touch our private parts
-# _cow: Copy-On-Write (NRY)
package Math::BigFloat;
-$VERSION = '1.25';
+$VERSION = '1.26';
require 5.005;
use Exporter;
use Math::BigInt qw/objectify/;
@ISA = qw( Exporter Math::BigInt);
-# can not export bneg/babs since the are only in MBI
-@EXPORT_OK = qw(
- bcmp
- badd bmul bdiv bmod bnorm bsub
- bgcd blcm bround bfround
- bpow bnan bzero bfloor bceil
- bacmp bstr binc bdec binf
- is_odd is_even is_nan is_inf is_positive is_negative
- is_zero is_one sign
- );
-
-#@EXPORT = qw( );
+#@EXPORT_OK = qw(
+# bcmp
+# badd bmul bdiv bmod bnorm bsub
+# bgcd blcm bround bfround
+# bpow bnan bzero bfloor bceil
+# bacmp bstr binc bdec binf
+# is_odd is_even is_nan is_inf is_positive is_negative
+# is_zero is_one sign
+# );
+
use strict;
use vars qw/$AUTOLOAD $accuracy $precision $div_scale $round_mode $rnd_mode/;
my $class = "Math::BigFloat";
@@ -74,13 +71,13 @@ BEGIN { tie $rnd_mode, 'Math::BigFloat'; }
# valid method aliases for AUTOLOAD
my %methods = map { $_ => 1 }
qw / fadd fsub fmul fdiv fround ffround fsqrt fmod fstr fsstr fpow fnorm
- fneg fint facmp fcmp fzero fnan finf finc fdec
- fceil ffloor
+ fint facmp fcmp fzero fnan finf finc fdec
+ fceil ffloor frsft flsft fone
/;
# valid method's that need to be hand-ed up (for AUTOLOAD)
my %hand_ups = map { $_ => 1 }
qw / is_nan is_inf is_negative is_positive
- accuracy precision div_scale round_mode fabs babs
+ accuracy precision div_scale round_mode fneg fabs babs fnot
/;
sub method_alias { return exists $methods{$_[0]||''}; }
@@ -162,6 +159,7 @@ sub bnan
$self->{_m} = Math::BigInt->bzero();
$self->{_e} = Math::BigInt->bzero();
$self->{sign} = $nan;
+ ($self->{_a},$self->{_p}) = @_ if @_ > 0;
return $self;
}
@@ -179,6 +177,7 @@ sub binf
$self->{_m} = Math::BigInt->bzero();
$self->{_e} = Math::BigInt->bzero();
$self->{sign} = $sign.'inf';
+ ($self->{_a},$self->{_p}) = @_ if @_ > 0;
return $self;
}
@@ -196,6 +195,7 @@ sub bone
$self->{_m} = Math::BigInt->bone();
$self->{_e} = Math::BigInt->bzero();
$self->{sign} = $sign;
+ ($self->{_a},$self->{_p}) = @_ if @_ > 0;
return $self;
}
@@ -211,6 +211,7 @@ sub bzero
$self->{_m} = Math::BigInt->bzero();
$self->{_e} = Math::BigInt->bone();
$self->{sign} = '+';
+ ($self->{_a},$self->{_p}) = @_ if @_ > 0;
return $self;
}
@@ -321,16 +322,6 @@ sub numify
##############################################################################
# public stuff (usually prefixed with "b")
-# really? Just for exporting them is not what I had in mind
-#sub babs
-# {
-# $class->SUPER::babs($class,@_);
-# }
-#sub bneg
-# {
-# $class->SUPER::bneg($class,@_);
-# }
-
# tels 2001-08-04
# todo: this must be overwritten and return NaN for non-integer values
# band(), bior(), bxor(), too
@@ -424,12 +415,12 @@ sub bacmp
my $lx = $lxm + $x->{_e};
my $ly = $lym + $y->{_e};
# print "x $x y $y lx $lx ly $ly\n";
- my $l = $lx - $ly; # $l = -$l if $x->{sign} eq '-';
+ my $l = $lx - $ly;
# print "$l $x->{sign}\n";
return $l <=> 0 if $l != 0;
# lengths (corrected by exponent) are equal
- # so make mantissa euqal length by padding with zero (shift left)
+ # so make mantissa equal-length by padding with zero (shift left)
my $diff = $lxm - $lym;
my $xm = $x->{_m}; # not yet copy it
my $ym = $y->{_m};
@@ -442,22 +433,7 @@ sub bacmp
$xm = $x->{_m}->copy()->blsft(-$diff,10);
}
my $rc = $xm->bcmp($ym);
- # $rc = -$rc if $x->{sign} eq '-'; # -124 < -123
return $rc <=> 0;
-
-# # signs are ignored, so check length
-# # length(x) is length(m)+e aka length of non-fraction part
-# # the longer one is bigger
-# my $l = $x->length() - $y->length();
-# #print "$l\n";
-# return $l if $l != 0;
-# #print "equal lengths\n";
-#
-# # if both are equal long, make full compare
-# # first compare only the mantissa
-# # if mantissa are equal, compare fractions
-#
-# return $x->{_m} <=> $y->{_m} || $x->{_e} <=> $y->{_e};
}
sub badd
@@ -703,15 +679,11 @@ sub bmul
}
# aEb * cEd = (a*c)E(b+d)
- $x->{_m} = $x->{_m} * $y->{_m};
- #print "m: $x->{_m}\n";
- $x->{_e} = $x->{_e} + $y->{_e};
- #print "e: $x->{_m}\n";
+ $x->{_m}->bmul($y->{_m});
+ $x->{_e}->badd($y->{_e});
# adjust sign:
$x->{sign} = $x->{sign} ne $y->{sign} ? '-' : '+';
- #print "s: $x->{sign}\n";
- $x->bnorm();
- return $x->round($a,$p,$r,$y);
+ return $x->bnorm()->round($a,$p,$r,$y);
}
sub bdiv
@@ -735,18 +707,12 @@ sub bdiv
? ($x->binf($x->{sign}),$self->bnan()) : $x->binf($x->{sign})
if ($x->{sign} =~ /^[+-]$/ && $y->is_zero());
- # promote BigInts and it's subclasses (except when already a BigFloat)
- $y = $self->new($y) unless $y->isa('Math::BigFloat');
-
- # old, broken way
- # $y = $class->new($y) if ref($y) ne $self; # promote bigints
+ # x== 0 or y == 1 or y == -1
+ return wantarray ? ($x,$self->bzero()) : $x if $x->is_zero();
- # print "mbf bdiv $x ",ref($x)," ",$y," ",ref($y),"\n";
# we need to limit the accuracy to protect against overflow
-
my $fallback = 0;
my $scale = 0;
-# print "s=$scale a=",$a||'undef'," p=",$p||'undef'," r=",$r||'undef',"\n";
my @params = $x->_find_round_parameters($a,$p,$r,$y);
# no rounding at all, so must use fallback
@@ -764,40 +730,29 @@ sub bdiv
# enough...
$scale = abs($params[1] || $params[2]) + 4; # take whatever is defined
}
- # print "s=$scale a=",$params[1]||'undef'," p=",$params[2]||'undef'," f=$fallback\n";
my $lx = $x->{_m}->length(); my $ly = $y->{_m}->length();
$scale = $lx if $lx > $scale;
$scale = $ly if $ly > $scale;
-# print "scale $scale $lx $ly\n";
my $diff = $ly - $lx;
$scale += $diff if $diff > 0; # if lx << ly, but not if ly << lx!
- return wantarray ? ($x,$self->bzero()) : $x if $x->is_zero();
-
$x->{sign} = $x->{sign} ne $y->sign() ? '-' : '+';
# check for / +-1 ( +/- 1E0)
- if ($y->is_one())
+ if (!$y->is_one())
{
- return wantarray ? ($x,$self->bzero()) : $x;
+ # promote BigInts and it's subclasses (except when already a BigFloat)
+ $y = $self->new($y) unless $y->isa('Math::BigFloat');
+
+ # calculate the result to $scale digits and then round it
+ # a * 10 ** b / c * 10 ** d => a/c * 10 ** (b-d)
+ $x->{_m}->blsft($scale,10);
+ $x->{_m}->bdiv( $y->{_m} ); # a/c
+ $x->{_e}->bsub( $y->{_e} ); # b-d
+ $x->{_e}->bsub($scale); # correct for 10**scale
+ $x->bnorm(); # remove trailing 0's
}
- # calculate the result to $scale digits and then round it
- # a * 10 ** b / c * 10 ** d => a/c * 10 ** (b-d)
- #$scale = 82;
- #print "self: $self x: $x ref(x) ", ref($x)," m: $x->{_m}\n";
- $x->{_m}->blsft($scale,10);
- #print "m: $x->{_m} $y->{_m}\n";
- $x->{_m}->bdiv( $y->{_m} ); # a/c
- #print "m: $x->{_m}\n";
- #print "e: $x->{_e} $y->{_e} ",$scale,"\n";
- $x->{_e}->bsub($y->{_e}); # b-d
- #print "e: $x->{_e}\n";
- $x->{_e}->bsub($scale); # correct for 10**scale
- #print "after div: m: $x->{_m} e: $x->{_e}\n";
- $x->bnorm(); # remove trailing 0's
- #print "after norm: m: $x->{_m} e: $x->{_e}\n";
-
# shortcut to not run trough _find_round_parameters again
if (defined $params[1])
{
@@ -815,8 +770,16 @@ sub bdiv
if (wantarray)
{
- my $rem = $x->copy();
- $rem->bmod($y,$params[1],$params[2],$params[3]);
+ my $rem;
+ if (!$y->is_one())
+ {
+ $rem = $x->copy();
+ $rem->bmod($y,$params[1],$params[2],$params[3]);
+ }
+ else
+ {
+ $rem = $self->bzero();
+ }
if ($fallback)
{
# clear a/p after round, since user did not request it
@@ -847,7 +810,7 @@ sub bsqrt
return $x->bnan() if $x->{sign} eq 'NaN' || $x->{sign} =~ /^-/; # <0, NaN
return $x if $x->{sign} eq '+inf'; # +inf
- return $x if $x->is_zero() || $x == 1;
+ return $x if $x->is_zero() || $x->is_one();
# we need to limit the accuracy to protect against overflow (ignore $p)
my ($scale) = $x->_scale_a($self->accuracy(),$self->round_mode,$a,$r);
@@ -859,43 +822,53 @@ sub bsqrt
$a = $self->div_scale(); # and round to it
$fallback = 1; # to clear a/p afterwards
}
+ my $xas = $x->as_number();
+ my $gs = $xas->copy()->bsqrt(); # some guess
+ if (($x->{_e}->{sign} ne '-') # guess can't be accurate if there are
+ # digits after the dot
+ && ($xas->bcmp($gs * $gs) == 0)) # guess hit the nail on the head?
+ {
+ # exact result
+ $x->{_m} = $gs;
+ # leave alone if _e is already right
+ $x->{_e} = Math::BigInt->bzero();
+ return $x->bnorm()->round($a,$p,$r)
+ }
+ $gs = $self->new( $gs );
+
my $lx = $x->{_m}->length();
$scale = $lx if $scale < $lx;
- my $e = Math::BigFloat->new("1E-$scale"); # make test variable
+ my $e = $self->new("1E-$scale"); # make test variable
return $x->bnan() if $e->sign() eq 'NaN';
# start with some reasonable guess
- #$x *= 10 ** ($len - $org->{_e}); $x /= 2; # !?!?
- $lx = $lx+$x->{_e};
- $lx = 1 if $lx < 1;
- my $gs = Math::BigFloat->new('1'. ('0' x $lx));
-
-# print "first guess: $gs (x $x) scale $scale\n";
-
+# $lx = $lx+$x->{_e};
+# $lx = $lx / 2;
+# $lx = 1 if $lx < 1;
+ # my $gs = Math::BigFloat->new("1E$lx");
+
+# print "first guess: $gs (x $x) scale $scale\n";
+# # use BigInt:sqrt as reasonabe guess
+# print "second guess: $gs (x $x) scale $scale\n";
+
my $diff = $e;
my $y = $x->copy();
- my $two = Math::BigFloat->new(2);
+ my $two = $self->new(2);
# promote BigInts and it's subclasses (except when already a BigFloat)
$y = $self->new($y) unless $y->isa('Math::BigFloat');
- # old, broken way
- # $x = Math::BigFloat->new($x) if ref($x) ne $class; # promote BigInts
my $rem;
- # $scale = 2;
+# my $steps = 0;
while ($diff >= $e)
{
- return $x->bnan() if $gs->is_zero();
- $rem = $y->copy(); $rem->bdiv($gs,$scale);
- #print "y $y gs $gs ($gs->{_a}) rem (y/gs)\n $rem\n";
- $x = ($rem + $gs);
- #print "x $x rem $rem gs $gs gsa: $gs->{_a}\n";
- $x->bdiv($two,$scale);
- #print "x $x (/2)\n";
+ # return $x->bnan() if $gs->is_zero();
+
+ $x = $y->copy()->bdiv($gs,$scale)->badd($gs)->bdiv($two,$scale);
$diff = $x->copy()->bsub($gs)->babs();
$gs = $x->copy();
+# $steps++;
}
-# print "before $x $x->{_a} ",$a||'a undef'," ",$p||'p undef',"\n";
+# print "steps $steps\n";
$x->round($a,$p,$r);
-# print "after $x $x->{_a} ",$a||'a undef'," ",$p||'p undef',"\n";
if ($fallback)
{
# clear a/p after round, since user did not request it
@@ -917,7 +890,8 @@ sub bpow
return $x->bone() if $y->is_zero();
return $x if $x->is_one() || $y->is_one();
my $y1 = $y->as_number(); # make bigint (trunc)
- if ($x == -1)
+ # if ($x == -1)
+ if ($x->{sign} eq '-' && $x->{_m}->is_one() && $x->{_e}->is_zero())
{
# if $x == -1 and odd/even y => +1/-1 because +-1 ^ (+-1) => +-1
return $y1->is_odd() ? $x : $x->babs(1);
@@ -1123,6 +1097,30 @@ sub bceil
return $x->round($a,$p,$r);
}
+sub brsft
+ {
+ # shift right by $y (divide by power of 2)
+ my ($self,$x,$y,$n,$a,$p,$r) = objectify(2,@_);
+
+ return $x if $x->modify('brsft');
+ return $x if $x->{sign} !~ /^[+-]$/; # nan, +inf, -inf
+
+ $n = 2 if !defined $n; $n = Math::BigFloat->new($n);
+ $x->bdiv($n ** $y,$a,$p,$r,$y);
+ }
+
+sub blsft
+ {
+ # shift right by $y (divide by power of 2)
+ my ($self,$x,$y,$n,$a,$p,$r) = objectify(2,@_);
+
+ return $x if $x->modify('brsft');
+ return $x if $x->{sign} !~ /^[+-]$/; # nan, +inf, -inf
+
+ $n = 2 if !defined $n; $n = Math::BigFloat->new($n);
+ $x->bmul($n ** $y,$a,$p,$r,$y);
+ }
+
###############################################################################
sub DESTROY
@@ -1147,7 +1145,6 @@ sub AUTOLOAD
require Carp;
Carp::croak ("Can't call a method without name");
}
- # try one level up, but subst. bxxx() for fxxx() since MBI only got bxxx()
if (!method_hand_up($name))
{
# delayed load of Carp and avoid recursion
@@ -1250,7 +1247,7 @@ sub bnorm
# 'forget' that mantissa was rounded via MBI::bround() in MBF's bfround()
$x->{_m}->{_a} = undef; $x->{_e}->{_a} = undef;
$x->{_m}->{_p} = undef; $x->{_e}->{_p} = undef;
- return $x; # MBI bnorm is no-op
+ return $x; # MBI bnorm is no-op, so dont call it
}
##############################################################################
@@ -1258,8 +1255,8 @@ sub bnorm
sub as_number
{
- # return a bigint representation of this BigFloat number
- my $x = shift; my $class = ref($x) || $x; $x = $class->new(shift) unless ref($x);
+ # return copy as a bigint representation of this BigFloat number
+ my ($self,$x) = ref($_[0]) ? (ref($_[0]),$_[0]) : objectify(1,@_);
my $z;
if ($x->{_e}->is_zero())
diff --git a/lib/Math/BigInt.pm b/lib/Math/BigInt.pm
index a1b7b8f18f..354bc71c9f 100644
--- a/lib/Math/BigInt.pm
+++ b/lib/Math/BigInt.pm
@@ -1,9 +1,5 @@
#!/usr/bin/perl -w
-# Qs: what exactly happens on numify of HUGE numbers? overflow?
-# $a = -$a is much slower (making copy of $a) than $a->bneg(), hm!?
-# (copy_on_write will help there, but that is not yet implemented)
-
# The following hash values are used:
# value: unsigned int with actual value (as a Math::BigInt::Calc or similiar)
# sign : +,-,NaN,+inf,-inf
@@ -18,18 +14,21 @@ package Math::BigInt;
my $class = "Math::BigInt";
require 5.005;
-$VERSION = '1.47';
+$VERSION = '1.48';
use Exporter;
@ISA = qw( Exporter );
-@EXPORT_OK = qw( bneg babs bcmp badd bmul bdiv bmod bnorm bsub
- bgcd blcm bround
- blsft brsft band bior bxor bnot bpow bnan bzero
- bacmp bstr bsstr binc bdec binf bfloor bceil
- is_odd is_even is_zero is_one is_nan is_inf sign
- is_positive is_negative
- length as_number objectify _swap
+# no longer export stuff (it doesn't work with subclasses anyway)
+# bneg babs bcmp badd bmul bdiv bmod bnorm bsub
+# bgcd blcm bround
+# blsft brsft band bior bxor bnot bpow bnan bzero
+# bacmp bstr bsstr binc bdec binf bfloor bceil
+# is_odd is_even is_zero is_one is_nan is_inf sign
+# is_positive is_negative
+# length as_number
+@EXPORT_OK = qw(
+ objectify _swap
+ bgcd blcm
);
-#@EXPORT = qw( );
use vars qw/$round_mode $accuracy $precision $div_scale $rnd_mode/;
use strict;
@@ -291,21 +290,26 @@ sub copy
return unless ref($x); # only for objects
my $self = {}; bless $self,$c;
+ my $r;
foreach my $k (keys %$x)
{
if ($k eq 'value')
{
- $self->{value} = $CALC->_copy($x->{value});
+ $self->{value} = $CALC->_copy($x->{value}); next;
+ }
+ if (!($r = ref($x->{$k})))
+ {
+ $self->{$k} = $x->{$k}; next;
}
- elsif (ref($x->{$k}) eq 'SCALAR')
+ if ($r eq 'SCALAR')
{
$self->{$k} = \${$x->{$k}};
}
- elsif (ref($x->{$k}) eq 'ARRAY')
+ elsif ($r eq 'ARRAY')
{
$self->{$k} = [ @{$x->{$k}} ];
}
- elsif (ref($x->{$k}) eq 'HASH')
+ elsif ($r eq 'HASH')
{
# only one level deep!
foreach my $h (keys %{$x->{$k}})
@@ -313,14 +317,17 @@ sub copy
$self->{$k}->{$h} = $x->{$k}->{$h};
}
}
- elsif (ref($x->{$k}))
+ else # normal ref
{
- my $c = ref($x->{$k});
- $self->{$k} = $c->new($x->{$k}); # no copy() due to deep rec
- }
- else
- {
- $self->{$k} = $x->{$k};
+ my $xk = $x->{$k};
+ if ($xk->can('copy'))
+ {
+ $self->{$k} = $xk->copy();
+ }
+ else
+ {
+ $self->{$k} = $xk->new($xk);
+ }
}
}
$self;
@@ -425,6 +432,7 @@ sub bnan
return if $self->modify('bnan');
$self->{value} = $CALC->_zero();
$self->{sign} = $nan;
+ delete $self->{_a}; delete $self->{_p}; # rounding NaN is silly
return $self;
}
@@ -442,6 +450,7 @@ sub binf
return if $self->modify('binf');
$self->{value} = $CALC->_zero();
$self->{sign} = $sign.'inf';
+ ($self->{_a},$self->{_p}) = @_; # take over requested rounding
return $self;
}
@@ -458,6 +467,7 @@ sub bzero
return if $self->modify('bzero');
$self->{value} = $CALC->_zero();
$self->{sign} = '+';
+ ($self->{_a},$self->{_p}) = @_; # take over requested rounding
return $self;
}
@@ -468,7 +478,7 @@ sub bone
my $self = shift;
my $sign = shift; $sign = '+' if !defined $sign || $sign ne '-';
$self = $class if !defined $self;
-
+
if (!ref($self))
{
my $c = $self; $self = {}; bless $self, $c;
@@ -476,6 +486,7 @@ sub bone
return if $self->modify('bone');
$self->{value} = $CALC->_one();
$self->{sign} = $sign;
+ ($self->{_a},$self->{_p}) = @_; # take over requested rounding
return $self;
}
@@ -519,7 +530,7 @@ sub bstr
sub numify
{
- # Make a number from a BigInt object
+ # Make a "normal" scalar from a BigInt object
my $x = shift; $x = $class->new($x) unless ref $x;
return $x->{sign} if $x->{sign} !~ /^[+-]$/;
my $num = $CALC->_num($x->{value});
@@ -548,19 +559,19 @@ sub _find_round_parameters
# A and P settings.
# This does not yet handle $x with A, and $y with P (which should be an
# error).
- my $self = shift;
- my $a = shift; # accuracy, if given by caller
- my $p = shift; # precision, if given by caller
- my $r = shift; # round_mode, if given by caller
- my @args = @_; # all 'other' arguments (0 for unary, 1 for binary ops)
+ my ($self,$a,$p,$r,@args) = @_;
+ # $a accuracy, if given by caller
+ # $p precision, if given by caller
+ # $r round_mode, if given by caller
+ # @args all 'other' arguments (0 for unary, 1 for binary ops)
- $self = new($self) unless ref($self); # if not object, make one
- my $c = ref($self); # find out class of argument(s)
- unshift @args,$self; # add 'first' argument
+ # $self = new($self) unless ref($self); # if not object, make one
# leave bigfloat parts alone
return ($self) if exists $self->{_f} && $self->{_f} & MB_NEVER_ROUND != 0;
+ unshift @args,$self; # add 'first' argument
+ my $c = ref($self); # find out class of argument(s)
no strict 'refs';
# now pick $a or $p, but only if we have got "arguments"
@@ -651,7 +662,7 @@ sub bneg
return $x if $x->modify('bneg');
# for +0 dont negate (to have always normalized)
return $x if $x->is_zero();
- $x->{sign} =~ tr/+\-/-+/; # does nothing for NaN
+ $x->{sign} =~ tr/+-/-+/; # does nothing for NaN
$x;
}
@@ -955,7 +966,7 @@ sub is_one
$sign = '' if !defined $sign; $sign = '+' if $sign ne '-';
return 0 if $x->{sign} ne $sign; # -1 != +1, NaN, +-inf aren't either
- return $CALC->_is_one($x->{value});
+ $CALC->_is_one($x->{value});
}
sub is_odd
@@ -965,7 +976,7 @@ sub is_odd
my ($self,$x) = ref($_[0]) ? (undef,$_[0]) : objectify(1,@_);
return 0 if $x->{sign} !~ /^[+-]$/; # NaN & +-inf aren't
- return $CALC->_is_odd($x->{value});
+ $CALC->_is_odd($x->{value});
}
sub is_even
@@ -975,7 +986,7 @@ sub is_even
my ($self,$x) = ref($_[0]) ? (undef,$_[0]) : objectify(1,@_);
return 0 if $x->{sign} !~ /^[+-]$/; # NaN & +-inf aren't
- return $CALC->_is_even($x->{value});
+ $CALC->_is_even($x->{value});
}
sub is_positive
@@ -985,7 +996,7 @@ sub is_positive
my ($self,$x) = ref($_[0]) ? (undef,$_[0]) : objectify(1,@_);
return 1 if $x->{sign} =~ /^\+/;
- return 0;
+ 0;
}
sub is_negative
@@ -995,7 +1006,7 @@ sub is_negative
my ($self,$x) = ref($_[0]) ? (undef,$_[0]) : objectify(1,@_);
return 1 if ($x->{sign} =~ /^-/);
- return 0;
+ 0;
}
###############################################################################
@@ -1114,20 +1125,18 @@ sub bdiv
my $xsign = $x->{sign}; # keep
$x->{sign} = ($x->{sign} ne $y->{sign} ? '-' : '+');
# check for / +-1 (cant use $y->is_one due to '-'
- if (($y == 1) || ($y == -1)) # slow!
+ if ($CALC->_is_one($y->{value}))
{
return wantarray ? ($x,$self->bzero()) : $x;
}
- # call div here
- my $rem = $self->bzero();
- ($x->{value},$rem->{value}) = $CALC->_div($x->{value},$y->{value});
- # do not leave result "-0";
- $x->{sign} = '+' if $CALC->_is_zero($x->{value});
- $x->round($a,$p,$r,$y);
-
+ my $rem;
if (wantarray)
{
+ my $rem = $self->bzero();
+ ($x->{value},$rem->{value}) = $CALC->_div($x->{value},$y->{value});
+ $x->{sign} = '+' if $CALC->_is_zero($x->{value});
+ $x->round($a,$p,$r,$y);
if (! $CALC->_is_zero($rem->{value}))
{
$rem->{sign} = $y->{sign};
@@ -1140,7 +1149,10 @@ sub bdiv
$rem->round($a,$p,$r,$x,$y);
return ($x,$rem);
}
- return $x;
+
+ $x->{value} = $CALC->_div($x->{value},$y->{value});
+ $x->{sign} = '+' if $CALC->_is_zero($x->{value});
+ $x->round($a,$p,$r,$y);
}
sub bmod
@@ -1175,7 +1187,7 @@ sub bmod
{
$x = (&bdiv($self,$x,$y))[1]; # slow way
}
- $x->bround($a,$p,$r);
+ $x->round($a,$p,$r);
}
sub bpow
@@ -1191,7 +1203,6 @@ sub bpow
return $x->bnan() if $x->{sign} eq $nan || $y->{sign} eq $nan;
return $x->__one() if $y->is_zero();
return $x if $x->is_one() || $y->is_one();
- #if ($x->{sign} eq '-' && @{$x->{value}} == 1 && $x->{value}->[0] == 1)
if ($x->{sign} eq '-' && $CALC->_is_one($x->{value}))
{
# if $x == -1 and odd/even y => +1/-1
@@ -1288,7 +1299,7 @@ sub band
return $x if $x->modify('band');
return $x->bnan() if ($x->{sign} !~ /^[+-]$/ || $y->{sign} !~ /^[+-]$/);
- return $x->bzero() if $y->is_zero();
+ return $x->bzero() if $y->is_zero() || $x->is_zero();
my $sign = 0; # sign of result
$sign = 1 if ($x->{sign} eq '-') && ($y->{sign} eq '-');
@@ -1301,7 +1312,7 @@ sub band
return $x->round($a,$p,$r);
}
- my $m = new Math::BigInt 1; my ($xr,$yr);
+ my $m = Math::BigInt->bone(); my ($xr,$yr);
my $x10000 = new Math::BigInt (0x1000);
my $y1 = copy(ref($x),$y); # make copy
$y1->babs(); # and positive
@@ -1344,8 +1355,8 @@ sub bior
return $x->round($a,$p,$r);
}
- my $m = new Math::BigInt 1; my ($xr,$yr);
- my $x10000 = new Math::BigInt (0x10000);
+ my $m = Math::BigInt->bone(); my ($xr,$yr);
+ my $x10000 = Math::BigInt->new(0x10000);
my $y1 = copy(ref($x),$y); # make copy
$y1->babs(); # and positive
my $x1 = $x->copy()->babs(); $x->bzero(); # modify x in place!
@@ -1374,7 +1385,6 @@ sub bxor
return $x->bnan() if ($x->{sign} !~ /^[+-]$/ || $y->{sign} !~ /^[+-]$/);
return $x if $y->is_zero();
- return $x->bzero() if $x == $y; # shortcut
my $sign = 0; # sign of result
$sign = 1 if $x->{sign} ne $y->{sign};
@@ -1388,8 +1398,8 @@ sub bxor
return $x->round($a,$p,$r);
}
- my $m = new Math::BigInt 1; my ($xr,$yr);
- my $x10000 = new Math::BigInt (0x10000);
+ my $m = $self->bone(); my ($xr,$yr);
+ my $x10000 = Math::BigInt->new(0x10000);
my $y1 = copy(ref($x),$y); # make copy
$y1->babs(); # and positive
my $x1 = $x->copy()->babs(); $x->bzero(); # modify x in place!
@@ -1444,29 +1454,36 @@ sub _trailing_zeros
sub bsqrt
{
- my ($self,$x) = ref($_[0]) ? (ref($_[0]),$_[0]) : objectify(1,@_);
+ my ($self,$x,$a,$p,$r) = ref($_[0]) ? (ref($_[0]),$_[0]) : objectify(1,@_);
- return $x->bnan() if $x->{sign} =~ /\-|$nan/; # -x or NaN => NaN
- return $x->bzero() if $x->is_zero(); # 0 => 0
- return $x if $x == 1; # 1 => 1
+ return $x->bnan() if $x->{sign} ne '+'; # -x or inf or NaN => NaN
+ return $x->bzero($a,$p) if $x->is_zero(); # 0 => 0
+ return $x->round($a,$p,$r) if $x->is_one(); # 1 => 1
+ return $x->bone($a,$p) if $x < 4; # 2,3 => 1
- my $y = $x->copy(); # give us one more digit accur.
+ if ($CALC->can('_sqrt'))
+ {
+ $x->{value} = $CALC->_sqrt($x->{value});
+ return $x->round($a,$p,$r);
+ }
+
+ my $y = $x->copy();
my $l = int($x->length()/2);
- $x->bzero();
- $x->binc(); # keep ref($x), but modify it
- $x *= 10 ** $l;
-
- # print "x: $y guess $x\n";
+ $x->bone(); # keep ref($x), but modify it
+ $x->blsft($l,10);
my $last = $self->bzero();
- while ($last != $x)
+ my $two = $self->new(2);
+ my $lastlast = $x+$two;
+ while ($last != $x && $lastlast != $x)
{
- $last = $x;
+ $lastlast = $last; $last = $x;
$x += $y / $x;
- $x /= 2;
+ $x /= $two;
}
- return $x;
+ $x-- if $x * $x > $y; # overshot?
+ return $x->round($a,$p,$r);
}
sub exponent
@@ -1725,13 +1742,13 @@ sub _swap
# args, hence the copy().
# You can override this method in a subclass, the overload section will call
# $object->_swap() to make sure it arrives at the proper subclass, with some
- # exceptions like '+' and '-'.
+ # exceptions like '+' and '-'. To make '+' and '-' work, you also need to
+ # specify your own overload for them.
# object, (object|scalar) => preserve first and make copy
# scalar, object => swapped, re-swap and create new from first
# (using class of second object, not $class!!)
my $self = shift; # for override in subclass
- #print "swap $self 0:$_[0] 1:$_[1] 2:$_[2]\n";
if ($_[2])
{
my $c = ref ($_[0]) || $class; # fallback $class should not happen
@@ -1900,6 +1917,11 @@ sub __from_hex
my $hs = shift;
my $x = Math::BigInt->bzero();
+
+ # strip underscores
+ $$hs =~ s/([0-9a-fA-F])_([0-9a-fA-F])/$1$2/g;
+ $$hs =~ s/([0-9a-fA-F])_([0-9a-fA-F])/$1$2/g;
+
return $x->bnan() if $$hs !~ /^[\-\+]?0x[0-9A-Fa-f]+$/;
my $sign = '+'; $sign = '-' if ($$hs =~ /^-/);
@@ -1938,6 +1960,9 @@ sub __from_bin
my $bs = shift;
my $x = Math::BigInt->bzero();
+ # strip underscores
+ $$bs =~ s/([01])_([01])/$1$2/g;
+ $$bs =~ s/([01])_([01])/$1$2/g;
return $x->bnan() if $$bs !~ /^[+-]?0b[01]+$/;
my $mul = Math::BigInt->bzero(); $mul++;
@@ -1959,9 +1984,9 @@ sub __from_bin
$val = substr($$bs,$i,8);
$val =~ s/^[+-]?0b// if $len == 0; # for last part only
#$val = oct('0b'.$val); # does not work on Perl prior to 5.6.0
- $val = ('0' x (8-CORE::length($val))).$val if CORE::length($val) < 8;
- $val = ord(pack('B8',$val));
- # print "$val ",substr($$bs,$i,16),"\n";
+ # slower:
+ # $val = ('0' x (8-CORE::length($val))).$val if CORE::length($val) < 8;
+ $val = ord(pack('B8',substr('00000000'.$val,-8,8)));
$i -= 8; $len --;
$x += $mul * $val if $val != 0;
$mul *= $x256 if $len >= 0; # skip last mul
@@ -1994,11 +2019,12 @@ sub _split
# invalid starting char?
return if $$x !~ /^[+-]?(\.?[0-9]|0b[0-1]|0x[0-9a-fA-F])/;
- $$x =~ s/(\d)_(\d)/$1$2/g; # strip underscores between digits
- $$x =~ s/(\d)_(\d)/$1$2/g; # do twice for 1_2_3
-
return __from_hex($x) if $$x =~ /^[\-\+]?0x/; # hex string
return __from_bin($x) if $$x =~ /^[\-\+]?0b/; # binary string
+
+ # strip underscores between digits
+ $$x =~ s/(\d)_(\d)/$1$2/g;
+ $$x =~ s/(\d)_(\d)/$1$2/g; # do twice for 1_2_3
# some possible inputs:
# 2.1234 # 0.12 # 1 # 1E1 # 2.134E1 # 434E-10 # 1.02009E-2
@@ -2685,13 +2711,12 @@ numerical sense, e.g. $m might get minimized.
=head1 EXAMPLES
- use Math::BigInt qw(bstr);
+ use Math::BigInt;
sub bint { Math::BigInt->new(shift); }
- $x = bstr("1234") # string "1234"
+ $x = Math::BigInt->bstr("1234") # string "1234"
$x = "$x"; # same as bstr()
- $x = bneg("1234") # Bigint "-1234"
$x = Math::BigInt->bneg("1234"); # Bigint "-1234"
$x = Math::BigInt->babs("-12345"); # Bigint "12345"
$x = Math::BigInt->bnorm("-0 00"); # BigInt "0"
@@ -2701,10 +2726,9 @@ numerical sense, e.g. $m might get minimized.
$x = $x + 5 / 2; # BigInt "3"
$x = $x ** 3; # BigInt "27"
$x *= 2; # BigInt "54"
- $x = new Math::BigInt; # BigInt "0"
+ $x = Math::BigInt->new(0); # BigInt "0"
$x--; # BigInt "-1"
$x = Math::BigInt->badd(4,5) # BigInt "9"
- $x = Math::BigInt::badd(4,5) # BigInt "9"
print $x->bsstr(); # 9e+0
Examples for rounding:
@@ -2714,22 +2738,22 @@ Examples for rounding:
$x = Math::BigFloat->new(123.4567);
$y = Math::BigFloat->new(123.456789);
- $Math::BigFloat::accuracy = 4; # no more A than 4
+ Math::BigFloat->accuracy(4); # no more A than 4
ok ($x->copy()->fround(),123.4); # even rounding
print $x->copy()->fround(),"\n"; # 123.4
Math::BigFloat->round_mode('odd'); # round to odd
print $x->copy()->fround(),"\n"; # 123.5
- $Math::BigFloat::accuracy = 5; # no more A than 5
+ Math::BigFloat->accuracy(5); # no more A than 5
Math::BigFloat->round_mode('odd'); # round to odd
print $x->copy()->fround(),"\n"; # 123.46
$y = $x->copy()->fround(4),"\n"; # A = 4: 123.4
print "$y, ",$y->accuracy(),"\n"; # 123.4, 4
- $Math::BigFloat::accuracy = undef; # A not important
- $Math::BigFloat::precision = 2; # P important
- print $x->copy()->bnorm(),"\n"; # 123.46
- print $x->copy()->fround(),"\n"; # 123.46
+ Math::BigFloat->accuracy(undef); # A not important now
+ Math::BigFloat->precision(2); # P important
+ print $x->copy()->bnorm(),"\n"; # 123.46
+ print $x->copy()->fround(),"\n"; # 123.46
Examples for converting:
@@ -2760,7 +2784,15 @@ so that
+ '123456789123456789';
do not work. You need an explicit Math::BigInt->new() around one of the
-operands.
+operands. You should also quote large constants to protect loss of precision:
+
+ use Math::Bigint;
+
+ $x = Math::BigInt->new('1234567889123456789123456789123456789');
+
+Without the quotes Perl would convert the large number to a floating point
+constant at compile time and then hand the result to BigInt, which results in
+an truncated result or a NaN.
=head1 PERFORMANCE
@@ -2772,12 +2804,20 @@ $x += $y is MUCH faster than $x = $x + $y since making the copy of $x takes
more time then the actual addition.
With a technique called copy-on-write, the cost of copying with overload could
-be minimized or even completely avoided. This is currently not implemented.
+be minimized or even completely avoided. A test implementation of COW did show
+performance gains for overloaded math, but introduced a performance loss due
+to a constant overhead for all other operatons.
+
+The rewritten version of this module is slower on certain operations, like
+new(), bstr() and numify(). The reason are that it does now more work and
+handles more cases. The time spent in these operations is usually gained in
+the other operations so that programs on the average should get faster. If
+they don't, please contect the author.
-The new version of this module is slower on new(), bstr() and numify(). Some
-operations may be slower for small numbers, but are significantly faster for
-big numbers. Other operations are now constant (O(1), like bneg(), babs()
-etc), instead of O(N) and thus nearly always take much less time.
+Some operations may be slower for small numbers, but are significantly faster
+for big numbers. Other operations are now constant (O(1), like bneg(), babs()
+etc), instead of O(N) and thus nearly always take much less time. These
+optimizations were done on purpose.
If you find the Calc module to slow, try to install any of the replacement
modules and see if they help you.
@@ -2788,20 +2828,9 @@ You can use an alternative library to drive Math::BigInt via:
use Math::BigInt lib => 'Module';
-The default is called Math::BigInt::Calc and is a pure-perl implementation
-that consists mainly of the standard routine present in earlier versions of
-Math::BigInt.
-
-There are also Math::BigInt::Scalar (primarily for testing) and
-Math::BigInt::BitVect; as well as Math::BigInt::Pari and likely others.
-All these can be found via L<http://search.cpan.org/>:
-
- use Math::BigInt lib => 'BitVect';
-
- my $x = Math::BigInt->new(2);
- print $x ** (1024*1024);
+See L<MATH LIBRARY> for more information.
-For more benchmark results see http://bloodgate.com/perl/benchmarks.html
+For more benchmark results see L<http://bloodgate.com/perl/benchmarks.html>.
=head1 BUGS
@@ -2879,8 +2908,9 @@ as 1e+308. If in doubt, convert both arguments to Math::BigInt before doing eq:
$y = Math::BigInt->new($y);
ok ($x,$y); # okay
-There is not yet a way to get a number automatically represented in exactly
-the way Perl represents it.
+Alternatively, simple use <=> for comparisations, that will get it always
+right. There is not yet a way to get a number automatically represented as
+a string that matches exactly the way Perl represents it.
=item int()
@@ -3053,7 +3083,8 @@ since overload calls C<sub($x,0,1);> instead of C<neg($x)>. The first variant
needs to preserve $x since it does not know that it later will get overwritten.
This makes a copy of $x and takes O(N), but $x->bneg() is O(1).
-With Copy-On-Write, this issue will be gone. Stay tuned...
+With Copy-On-Write, this issue would be gone, but C-o-W is not implemented
+since it is slower for all other things.
=item Mixing different object types
@@ -3080,7 +3111,7 @@ With overloaded math, only the first two variants will result in a BigFloat:
$integer = $mbi2 / $mbf; # $mbi2->bdiv()
This is because math with overloaded operators follows the first (dominating)
-operand, this one's operation is called and returns thus the result. So,
+operand, and the operation of that is called and returns thus the result. So,
Math::BigInt::bdiv() will always return a Math::BigInt, regardless whether
the result should be a Math::BigFloat or the second operant is one.
@@ -3114,18 +3145,18 @@ This section also applies to other overloaded math packages, like Math::String.
=item bsqrt()
-C<bsqrt()> works only good if the result is an big integer, e.g. the square
+C<bsqrt()> works only good if the result is a big integer, e.g. the square
root of 144 is 12, but from 12 the square root is 3, regardless of rounding
mode.
If you want a better approximation of the square root, then use:
$x = Math::BigFloat->new(12);
- $Math::BigFloat::precision = 0;
+ Math::BigFloat->precision(0);
Math::BigFloat->round_mode('even');
print $x->copy->bsqrt(),"\n"; # 4
- $Math::BigFloat::precision = 2;
+ Math::BigFloat->precision(2);
print $x->bsqrt(),"\n"; # 3.46
print $x->bsqrt(3),"\n"; # 3.464
diff --git a/lib/Math/BigInt/Calc.pm b/lib/Math/BigInt/Calc.pm
index ba7483fcee..9424143b10 100644
--- a/lib/Math/BigInt/Calc.pm
+++ b/lib/Math/BigInt/Calc.pm
@@ -8,7 +8,7 @@ require Exporter;
use vars qw/@ISA $VERSION/;
@ISA = qw(Exporter);
-$VERSION = '0.16';
+$VERSION = '0.17';
# Package to store unsigned big integers in decimal and do math with them
@@ -30,35 +30,55 @@ $VERSION = '0.16';
# constants for easier life
my $nan = 'NaN';
-my ($BASE,$RBASE,$BASE_LEN,$MAX_VAL);
+my ($BASE,$RBASE,$BASE_LEN,$MAX_VAL,$BASE_LEN2);
+my ($AND_BITS,$XOR_BITS,$OR_BITS);
+my ($AND_MASK,$XOR_MASK,$OR_MASK);
sub _base_len
{
# set/get the BASE_LEN and assorted other, connected values
# used only be the testsuite, set is used only by the BEGIN block below
+ shift;
+
my $b = shift;
if (defined $b)
{
- $b = 8 if $b > 8; # cap, for VMS, OS/390 and other 64 bit
- $BASE_LEN = $b;
+ $b = 5 if $^O =~ /^uts/; # UTS needs 5, because 6 and 7 break
+ $BASE_LEN = $b+1;
+ my $caught;
+ while (--$BASE_LEN > 5)
+ {
+ $BASE = int("1e".$BASE_LEN);
+ $RBASE = abs('1e-'.$BASE_LEN); # see USE_MUL
+ $caught = 0;
+ $caught += 1 if (int($BASE * $RBASE) != 1); # should be 1
+ $caught += 2 if (int($BASE / $BASE) != 1); # should be 1
+ # print "caught $caught\n";
+ last if $caught != 3;
+ }
$BASE = int("1e".$BASE_LEN);
- $RBASE = abs('1e-'.$BASE_LEN); # see USE_MUL
+ $RBASE = abs('1e-'.$BASE_LEN); # see USE_MUL
$MAX_VAL = $BASE-1;
- # print "BASE_LEN: $BASE_LEN MAX_VAL: $MAX_VAL\n";
- # print "int: ",int($BASE * $RBASE),"\n";
- if (int($BASE * $RBASE) == 0) # should be 1
+ $BASE_LEN2 = int($BASE_LEN / 2); # for mul shortcut
+ # print "BASE_LEN: $BASE_LEN MAX_VAL: $MAX_VAL BASE: $BASE RBASE: $RBASE\n";
+
+ if ($caught & 1 != 0)
{
# must USE_MUL
*{_mul} = \&_mul_use_mul;
*{_div} = \&_div_use_mul;
}
- else
+ else # $caught must be 2, since it can't be 1 nor 3
{
# can USE_DIV instead
*{_mul} = \&_mul_use_div;
*{_div} = \&_div_use_div;
}
}
+ if (wantarray)
+ {
+ return ($BASE_LEN, $AND_BITS, $XOR_BITS, $OR_BITS);
+ }
$BASE_LEN;
}
@@ -71,11 +91,50 @@ BEGIN
do
{
$num = ('9' x ++$e) + 0;
- $num *= $num + 1;
+ $num *= $num + 1.0;
# print "$num $e\n";
- } while ("$num" =~ /9{$e}0{$e}/); # must be a certain pattern
- # last test failed, so retract one step:
- _base_len($e-1);
+ } while ("$num" =~ /9{$e}0{$e}/); # must be a certain pattern
+ $e--; # last test failed, so retract one step
+ # the limits below brush the problems with the test above under the rug:
+ # the test should be able to find the proper $e automatically
+ $e = 5 if $^O =~ /^uts/; # UTS get's some special treatment
+ $e = 5 if $^O =~ /^unicos/; # unicos is also problematic (6 seems to work
+ # there, but we play safe)
+ $e = 8 if $e > 8; # cap, for VMS, OS/390 and other 64 bit systems
+
+ __PACKAGE__->_base_len($e); # set and store
+
+ # find out how many bits _and, _or and _xor can take (old default = 16)
+ # I don't think anybody has yet 128 bit scalars, so let's play safe.
+ use integer;
+ local $^W = 0; # don't warn about 'nonportable number'
+ $AND_BITS = 15; $XOR_BITS = 15; $OR_BITS = 15;
+
+ # find max bits, we will not go higher than numberofbits that fit into $BASE
+ # to make _and etc simpler (and faster for smaller, slower for large numbers)
+ my $max = 16;
+ while (2 ** $max < $BASE) { $max++; }
+ my ($x,$y,$z);
+ do {
+ $AND_BITS++;
+ $x = oct('0b' . '1' x $AND_BITS); $y = $x & $x;
+ $z = (2 ** $AND_BITS) - 1;
+ } while ($AND_BITS < $max && $x == $z && $y == $x);
+ $AND_BITS --; # retreat one step
+ do {
+ $XOR_BITS++;
+ $x = oct('0b' . '1' x $XOR_BITS); $y = $x ^ 0;
+ $z = (2 ** $XOR_BITS) - 1;
+ } while ($XOR_BITS < $max && $x == $z && $y == $x);
+ $XOR_BITS --; # retreat one step
+ do {
+ $OR_BITS++;
+ $x = oct('0b' . '1' x $OR_BITS); $y = $x | $x;
+ $z = (2 ** $OR_BITS) - 1;
+ } while ($OR_BITS < $max && $x == $z && $y == $x);
+ $OR_BITS --; # retreat one step
+
+ # print "AND $AND_BITS XOR $XOR_BITS OR $OR_BITS\n";
}
##############################################################################
@@ -83,7 +142,7 @@ BEGIN
sub _new
{
- # (string) return ref to num_array
+ # (ref to string) return ref to num_array
# Convert a number from string format to internal base 100000 format.
# Assumes normalized value as input.
my $d = $_[1];
@@ -92,6 +151,13 @@ sub _new
return [ reverse(unpack("a" . ($il % $BASE_LEN+1)
. ("a$BASE_LEN" x ($il / $BASE_LEN)), $$d)) ];
}
+
+BEGIN
+ {
+ $AND_MASK = __PACKAGE__->_new( \( 2 ** $AND_BITS ));
+ $XOR_MASK = __PACKAGE__->_new( \( 2 ** $XOR_BITS ));
+ $OR_MASK = __PACKAGE__->_new( \( 2 ** $OR_BITS ));
+ }
sub _zero
{
@@ -241,23 +307,18 @@ sub _sub
$i += $BASE if $car = (($i -= ($sy->[$j] || 0) + $car) < 0); $j++;
}
# might leave leading zeros, so fix that
- __strip_zeros($sx);
- return $sx;
+ return __strip_zeros($sx);
}
- else
+ #print "case 1 (swap)\n";
+ for $i (@$sx)
{
- #print "case 1 (swap)\n";
- for $i (@$sx)
- {
- last unless defined $sy->[$j] || $car;
- $sy->[$j] += $BASE
- if $car = (($sy->[$j] = $i-($sy->[$j]||0) - $car) < 0);
- $j++;
- }
- # might leave leading zeros, so fix that
- __strip_zeros($sy);
- return $sy;
+ last unless defined $sy->[$j] || $car;
+ $sy->[$j] += $BASE
+ if $car = (($sy->[$j] = $i-($sy->[$j]||0) - $car) < 0);
+ $j++;
}
+ # might leave leading zeros, so fix that
+ __strip_zeros($sy);
}
sub _mul_use_mul
@@ -267,6 +328,16 @@ sub _mul_use_mul
# modifies first arg, second need not be different from first
my ($c,$xv,$yv) = @_;
+ # shortcut for two very short numbers
+ # +0 since part maybe string '00001' from new()
+ if ((@$xv == 1) && (@$yv == 1)
+ && (length($xv->[0]+0) <= $BASE_LEN2)
+ && (length($yv->[0]+0) <= $BASE_LEN2))
+ {
+ $xv->[0] *= $yv->[0];
+ return $xv;
+ }
+
my @prod = (); my ($prod,$car,$cty,$xi,$yi);
# since multiplying $x with $x fails, make copy in this case
$yv = [@$xv] if "$xv" eq "$yv"; # same references?
@@ -300,8 +371,6 @@ sub _mul_use_mul
}
push @$xv, @prod;
__strip_zeros($xv);
- # normalize (handled last to save check for $y->is_zero()
- return $xv;
}
sub _mul_use_div
@@ -311,6 +380,16 @@ sub _mul_use_div
# modifies first arg, second need not be different from first
my ($c,$xv,$yv) = @_;
+ # shortcut for two very short numbers
+ # +0 since part maybe string '00001' from new()
+ if ((@$xv == 1) && (@$yv == 1)
+ && (length($xv->[0]+0) <= $BASE_LEN2)
+ && (length($yv->[0]+0) <= $BASE_LEN2))
+ {
+ $xv->[0] *= $yv->[0];
+ return $xv;
+ }
+
my @prod = (); my ($prod,$car,$cty,$xi,$yi);
# since multiplying $x with $x fails, make copy in this case
$yv = [@$xv] if "$xv" eq "$yv"; # same references?
@@ -330,15 +409,12 @@ sub _mul_use_div
}
push @$xv, @prod;
__strip_zeros($xv);
- # normalize (handled last to save check for $y->is_zero()
- return $xv;
}
sub _div_use_mul
{
# ref to array, ref to array, modify first array and return remainder if
# in list context
- # no longer handles sign
my ($c,$x,$yorg) = @_;
my ($car,$bar,$prd,$dd,$xi,$yi,@q,$v2,$v1);
@@ -417,18 +493,19 @@ sub _div_use_mul
@$x = @q;
__strip_zeros($x);
__strip_zeros(\@d);
+ _check('',$x);
+ _check('',\@d);
return ($x,\@d);
}
@$x = @q;
__strip_zeros($x);
- return $x;
+ _check('',$x);
}
sub _div_use_div
{
# ref to array, ref to array, modify first array and return remainder if
# in list context
- # no longer handles sign
my ($c,$x,$yorg) = @_;
my ($car,$bar,$prd,$dd,$xi,$yi,@q,$v2,$v1);
@@ -511,9 +588,193 @@ sub _div_use_div
}
@$x = @q;
__strip_zeros($x);
- return $x;
}
+##############################################################################
+# testing
+
+sub _acmp
+ {
+ # internal absolute post-normalized compare (ignore signs)
+ # ref to array, ref to array, return <0, 0, >0
+ # arrays must have at least one entry; this is not checked for
+
+ my ($c,$cx,$cy) = @_;
+
+ # fat comp based on array elements
+ my $lxy = scalar @$cx - scalar @$cy;
+ return -1 if $lxy < 0; # already differs, ret
+ return 1 if $lxy > 0; # ditto
+
+ # now calculate length based on digits, not parts
+ $lxy = _len($c,$cx) - _len($c,$cy); # difference
+ return -1 if $lxy < 0;
+ return 1 if $lxy > 0;
+
+ # hm, same lengths, but same contents?
+ my $i = 0; my $a;
+ # first way takes 5.49 sec instead of 4.87, but has the early out advantage
+ # so grep is slightly faster, but more inflexible. hm. $_ instead of $k
+ # yields 5.6 instead of 5.5 sec huh?
+ # manual way (abort if unequal, good for early ne)
+ my $j = scalar @$cx - 1;
+ while ($j >= 0)
+ {
+ last if ($a = $cx->[$j] - $cy->[$j]); $j--;
+ }
+ return 1 if $a > 0;
+ return -1 if $a < 0;
+ return 0; # equal
+ # while it early aborts, it is even slower than the manual variant
+ #grep { return $a if ($a = $_ - $cy->[$i++]); } @$cx;
+ # grep way, go trough all (bad for early ne)
+ #grep { $a = $_ - $cy->[$i++]; } @$cx;
+ #return $a;
+ }
+
+sub _len
+ {
+ # compute number of digits in bigint, minus the sign
+
+ # int() because add/sub sometimes leaves strings (like '00005') instead of
+ # '5' in this place, thus causing length() to report wrong length
+ my $cx = $_[1];
+
+ return (@$cx-1)*$BASE_LEN+length(int($cx->[-1]));
+ }
+
+sub _digit
+ {
+ # return the nth digit, negative values count backward
+ # zero is rightmost, so _digit(123,0) will give 3
+ my ($c,$x,$n) = @_;
+
+ my $len = _len('',$x);
+
+ $n = $len+$n if $n < 0; # -1 last, -2 second-to-last
+ $n = abs($n); # if negative was too big
+ $len--; $n = $len if $n > $len; # n to big?
+
+ my $elem = int($n / $BASE_LEN); # which array element
+ my $digit = $n % $BASE_LEN; # which digit in this element
+ $elem = '0000'.@$x[$elem]; # get element padded with 0's
+ return substr($elem,-$digit-1,1);
+ }
+
+sub _zeros
+ {
+ # return amount of trailing zeros in decimal
+ # check each array elem in _m for having 0 at end as long as elem == 0
+ # Upon finding a elem != 0, stop
+ my $x = $_[1];
+ my $zeros = 0; my $elem;
+ foreach my $e (@$x)
+ {
+ if ($e != 0)
+ {
+ $elem = "$e"; # preserve x
+ $elem =~ s/.*?(0*$)/$1/; # strip anything not zero
+ $zeros *= $BASE_LEN; # elems * 5
+ $zeros += CORE::length($elem); # count trailing zeros
+ last; # early out
+ }
+ $zeros ++; # real else branch: 50% slower!
+ }
+ return $zeros;
+ }
+
+##############################################################################
+# _is_* routines
+
+sub _is_zero
+ {
+ # return true if arg (BINT or num_str) is zero (array '+', '0')
+ my $x = $_[1];
+ return (((scalar @$x == 1) && ($x->[0] == 0))) <=> 0;
+ }
+
+sub _is_even
+ {
+ # return true if arg (BINT or num_str) is even
+ my $x = $_[1];
+ return (!($x->[0] & 1)) <=> 0;
+ }
+
+sub _is_odd
+ {
+ # return true if arg (BINT or num_str) is even
+ my $x = $_[1];
+ return (($x->[0] & 1)) <=> 0;
+ }
+
+sub _is_one
+ {
+ # return true if arg (BINT or num_str) is one (array '+', '1')
+ my $x = $_[1];
+ return (scalar @$x == 1) && ($x->[0] == 1) <=> 0;
+ }
+
+sub __strip_zeros
+ {
+ # internal normalization function that strips leading zeros from the array
+ # args: ref to array
+ my $s = shift;
+
+ my $cnt = scalar @$s; # get count of parts
+ my $i = $cnt-1;
+ push @$s,0 if $i < 0; # div might return empty results, so fix it
+
+ #print "strip: cnt $cnt i $i\n";
+ # '0', '3', '4', '0', '0',
+ # 0 1 2 3 4
+ # cnt = 5, i = 4
+ # i = 4
+ # i = 3
+ # => fcnt = cnt - i (5-2 => 3, cnt => 5-1 = 4, throw away from 4th pos)
+ # >= 1: skip first part (this can be zero)
+ while ($i > 0) { last if $s->[$i] != 0; $i--; }
+ $i++; splice @$s,$i if ($i < $cnt); # $i cant be 0
+ $s;
+ }
+
+###############################################################################
+# check routine to test internal state of corruptions
+
+sub _check
+ {
+ # used by the test suite
+ my $x = $_[1];
+
+ return "$x is not a reference" if !ref($x);
+
+ # are all parts are valid?
+ my $i = 0; my $j = scalar @$x; my ($e,$try);
+ while ($i < $j)
+ {
+ $e = $x->[$i]; $e = 'undef' unless defined $e;
+ $try = '=~ /^[\+]?[0-9]+\$/; '."($x, $e)";
+ last if $e !~ /^[+]?[0-9]+$/;
+ $try = '=~ /^[\+]?[0-9]+\$/; '."($x, $e) (stringify)";
+ last if "$e" !~ /^[+]?[0-9]+$/;
+ $try = '=~ /^[\+]?[0-9]+\$/; '."($x, $e) (cat-stringify)";
+ last if '' . "$e" !~ /^[+]?[0-9]+$/;
+ $try = ' < 0 || >= $BASE; '."($x, $e)";
+ last if $e <0 || $e >= $BASE;
+ # this test is disabled, since new/bnorm and certain ops (like early out
+ # in add/sub) are allowed/expected to leave '00000' in some elements
+ #$try = '=~ /^00+/; '."($x, $e)";
+ #last if $e =~ /^00+/;
+ $i++;
+ }
+ return "Illegal part '$e' at pos $i (tested: $try)" if $i < $j;
+ return 0;
+ }
+
+
+###############################################################################
+###############################################################################
+# some optional routines to make BigInt faster
+
sub _mod
{
# if possible, use mod shortcut
@@ -672,179 +933,204 @@ sub _pow
return $cx;
}
-##############################################################################
-# testing
-
-sub _acmp
+sub _sqrt
{
- # internal absolute post-normalized compare (ignore signs)
- # ref to array, ref to array, return <0, 0, >0
- # arrays must have at least one entry; this is not checked for
+ # square-root of $x
+ # ref to array, return ref to array
+ my ($c,$x) = @_;
- my ($c,$cx, $cy) = @_;
+ if (scalar @$x == 1)
+ {
+ # fit's into one Perl scalar
+ $x->[0] = int(sqrt($x->[0]));
+ return $x;
+ }
+ my $y = _copy($c,$x);
+ my $l = [ _len($c,$x) / 2 ];
- my ($i,$a,$x,$y,$k);
- # calculate length based on digits, not parts
- $x = _len('',$cx); $y = _len('',$cy);
- my $lxy = $x - $y; # if different in length
- return -1 if $lxy < 0;
- return 1 if $lxy > 0;
- $i = 0; $a = 0;
- # first way takes 5.49 sec instead of 4.87, but has the early out advantage
- # so grep is slightly faster, but more inflexible. hm. $_ instead of $k
- # yields 5.6 instead of 5.5 sec huh?
- # manual way (abort if unequal, good for early ne)
- my $j = scalar @$cx - 1;
- while ($j >= 0)
- {
- # print "$cx->[$j] $cy->[$j] $a",$cx->[$j]-$cy->[$j],"\n";
- last if ($a = $cx->[$j] - $cy->[$j]); $j--;
- }
- return 1 if $a > 0;
- return -1 if $a < 0;
- return 0; # equal
- # while it early aborts, it is even slower than the manual variant
- #grep { return $a if ($a = $_ - $cy->[$i++]); } @$cx;
- # grep way, go trough all (bad for early ne)
- #grep { $a = $_ - $cy->[$i++]; } @$cx;
- #return $a;
- }
+ splice @$x,0; $x->[0] = 1; # keep ref($x), but modify it
-sub _len
- {
- # compute number of digits in bigint, minus the sign
- # int() because add/sub sometimes leaves strings (like '00005') instead of
- # int ('5') in this place, thus causing length() to report wrong length
- my $cx = $_[1];
+ _lsft($c,$x,$l,10);
- return (@$cx-1)*$BASE_LEN+length(int($cx->[-1]));
+ my $two = _two();
+ my $last = _zero();
+ my $lastlast = _zero();
+ while (_acmp($c,$last,$x) != 0 && _acmp($c,$lastlast,$x) != 0)
+ {
+ $lastlast = _copy($c,$last);
+ $last = _copy($c,$x);
+ _add($c,$x, _div($c,_copy($c,$y),$x));
+ _div($c,$x, $two );
+ }
+ _dec($c,$x) if _acmp($c,$y,_mul($c,_copy($c,$x),$x)) < 0; # overshot?
+ $x;
}
-sub _digit
- {
- # return the nth digit, negative values count backward
- # zero is rightmost, so _digit(123,0) will give 3
- my ($c,$x,$n) = @_;
+##############################################################################
+# binary stuff
- my $len = _len('',$x);
+sub _and
+ {
+ my ($c,$x,$y) = @_;
- $n = $len+$n if $n < 0; # -1 last, -2 second-to-last
- $n = abs($n); # if negative was too big
- $len--; $n = $len if $n > $len; # n to big?
+ # the shortcut makes equal, large numbers _really_ fast, and makes only a
+ # very small performance drop for small numbers (e.g. something with less
+ # than 32 bit) Since we optimize for large numbers, this is enabled.
+ return $x if _acmp($c,$x,$y) == 0; # shortcut
- my $elem = int($n / $BASE_LEN); # which array element
- my $digit = $n % $BASE_LEN; # which digit in this element
- $elem = '0000'.@$x[$elem]; # get element padded with 0's
- return substr($elem,-$digit-1,1);
+ my $m = _one(); my ($xr,$yr);
+ my $mask = $AND_MASK;
+
+ my $x1 = $x;
+ my $y1 = _copy($c,$y); # make copy
+ $x = _zero();
+ my ($b,$xrr,$yrr);
+ use integer;
+ while (!_is_zero($c,$x1) && !_is_zero($c,$y1))
+ {
+ ($x1, $xr) = _div($c,$x1,$mask);
+ ($y1, $yr) = _div($c,$y1,$mask);
+
+ # make ints() from $xr, $yr
+ # this is when the AND_BITS are greater tahn $BASE and is slower for
+ # small (<256 bits) numbers, but faster for large numbers. Disabled
+ # due to KISS principle
+
+# $b = 1; $xrr = 0; foreach (@$xr) { $xrr += $_ * $b; $b *= $BASE; }
+# $b = 1; $yrr = 0; foreach (@$yr) { $yrr += $_ * $b; $b *= $BASE; }
+# _add($c,$x, _mul($c, _new( $c, \($xrr & $yrr) ), $m) );
+
+ _add($c,$x, _mul($c, [ $xr->[0] & $yr->[0] ], $m) );
+ _mul($c,$m,$mask);
+ }
+ $x;
}
-sub _zeros
+sub _xor
{
- # return amount of trailing zeros in decimal
- # check each array elem in _m for having 0 at end as long as elem == 0
- # Upon finding a elem != 0, stop
- my $x = $_[1];
- my $zeros = 0; my $elem;
- foreach my $e (@$x)
+ my ($c,$x,$y) = @_;
+
+ return _zero() if _acmp($c,$x,$y) == 0; # shortcut (see -and)
+
+ my $m = _one(); my ($xr,$yr);
+ my $mask = $XOR_MASK;
+
+ my $x1 = $x;
+ my $y1 = _copy($c,$y); # make copy
+ $x = _zero();
+ my ($b,$xrr,$yrr);
+ use integer;
+ while (!_is_zero($c,$x1) && !_is_zero($c,$y1))
{
- if ($e != 0)
- {
- $elem = "$e"; # preserve x
- $elem =~ s/.*?(0*$)/$1/; # strip anything not zero
- $zeros *= $BASE_LEN; # elems * 5
- $zeros += CORE::length($elem); # count trailing zeros
- last; # early out
- }
- $zeros ++; # real else branch: 50% slower!
+ ($x1, $xr) = _div($c,$x1,$mask);
+ ($y1, $yr) = _div($c,$y1,$mask);
+ # make ints() from $xr, $yr (see _and())
+ #$b = 1; $xrr = 0; foreach (@$xr) { $xrr += $_ * $b; $b *= $BASE; }
+ #$b = 1; $yrr = 0; foreach (@$yr) { $yrr += $_ * $b; $b *= $BASE; }
+ #_add($c,$x, _mul($c, _new( $c, \($xrr ^ $yrr) ), $m) );
+
+ _add($c,$x, _mul($c, [ $xr->[0] ^ $yr->[0] ], $m) );
+ _mul($c,$m,$mask);
}
- return $zeros;
+ # the loop stops when the shorter of the two numbers is exhausted
+ # the remainder of the longer one will survive bit-by-bit, so we simple
+ # multiply-add it in
+ _add($c,$x, _mul($c, $x1, $m) ) if !_is_zero($c,$x1);
+ _add($c,$x, _mul($c, $y1, $m) ) if !_is_zero($c,$y1);
+
+ $x;
}
-##############################################################################
-# _is_* routines
-
-sub _is_zero
+sub _or
{
- # return true if arg (BINT or num_str) is zero (array '+', '0')
- my $x = $_[1];
- return (((scalar @$x == 1) && ($x->[0] == 0))) <=> 0;
- }
+ my ($c,$x,$y) = @_;
-sub _is_even
- {
- # return true if arg (BINT or num_str) is even
- my $x = $_[1];
- return (!($x->[0] & 1)) <=> 0;
- }
+ return $x if _acmp($c,$x,$y) == 0; # shortcut (see _and)
-sub _is_odd
- {
- # return true if arg (BINT or num_str) is even
- my $x = $_[1];
- return (($x->[0] & 1)) <=> 0;
- }
+ my $m = _one(); my ($xr,$yr);
+ my $mask = $OR_MASK;
-sub _is_one
- {
- # return true if arg (BINT or num_str) is one (array '+', '1')
- my $x = $_[1];
- return (scalar @$x == 1) && ($x->[0] == 1) <=> 0;
+ my $x1 = $x;
+ my $y1 = _copy($c,$y); # make copy
+ $x = _zero();
+ my ($b,$xrr,$yrr);
+ use integer;
+ while (!_is_zero($c,$x1) && !_is_zero($c,$y1))
+ {
+ ($x1, $xr) = _div($c,$x1,$mask);
+ ($y1, $yr) = _div($c,$y1,$mask);
+ # make ints() from $xr, $yr (see _and())
+# $b = 1; $xrr = 0; foreach (@$xr) { $xrr += $_ * $b; $b *= $BASE; }
+# $b = 1; $yrr = 0; foreach (@$yr) { $yrr += $_ * $b; $b *= $BASE; }
+# _add($c,$x, _mul($c, _new( $c, \($xrr | $yrr) ), $m) );
+
+ _add($c,$x, _mul($c, [ $xr->[0] | $yr->[0] ], $m) );
+ _mul($c,$m,$mask);
+ }
+ # the loop stops when the shorter of the two numbers is exhausted
+ # the remainder of the longer one will survive bit-by-bit, so we simple
+ # multiply-add it in
+ _add($c,$x, _mul($c, $x1, $m) ) if !_is_zero($c,$x1);
+ _add($c,$x, _mul($c, $y1, $m) ) if !_is_zero($c,$y1);
+
+ $x;
}
-sub __strip_zeros
+sub _from_hex
{
- # internal normalization function that strips leading zeros from the array
- # args: ref to array
- my $s = shift;
-
- my $cnt = scalar @$s; # get count of parts
- my $i = $cnt-1;
- #print "strip: cnt $cnt i $i\n";
- # '0', '3', '4', '0', '0',
- # 0 1 2 3 4
- # cnt = 5, i = 4
- # i = 4
- # i = 3
- # => fcnt = cnt - i (5-2 => 3, cnt => 5-1 = 4, throw away from 4th pos)
- # >= 1: skip first part (this can be zero)
- while ($i > 0) { last if $s->[$i] != 0; $i--; }
- $i++; splice @$s,$i if ($i < $cnt); # $i cant be 0
- return $s;
- }
+ # convert a hex number to decimal (ref to string, return ref to array)
+ my ($c,$hs) = @_;
-###############################################################################
-# check routine to test internal state of corruptions
+ my $mul = _one();
+ my $m = [ 0x10000 ]; # 16 bit at a time
+ my $x = _zero();
-sub _check
+ my $len = CORE::length($$hs)-2;
+ $len = int($len/4); # 4-digit parts, w/o '0x'
+ my $val; my $i = -4;
+ while ($len >= 0)
+ {
+ $val = substr($$hs,$i,4);
+ $val =~ s/^[+-]?0x// if $len == 0; # for last part only because
+ $val = hex($val); # hex does not like wrong chars
+ $i -= 4; $len --;
+ _add ($c, $x, _mul ($c, [ $val ], $mul ) ) if $val != 0;
+ _mul ($c, $mul, $m ) if $len >= 0; # skip last mul
+ }
+ $x;
+ }
+
+sub _from_bin
{
- # used by the test suite
- my $x = $_[1];
+ # convert a hex number to decimal (ref to string, return ref to array)
+ my ($c,$bs) = @_;
- return "$x is not a reference" if !ref($x);
+ my $mul = _one();
+ my $m = [ 0x100 ]; # 8 bit at a time
+ my $x = _zero();
- # are all parts are valid?
- my $i = 0; my $j = scalar @$x; my ($e,$try);
- while ($i < $j)
+ my $len = CORE::length($$bs)-2;
+ $len = int($len/8); # 4-digit parts, w/o '0x'
+ my $val; my $i = -8;
+ while ($len >= 0)
{
- $e = $x->[$i]; $e = 'undef' unless defined $e;
- $try = '=~ /^[\+]?[0-9]+\$/; '."($x, $e)";
- last if $e !~ /^[+]?[0-9]+$/;
- $try = '=~ /^[\+]?[0-9]+\$/; '."($x, $e) (stringify)";
- last if "$e" !~ /^[+]?[0-9]+$/;
- $try = '=~ /^[\+]?[0-9]+\$/; '."($x, $e) (cat-stringify)";
- last if '' . "$e" !~ /^[+]?[0-9]+$/;
- $try = ' < 0 || >= $BASE; '."($x, $e)";
- last if $e <0 || $e >= $BASE;
- # this test is disabled, since new/bnorm and certain ops (like early out
- # in add/sub) are allowed/expected to leave '00000' in some elements
- #$try = '=~ /^00+/; '."($x, $e)";
- #last if $e =~ /^00+/;
- $i++;
+ $val = substr($$bs,$i,8);
+ $val =~ s/^[+-]?0b// if $len == 0; # for last part only
+
+ #$val = oct('0b'.$val); # does not work on Perl prior to 5.6.0
+ # $val = ('0' x (8-CORE::length($val))).$val if CORE::length($val) < 8;
+ $val = ord(pack('B8',substr('00000000'.$val,-8,8)));
+
+ $i -= 8; $len --;
+ _add ($c, $x, _mul ($c, [ $val ], $mul ) ) if $val != 0;
+ _mul ($c, $mul, $m ) if $len >= 0; # skip last mul
}
- return "Illegal part '$e' at pos $i (tested: $try)" if $i < $j;
- return 0;
+ $x;
}
+##############################################################################
+##############################################################################
+
1;
__END__
@@ -939,7 +1225,7 @@ slow) fallback routines to emulate these:
_or(obj1,obj2) OR (bit-wise) object 1 with object 2
_mod(obj,obj) Return remainder of div of the 1st by the 2nd object
- _sqrt(obj) return the square root of object
+ _sqrt(obj) return the square root of object (truncate to int)
_pow(obj,obj) return object 1 to the power of object 2
_gcd(obj,obj) return Greatest Common Divisor of two objects
diff --git a/lib/Math/BigInt/t/bare_mbi.t b/lib/Math/BigInt/t/bare_mbi.t
new file mode 100644
index 0000000000..03aed4684d
--- /dev/null
+++ b/lib/Math/BigInt/t/bare_mbi.t
@@ -0,0 +1,42 @@
+#!/usr/bin/perl -w
+
+use Test;
+use strict;
+
+BEGIN
+ {
+ $| = 1;
+ # to locate the testing files
+ my $location = $0; $location =~ s/bare_mbi.t//i;
+ print "loc $location\n";
+ if ($ENV{PERL_CORE})
+ {
+ # testing with the core distribution
+ @INC = qw(../t/lib);
+ }
+ unshift @INC, qw(../lib); # to locate the modules
+ if (-d 't')
+ {
+ chdir 't';
+ require File::Spec;
+ unshift @INC, File::Spec->catdir(File::Spec->updir, $location);
+ }
+ else
+ {
+ unshift @INC, $location;
+ }
+ print "# INC = @INC\n";
+
+ plan tests => 1865;
+ }
+
+use Math::BigInt lib => 'BareCalc';
+
+use vars qw ($class $try $x $y $f @args $ans $ans1 $ans1_str $setup $CL);
+$class = "Math::BigInt";
+$CL = "Math::BigInt::BareCalc";
+
+my $version = '1.48'; # for $VERSION tests, match current release (by hand!)
+
+require 'bigintpm.inc'; # perform same tests as bigintpm
+
diff --git a/lib/Math/BigInt/t/bigfltpm.inc b/lib/Math/BigInt/t/bigfltpm.inc
index 7844e729ea..b61af2a5fc 100644
--- a/lib/Math/BigInt/t/bigfltpm.inc
+++ b/lib/Math/BigInt/t/bigfltpm.inc
@@ -54,7 +54,7 @@ while (<DATA>)
$try .= "\$x->length();";
# some unary ops (test the bxxx form, since that is done by AUTOLOAD)
} elsif ($f =~ /^f(nan|sstr|neg|floor|ceil|abs)$/) {
- $try .= "\$x->b$1();";
+ $try .= "\$x->f$1();";
# some is_xxx test function
} elsif ($f =~ /^is_(zero|one|negative|positive|odd|even|nan)$/) {
$try .= "\$x->$f();";
@@ -88,6 +88,10 @@ while (<DATA>)
$try .= '$x * $y;';
} elsif ($f eq "fdiv") {
$try .= "$setup; \$x / \$y;";
+ } elsif ($f eq "frsft") {
+ $try .= '$x >> $y;';
+ } elsif ($f eq "flsft") {
+ $try .= '$x << $y;';
} elsif ($f eq "fmod") {
$try .= '$x % $y;';
} else { warn "Unknown op '$f'"; }
@@ -128,7 +132,8 @@ while (<DATA>)
}
} # end while
-# check whether new() for BigInts destroys them ($y == 12 in this case)
+# check whether $class->new( Math::BigInt->new()) destroys it
+# ($y == 12 in this case)
$x = Math::BigInt->new(1200); $y = $class->new($x);
ok ($y,1200); ok ($x,1200);
@@ -141,7 +146,12 @@ ok ($x,'NaN'); ok ($y,'NaN');
$x = $class->bzero(); ($x,$y) = $x->fdiv(1);
ok ($x,0); ok ($y,0);
-# all done
+$x = $class->new(2); $x->fzero(); ok_undef ($x->{_a}); ok_undef ($x->{_p});
+$x = $class->new(2); $x->finf(); ok_undef ($x->{_a}); ok_undef ($x->{_p});
+$x = $class->new(2); $x->fone(); ok_undef ($x->{_a}); ok_undef ($x->{_p});
+$x = $class->new(2); $x->fnan(); ok_undef ($x->{_a}); ok_undef ($x->{_p});
+
+1; # all done
###############################################################################
# Perl 5.005 does not like ok ($x,undef)
@@ -155,6 +165,21 @@ sub ok_undef
}
__DATA__
+&frsft
+#NaNfrsft:NaN
+0:2:0
+1:1:0.5
+2:1:1
+4:1:2
+123:1:61.5
+32:3:4
+&flsft
+#NaNflsft:NaN
+2:1:4
+4:3:32
+5:3:40
+1:2:4
+0:5:0
&fnorm
1:1
-0:0
@@ -867,6 +892,7 @@ abc:+1:abc:NaN
+106500000:+339:314159.2920353982300884955752212389380531
+1000000000:+3:333333333.3333333333333333333333333333333
2:25.024996000799840031993601279744051189762:0.07992009269196593320152084692285869265447
+123456:1:123456
$div_scale = 20
+1000000000:+9:111111111.11111111111
+2000000000:+9:222222222.22222222222
@@ -883,6 +909,7 @@ $div_scale = 20
1:10000:0.0001
1:504:0.001984126984126984127
2:1.987654321:1.0062111801179738436
+123456789.123456789123456789123456789:1:123456789.12345678912
# the next two cases are the "old" behaviour, but are now (>v0.01) different
#+35500000:+113:314159.292035398230088
#+71000000:+226:314159.292035398230088
@@ -893,6 +920,7 @@ $div_scale = 20
$div_scale = 1
# round to accuracy 1 after bdiv
+124:+3:40
+123456789.1234:1:100000000
# reset scale for further tests
$div_scale = 40
&fmod
@@ -913,14 +941,18 @@ $div_scale = 40
nanfsqrt:NaN
+inf:inf
-inf:NaN
-+1:1
-+2:1.41421356237309504880168872420969807857
-+4:2
-+16:4
-+100:10
-+123.456:11.11107555549866648462149404118219234119
-+15241.38393:123.4559999756998444766131352122991626468
-+1.44:1.2
+1:1
+2:1.41421356237309504880168872420969807857
+4:2
+9:3
+16:4
+100:10
+123.456:11.11107555549866648462149404118219234119
+15241.38393:123.4559999756998444766131352122991626468
+1.44:1.2
+# sqrt(1.44) = 1.2, sqrt(e10) = e5 => 12e4
+1.44E10:120000
+2e10:141421.356237309504880168872420969807857
&is_nan
123:0
abc:1
diff --git a/lib/Math/BigInt/t/bigfltpm.t b/lib/Math/BigInt/t/bigfltpm.t
index 5fe1917625..c31d7f1877 100755
--- a/lib/Math/BigInt/t/bigfltpm.t
+++ b/lib/Math/BigInt/t/bigfltpm.t
@@ -31,7 +31,7 @@ BEGIN
# unshift @INC, $location; # to locate the testing files
# # chdir 't' if -d 't';
- plan tests => 1325;
+ plan tests => 1367;
}
use Math::BigInt;
diff --git a/lib/Math/BigInt/t/bigintc.t b/lib/Math/BigInt/t/bigintc.t
index 87006b044a..05b5fccdfc 100644
--- a/lib/Math/BigInt/t/bigintc.t
+++ b/lib/Math/BigInt/t/bigintc.t
@@ -8,7 +8,7 @@ BEGIN
$| = 1;
chdir 't' if -d 't';
unshift @INC, '../lib'; # for running manually
- plan tests => 56;
+ plan tests => 63;
}
# testing of Math::BigInt::Calc, primarily for interface/api and not for the
@@ -128,6 +128,24 @@ $x = $C->_new(\$x); $C->_dec($x); ok (${$C->_str($x)},$z);
# should not happen:
# $x = $C->_new(\"-2"); $y = $C->_new(\"4"); ok ($C->_acmp($x,$y),-1);
+# _mod
+$x = $C->_new(\"1000"); $y = $C->_new(\"3");
+ok (${$C->_str(scalar $C->_mod($x,$y))},1);
+$x = $C->_new(\"1000"); $y = $C->_new(\"2");
+ok (${$C->_str(scalar $C->_mod($x,$y))},0);
+
+# _and, _or, _xor
+$x = $C->_new(\"5"); $y = $C->_new(\"2");
+ok (${$C->_str(scalar $C->_xor($x,$y))},7);
+$x = $C->_new(\"5"); $y = $C->_new(\"2");
+ok (${$C->_str(scalar $C->_or($x,$y))},7);
+$x = $C->_new(\"5"); $y = $C->_new(\"3");
+ok (${$C->_str(scalar $C->_and($x,$y))},1);
+
+# _from_hex, _from_bin
+ok (${$C->_str(scalar $C->_from_hex(\"0xFf"))},255);
+ok (${$C->_str(scalar $C->_from_bin(\"0b10101011"))},160+11);
+
# _check
$x = $C->_new(\"123456789");
ok ($C->_check($x),0);
diff --git a/lib/Math/BigInt/t/bigintpm.inc b/lib/Math/BigInt/t/bigintpm.inc
index e85c5c3f3a..ad55d68ff5 100644
--- a/lib/Math/BigInt/t/bigintpm.inc
+++ b/lib/Math/BigInt/t/bigintpm.inc
@@ -35,7 +35,7 @@ sub _swap
##############################################################################
package main;
-my $CALC = $class->_core_lib(); ok ($CALC,'Math::BigInt::Calc');
+my $CALC = $class->_core_lib(); ok ($CALC,$CL);
my ($f,$z,$a,$exp,@a,$m,$e,$round_mode);
@@ -165,9 +165,16 @@ while (<DATA>)
$try = "\$x = $class->new(\"$args[0]\"); \$x->digit($args[1]);";
} else { warn "Unknown op '$f'"; }
}
- # print "trying $try\n";
+ # print "trying $try\n";
$ans1 = eval $try;
- $ans =~ s/^[+]([0-9])/$1/; # remove leading '+'
+ # remove leading '+' from target
+ $ans =~ s/^[+]([0-9])/$1/;
+ # convert hex/binary targets to decimal
+ if ($ans =~ /^(0x0x|0b0b)/)
+ {
+ $ans =~ s/^0[xb]//;
+ $ans = Math::BigInt->new($ans)->bstr();
+ }
if ($ans eq "")
{
ok_undef ($ans1);
@@ -399,14 +406,14 @@ $x = $class->new('+inf'); ok ($x,'inf');
###############################################################################
###############################################################################
-# the followin tests only make sense with Math::BigInt::Calc
+# the followin tests only make sense with Math::BigInt::Calc or BareCalc
-exit if $CALC ne 'Math::BigInt::Calc'; # for Pari et al.
+exit if $CALC !~ /^Math::BigInt::(Calc|BareCalc)$/; # for Pari et al.
###############################################################################
# check proper length of internal arrays
-my $bl = Math::BigInt::Calc::_base_len();
+my $bl = $CL->_base_len();
my $BASE = '9' x $bl;
my $MAX = $BASE;
$BASE++;
@@ -428,18 +435,19 @@ ok($x->numify(),-($BASE*$BASE*1+$BASE*1+1));
###############################################################################
# test bug in _digits with length($c[-1]) where $c[-1] was "00001" instead of 1
-$x = Math::BigInt->new(99998); $x++; $x++; $x++; $x++;
-if ($x > 100000) { ok (1,1) } else { ok ("$x < 100000","$x > 100000"); }
+$x = $class->new($BASE-2); $x++; $x++; $x++; $x++;
+if ($x > $BASE) { ok (1,1) } else { ok ("$x < $BASE","$x > $BASE"); }
+
+$x = $class->new($BASE+3); $x++;
+if ($x > $BASE) { ok (1,1) } else { ok ("$x > $BASE","$x < $BASE"); }
-$x = Math::BigInt->new(100003); $x++;
-$y = Math::BigInt->new(1000000);
-if ($x < 1000000) { ok (1,1) } else { ok ("$x > 1000000","$x < 1000000"); }
+# test for +0 instead of int():
+$x = $class->new($MAX); ok ($x->length(), length($MAX));
###############################################################################
# bug in sub where number with at least 6 trailing zeros after any op failed
-$x = Math::BigInt->new(123456); $z = Math::BigInt->new(10000); $z *= 10;
-$x -= $z;
+$x = $class->new(123456); $z = $class->new(10000); $z *= 10; $x -= $z;
ok ($z, 100000);
ok ($x, 23456);
@@ -449,7 +457,7 @@ ok ($x, 23456);
# construct a number with a zero-hole of BASE_LEN
$x = '1' x $bl . '0' x $bl . '1' x $bl . '0' x $bl;
$y = '1' x (2*$bl);
-$x = Math::BigInt->new($x)->bmul($y);
+$x = $class->new($x)->bmul($y);
# result is 123..$bl . $bl x (3*bl-1) . $bl...321 . '0' x $bl
$y = ''; my $d = '';
for (my $i = 1; $i <= $bl; $i++)
@@ -460,13 +468,34 @@ $y .= $bl x (3*$bl-1) . $d . '0' x $bl;
ok ($x,$y);
###############################################################################
+# see if mul shortcut for small numbers works
+
+$x = '9' x $bl;
+$x = $class->new($x);
+# 999 * 999 => 998 . 001, 9999*9999 => 9998 . 0001
+ok ($x*$x, '9' x ($bl-1) . '8' . '0' x ($bl-1) . '1');
+
+###############################################################################
# bug with rest "-0" in div, causing further div()s to fail
-$x = Math::BigInt->new('-322056000'); ($x,$y) = $x->bdiv('-12882240');
+$x = $class->new('-322056000'); ($x,$y) = $x->bdiv('-12882240');
ok ($y,'0','not -0'); # not '-0'
is_valid($y);
+###############################################################################
+# test whether bone/bzero take additional A & P, or reset it etc
+
+$x = $class->new(2); $x->bzero(); ok_undef ($x->{_a}); ok_undef ($x->{_p});
+$x = $class->new(2); $x->binf(); ok_undef ($x->{_a}); ok_undef ($x->{_p});
+$x = $class->new(2); $x->bone(); ok_undef ($x->{_a}); ok_undef ($x->{_p});
+$x = $class->new(2); $x->bnan(); ok_undef ($x->{_a}); ok_undef ($x->{_p});
+
+$x = $class->new(2); $x->{_a} = 1; $x->{_p} = 2; $x->bnan();
+ok_undef ($x->{_a}); ok_undef ($x->{_p});
+$x = $class->new(2); $x->{_a} = 1; $x->{_p} = 2; $x->binf();
+ok_undef ($x->{_a}); ok_undef ($x->{_p});
+
### all tests done ############################################################
1;
@@ -610,6 +639,7 @@ NaN:-inf:
0b1000000000000000000000000000000:1073741824
0b_101:NaN
0b1_0_1:5
+0b0_0_0_1:1
# hex input
-0x0:0
0xabcdefgh:NaN
@@ -619,6 +649,7 @@ NaN:-inf:
-0x1234:-4660
0x12345678:305419896
0x1_2_3_4_56_78:305419896
+0xa_b_c_d_e_f:11259375
0x_123:NaN
# inf input
inf:inf
@@ -1218,6 +1249,23 @@ abc:0:NaN
-7:-4:-8
-7:4:0
-4:7:4
+# equal arguments are treated special, so also do some test with unequal ones
+0xFFFF:0xFFFF:0x0xFFFF
+0xFFFFFF:0xFFFFFF:0x0xFFFFFF
+0xFFFFFFFF:0xFFFFFFFF:0x0xFFFFFFFF
+0xFFFFFFFFFF:0xFFFFFFFFFF:0x0xFFFFFFFFFF
+0xFFFFFFFFFFFF:0xFFFFFFFFFFFF:0x0xFFFFFFFFFFFF
+0xF0F0:0xF0F0:0x0xF0F0
+0x0F0F:0x0F0F:0x0x0F0F
+0xF0F0F0:0xF0F0F0:0x0xF0F0F0
+0x0F0F0F:0x0F0F0F:0x0x0F0F0F
+0xF0F0F0F0:0xF0F0F0F0:0x0xF0F0F0F0
+0x0F0F0F0F:0x0F0F0F0F:0x0x0F0F0F0F
+0xF0F0F0F0F0:0xF0F0F0F0F0:0x0xF0F0F0F0F0
+0x0F0F0F0F0F:0x0F0F0F0F0F:0x0x0F0F0F0F0F
+0xF0F0F0F0F0F0:0xF0F0F0F0F0F0:0x0xF0F0F0F0F0F0
+0x0F0F0F0F0F0F:0x0F0F0F0F0F0F:0x0x0F0F0F0F0F0F
+0x1F0F0F0F0F0F:0x3F0F0F0F0F0F:0x0x1F0F0F0F0F0F
&bior
abc:abc:NaN
abc:0:NaN
@@ -1232,6 +1280,38 @@ abc:0:NaN
-6:-6:-6
-7:4:-3
-4:7:-1
+# equal arguments are treated special, so also do some test with unequal ones
+0xFFFF:0xFFFF:0x0xFFFF
+0xFFFFFF:0xFFFFFF:0x0xFFFFFF
+0xFFFFFFFF:0xFFFFFFFF:0x0xFFFFFFFF
+0xFFFFFFFFFF:0xFFFFFFFFFF:0x0xFFFFFFFFFF
+0xFFFFFFFFFFFF:0xFFFFFFFFFFFF:0x0xFFFFFFFFFFFF
+0:0xFFFF:0x0xFFFF
+0:0xFFFFFF:0x0xFFFFFF
+0:0xFFFFFFFF:0x0xFFFFFFFF
+0:0xFFFFFFFFFF:0x0xFFFFFFFFFF
+0:0xFFFFFFFFFFFF:0x0xFFFFFFFFFFFF
+0xFFFF:0:0x0xFFFF
+0xFFFFFF:0:0x0xFFFFFF
+0xFFFFFFFF:0:0x0xFFFFFFFF
+0xFFFFFFFFFF:0:0x0xFFFFFFFFFF
+0xFFFFFFFFFFFF:0:0x0xFFFFFFFFFFFF
+0xF0F0:0xF0F0:0x0xF0F0
+0x0F0F:0x0F0F:0x0x0F0F
+0xF0F0:0x0F0F:0x0xFFFF
+0xF0F0F0:0xF0F0F0:0x0xF0F0F0
+0x0F0F0F:0x0F0F0F:0x0x0F0F0F
+0x0F0F0F:0xF0F0F0:0x0xFFFFFF
+0xF0F0F0F0:0xF0F0F0F0:0x0xF0F0F0F0
+0x0F0F0F0F:0x0F0F0F0F:0x0x0F0F0F0F
+0x0F0F0F0F:0xF0F0F0F0:0x0xFFFFFFFF
+0xF0F0F0F0F0:0xF0F0F0F0F0:0x0xF0F0F0F0F0
+0x0F0F0F0F0F:0x0F0F0F0F0F:0x0x0F0F0F0F0F
+0x0F0F0F0F0F:0xF0F0F0F0F0:0x0xFFFFFFFFFF
+0xF0F0F0F0F0F0:0xF0F0F0F0F0F0:0x0xF0F0F0F0F0F0
+0x0F0F0F0F0F0F:0x0F0F0F0F0F0F:0x0x0F0F0F0F0F0F
+0x0F0F0F0F0F0F:0xF0F0F0F0F0F0:0x0xFFFFFFFFFFFF
+0x1F0F0F0F0F0F:0xF0F0F0F0F0F0:0x0xFFFFFFFFFFFF
&bxor
abc:abc:NaN
abc:0:NaN
@@ -1248,6 +1328,37 @@ abc:0:NaN
-4:7:-5
4:-7:-3
-4:-7:5
+# equal arguments are treated special, so also do some test with unequal ones
+0xFFFF:0xFFFF:0
+0xFFFFFF:0xFFFFFF:0
+0xFFFFFFFF:0xFFFFFFFF:0
+0xFFFFFFFFFF:0xFFFFFFFFFF:0
+0xFFFFFFFFFFFF:0xFFFFFFFFFFFF:0
+0:0xFFFF:0x0xFFFF
+0:0xFFFFFF:0x0xFFFFFF
+0:0xFFFFFFFF:0x0xFFFFFFFF
+0:0xFFFFFFFFFF:0x0xFFFFFFFFFF
+0:0xFFFFFFFFFFFF:0x0xFFFFFFFFFFFF
+0xFFFF:0:0x0xFFFF
+0xFFFFFF:0:0x0xFFFFFF
+0xFFFFFFFF:0:0x0xFFFFFFFF
+0xFFFFFFFFFF:0:0x0xFFFFFFFFFF
+0xFFFFFFFFFFFF:0:0x0xFFFFFFFFFFFF
+0xF0F0:0xF0F0:0
+0x0F0F:0x0F0F:0
+0xF0F0:0x0F0F:0x0xFFFF
+0xF0F0F0:0xF0F0F0:0
+0x0F0F0F:0x0F0F0F:0
+0x0F0F0F:0xF0F0F0:0x0xFFFFFF
+0xF0F0F0F0:0xF0F0F0F0:0
+0x0F0F0F0F:0x0F0F0F0F:0
+0x0F0F0F0F:0xF0F0F0F0:0x0xFFFFFFFF
+0xF0F0F0F0F0:0xF0F0F0F0F0:0
+0x0F0F0F0F0F:0x0F0F0F0F0F:0
+0x0F0F0F0F0F:0xF0F0F0F0F0:0x0xFFFFFFFFFF
+0xF0F0F0F0F0F0:0xF0F0F0F0F0F0:0
+0x0F0F0F0F0F0F:0x0F0F0F0F0F0F:0
+0x0F0F0F0F0F0F:0xF0F0F0F0F0F0:0x0xFFFFFFFFFFFF
&bnot
abc:NaN
+0:-1
@@ -1367,18 +1478,30 @@ abc:12:NaN
-123:3
215960156869840440586892398248:30
&bsqrt
+145:12
144:12
+143:11
16:4
+170:13
+169:13
+168:12
4:2
+3:1
2:1
+9:3
12:3
256:16
100000000:10000
4000000000000:2000000
+152399026:12345
+152399025:12345
+152399024:12344
1:1
0:0
-2:NaN
+-123:NaN
Nan:NaN
++inf:NaN
&bround
$round_mode('trunc')
0:12:0
diff --git a/lib/Math/BigInt/t/bigintpm.t b/lib/Math/BigInt/t/bigintpm.t
index 70dc726eb6..d1fac731b3 100755
--- a/lib/Math/BigInt/t/bigintpm.t
+++ b/lib/Math/BigInt/t/bigintpm.t
@@ -10,12 +10,13 @@ BEGIN
my $location = $0; $location =~ s/bigintpm.t//;
unshift @INC, $location; # to locate the testing files
chdir 't' if -d 't';
- plan tests => 1669;
+ plan tests => 1865;
}
use Math::BigInt;
-use vars qw ($scale $class $try $x $y $f @args $ans $ans1 $ans1_str $setup);
+use vars qw ($scale $class $try $x $y $f @args $ans $ans1 $ans1_str $setup $CL);
$class = "Math::BigInt";
+$CL = "Math::BigInt::Calc";
require 'bigintpm.inc'; # all tests here for sharing
diff --git a/lib/Math/BigInt/t/sub_mbf.t b/lib/Math/BigInt/t/sub_mbf.t
index e903ac2540..937a9c66dc 100755
--- a/lib/Math/BigInt/t/sub_mbf.t
+++ b/lib/Math/BigInt/t/sub_mbf.t
@@ -26,7 +26,7 @@ BEGIN
}
print "# INC = @INC\n";
- plan tests => 1325 + 4; # + 4 own tests
+ plan tests => 1367 + 4; # + 4 own tests
}
use Math::BigFloat::Subclass;
diff --git a/lib/Math/BigInt/t/sub_mbi.t b/lib/Math/BigInt/t/sub_mbi.t
index e387f89b37..779416c30b 100755
--- a/lib/Math/BigInt/t/sub_mbi.t
+++ b/lib/Math/BigInt/t/sub_mbi.t
@@ -26,17 +26,19 @@ BEGIN
}
print "# INC = @INC\n";
- plan tests => 1669 + 4; # +4 own tests
+ plan tests => 1865
+ + 4; # +4 own tests
}
use Math::BigInt::Subclass;
-use vars qw ($class $try $x $y $f @args $ans $ans1 $ans1_str $setup);
+use vars qw ($class $try $x $y $f @args $ans $ans1 $ans1_str $setup $CL);
$class = "Math::BigInt::Subclass";
+$CL = "Math::BigInt::Calc";
-my $version = '0.01'; # for $VERSION tests, match current release (by hand!)
+my $version = '0.02'; # for $VERSION tests, match current release (by hand!)
-require 'bigintpm.inc'; # perform same tests as bigfltpm
+require 'bigintpm.inc'; # perform same tests as bigintpm
# Now do custom tests for Subclass itself
my $ms = $class->new(23);
diff --git a/lib/Net/Ping.pm b/lib/Net/Ping.pm
index c963a07afd..d78a14fbe8 100644
--- a/lib/Net/Ping.pm
+++ b/lib/Net/Ping.pm
@@ -1,36 +1,29 @@
package Net::Ping;
-# Current maintainer: colinm@cpan.org (Colin McMillen)
-# stream protocol: bronson@trestle.com (Scott Bronson)
-#
-# Original author: mose@ccsn.edu (Russell Mosemann)
-#
-# Authors of the original pingecho():
-# karrer@bernina.ethz.ch (Andreas Karrer)
-# Paul.Marquess@btinternet.com (Paul Marquess)
-#
-# Copyright (c) 2001, Colin McMillen. All rights reserved. This
-# program is free software; you may redistribute it and/or modify it
-# under the same terms as Perl itself.
-use 5.006_001;
+# $Id: Ping.pm,v 1.11 2001/12/04 02:41:51 rob Exp $
+
+require 5.002;
require Exporter;
use strict;
-our(@ISA, @EXPORT, $VERSION, $def_timeout, $def_proto, $max_datasize);
+use vars qw(@ISA @EXPORT $VERSION
+ $def_timeout $def_proto $max_datasize $pingstring);
use FileHandle;
use Socket qw( SOCK_DGRAM SOCK_STREAM SOCK_RAW PF_INET
- inet_aton inet_ntoa sockaddr_in );
+ inet_aton sockaddr_in );
use Carp;
@ISA = qw(Exporter);
@EXPORT = qw(pingecho);
-$VERSION = 2.04;
+$VERSION = 2.07;
# Constants
$def_timeout = 5; # Default timeout to wait for a reply
$def_proto = "udp"; # Default protocol to use for pinging
$max_datasize = 1024; # Maximum data bytes in a packet
+# The data we exchange with the server for the stream protocol
+$pingstring = "pingschwingping!\n";
# Description: The pingecho() subroutine is provided for backward
# compatibility with the original Net::Ping. It accepts a host
@@ -130,7 +123,7 @@ sub new
# Description: Ping a host name or IP number with an optional timeout.
# First lookup the host, and return undef if it is not found. Otherwise
-# perform the specific ping method based on the protocol. Return the
+# perform the specific ping method based on the protocol. Return the
# result of the ping.
sub ping
@@ -167,8 +160,8 @@ sub ping_external {
$timeout # Seconds after which ping times out
) = @_;
- eval { require Net::Ping::External; };
- croak('Protocol "external" not supported on your system: Net::Ping::External not found') if $@;
+ eval { require Net::Ping::External; }
+ or croak('Protocol "external" not supported on your system: Net::Ping::External not found');
return Net::Ping::External::ping(ip => $ip, timeout => $timeout);
}
@@ -285,204 +278,187 @@ sub checksum
return(~(($chk >> 16) + $chk) & 0xffff); # Again and complement
}
-# Warning: this method may generate false positives.
-# It is meant to be a private method and should only
-# be invoked by ping_tcp() if $^O =~ /win32/i.
-sub _ping_tcp_win
+# Description: Perform a tcp echo ping. Since a tcp connection is
+# host specific, we have to open and close each connection here. We
+# can't just leave a socket open. Because of the robust nature of
+# tcp, it will take a while before it gives up trying to establish a
+# connection. Therefore, we use select() on a non-blocking socket to
+# check against our timeout. No data bytes are actually
+# sent since the successful establishment of a connection is proof
+# enough of the reachability of the remote host. Also, tcp is
+# expensive and doesn't need our help to add to the overhead.
+
+sub ping_tcp
{
my ($self,
$ip, # Packed IP number of the host
+ $timeout # Seconds after which ping times out
) = @_;
- my ($saddr, # sockaddr_in with port and ip
- $ret # The return value
+ my ($ret # The return value
);
- socket($self->{"fh"}, &PF_INET(), &SOCK_STREAM(), $self->{"proto_num"}) ||
- croak("tcp socket error - $!");
-
- $saddr = sockaddr_in($self->{"port_num"}, $ip);
-
- $ret = 0; # Default to unreachable
-
- eval { $ret = connect($self->{"fh"}, $saddr) };
-
- # If the remote host exists but returns "Connection refused",
- # the call to connect() sets $! to "Unknown error". So, we
- # assume that an "Unknown error" actually means the host is
- # alive. This assumption may occassionally give false positives.
- $ret = 1 if $! =~ /Unknown error/i;
-
+ $@ = "";
+ $ret = $self -> tcp_connect( $ip, $timeout);
+ $ret = 1 if $@ =~ /(Connection Refused|Unknown Error)/i;
$self->{"fh"}->close();
- return $ret;
+ return($ret);
}
-# Buggy Winsock API doesn't allow us to use non-blocking connect()
-# calls. Hence, if our OS is Windows, we need to create a new process
-# to run a blocking connect attempt, and kill it after the timeout has
-# passed. Unfortunately, this won't work with the stream protocol.
-
-sub ping_tcp_win32
+sub tcp_connect
{
my ($self,
$ip, # Packed IP number of the host
- $timeout # Seconds after which open times out
+ $timeout # Seconds after which connect times out
) = @_;
+ my ($saddr); # Packed IP and Port
- socket($self->{"fh"}, &PF_INET(), &SOCK_STREAM(), $self->{"proto_num"}) ||
- croak("tcp socket error - $!");
-
- my $saddr = sockaddr_in($self->{"port_num"}, $ip);
-
- my ($child, $ret, $pid, $time);
- my $host = inet_ntoa($ip);
-
- # The code we will be executing in our new process.
- my $code = '"use Net::Ping; $p = Net::Ping->new(\'tcp\'); ';
- $code .= 'exit($p->_ping_tcp_win(' . $host . '))"';
-
- # Call the process.
- $pid = system(1, "perl", "-e", $code);
-
- # Import the POSIX version of <sys/wait.h>
- require POSIX;
- import POSIX qw(:sys_wait_h);
-
- # Get the current time; will be used to tell if we've timed out.
- $time = time;
+ $saddr = sockaddr_in($self->{"port_num"}, $ip);
- # Wait for the child to return or for the timeout to expire.
- do {
- $child = waitpid($pid, &WNOHANG());
- $ret = $?;
- } until time > ($time + $timeout) or $child;
+ my $ret = 0; # Default to unreachable
- # Return an appropriate value; 0 if the child didn't return,
- # the return value of the child otherwise.
- return $ret >> 8 if $child;
+ my $do_socket = sub {
+ socket($self->{"fh"}, &PF_INET(), &SOCK_STREAM(), $self->{"proto_num"}) ||
+ croak("tcp socket error - $!");
+ };
+ my $do_connect = sub {
+ eval {
+ die $! unless connect($self->{"fh"}, $saddr);
+ $self->{"ip"} = $ip;
+ $ret = 1;
+ };
+ $ret;
+ };
+
+ if ($^O =~ /Win32/i) {
+
+ # Buggy Winsock API doesn't allow us to use alarm() calls.
+ # Hence, if our OS is Windows, we need to create a separate
+ # process to do the blocking connect attempt.
+
+ $| = 1; # Clear buffer prior to fork to prevent duplicate flushing.
+ my $pid = fork;
+ if (!$pid) {
+ if (!defined $pid) {
+ # Fork did not work
+ warn "Win32 Fork error: $!";
+ return 0;
+ }
+ &{ $do_socket }();
+
+ # Try a slow blocking connect() call
+ # and report the status to the pipe.
+ if ( &{ $do_connect }() ) {
+ $self->{"fh"}->close();
+ # No error
+ exit 0;
+ } else {
+ # Pass the error status to the parent
+ exit $!;
+ }
+ }
+
+ &{ $do_socket }();
+
+ my $patience = time + $timeout;
+
+ require POSIX;
+ my ($child);
+ $? = 0;
+ # Wait up to the timeout
+ # And clean off the zombie
+ do {
+ $child = waitpid($pid, &POSIX::WNOHANG);
+ $! = $? >> 8;
+ $@ = $!;
+ sleep 1;
+ } while time < $patience && $child != $pid;
+
+ if ($child == $pid) {
+ # Since she finished within the timeout,
+ # it is probably safe for me to try it too
+ &{ $do_connect }();
+ } else {
+ # Time must have run out.
+ $@ = "Timed out!";
+ # Put that choking client out of its misery
+ kill "KILL", $pid;
+ # Clean off the zombie
+ waitpid($pid, 0);
+ $ret = 0;
+ }
+ } else { # Win32
+ # Otherwise don't waste the resources to fork
+
+ &{ $do_socket }();
+
+ $SIG{'ALRM'} = sub { die "Timed out!"; };
+ alarm($timeout); # Interrupt connect() if we have to
+
+ &{ $do_connect }();
+ alarm(0);
+ }
- kill $pid;
- return 0;
+ return $ret;
}
# This writes the given string to the socket and then reads it
# back. It returns 1 on success, 0 on failure.
sub tcp_echo
{
- my $self = shift;
- my $timeout = shift;
- my $pingstring = shift;
+ my $self = shift;
+ my $timeout = shift;
+ my $pingstring = shift;
- my $ret = undef;
- my $time = time;
- my $wrstr = $pingstring;
- my $rdstr = "";
+ my $ret = undef;
+ my $time = time;
+ my $wrstr = $pingstring;
+ my $rdstr = "";
eval <<'EOM';
- do {
- my $rin = "";
- vec($rin, $self->{"fh"}->fileno(), 1) = 1;
-
- my $rout = undef;
- if($wrstr) {
- $rout = "";
- vec($rout, $self->{"fh"}->fileno(), 1) = 1;
- }
-
- if(select($rin, $rout, undef, ($time + $timeout) - time())) {
-
- if($rout && vec($rout,$self->{"fh"}->fileno(),1)) {
- my $num = syswrite($self->{"fh"}, $wrstr);
- if($num) {
- # If it was a partial write, update and try again.
- $wrstr = substr($wrstr,$num);
- } else {
- # There was an error.
- $ret = 0;
- }
- }
-
- if(vec($rin,$self->{"fh"}->fileno(),1)) {
- my $reply;
- if(sysread($self->{"fh"},$reply,length($pingstring)-length($rdstr))) {
- $rdstr .= $reply;
- $ret = 1 if $rdstr eq $pingstring;
- } else {
- # There was an error.
- $ret = 0;
- }
- }
-
- }
- } until time() > ($time + $timeout) || defined($ret);
+ do {
+ my $rin = "";
+ vec($rin, $self->{"fh"}->fileno(), 1) = 1;
+
+ my $rout = undef;
+ if($wrstr) {
+ $rout = "";
+ vec($rout, $self->{"fh"}->fileno(), 1) = 1;
+ }
+
+ if(select($rin, $rout, undef, ($time + $timeout) - time())) {
+
+ if($rout && vec($rout,$self->{"fh"}->fileno(),1)) {
+ my $num = syswrite($self->{"fh"}, $wrstr);
+ if($num) {
+ # If it was a partial write, update and try again.
+ $wrstr = substr($wrstr,$num);
+ } else {
+ # There was an error.
+ $ret = 0;
+ }
+ }
+
+ if(vec($rin,$self->{"fh"}->fileno(),1)) {
+ my $reply;
+ if(sysread($self->{"fh"},$reply,length($pingstring)-length($rdstr))) {
+ $rdstr .= $reply;
+ $ret = 1 if $rdstr eq $pingstring;
+ } else {
+ # There was an error.
+ $ret = 0;
+ }
+ }
+
+ }
+ } until time() > ($time + $timeout) || defined($ret);
EOM
- return $ret;
-}
-
-sub tcp_connect
-{
- my ($self,
- $ip, # Packed IP number of the host
- $timeout # Seconds after which open times out
- ) = @_;
-
- # Should we go back to using blocking IO and alarms to implement
- # the stream protocol on win32?
- croak "no nonblocking io -- can't stream ping on win32"
- if ($^O =~ /win32/i);
-
- $self->{"ip"} = $ip;
-
- socket($self->{"fh"}, &PF_INET(), &SOCK_STREAM(), $self->{"proto_num"}) ||
- croak("tcp socket error - $!");
-
- my $saddr = sockaddr_in($self->{"port_num"}, $ip);
- my $ret = 0;
-
- # Try a non-blocking TCP connect to the remote echo port.
- # Our call to select() below will stop after the timeout has
- # passed or set the return value to true if the connection
- # succeeds in time.
- $self->{"fh"}->blocking(0);
- connect($self->{"fh"}, $saddr);
-
- # This replaces the breakage where we were listening on a
- # socket that would never produce any data. This works, but
- # it's now quite a bit heavier than the old Net::Ping. I'd
- # like to see it reverted.
- return $self->tcp_echo($timeout, "ping!\n");
+ return $ret;
}
-# Description: Perform a tcp echo ping. Since a tcp connection is
-# host specific, we have to open and close each connection here. We
-# can't just leave a socket open. Because of the robust nature of
-# tcp, it will take a while before it gives up trying to establish a
-# connection. Therefore, we use select() on a non-blocking socket to
-# check against our timeout. No data bytes are actually
-# sent since the successful establishment of a connection is proof
-# enough of the reachability of the remote host. Also, tcp is
-# expensive and doesn't need our help to add to the overhead.
-
-sub ping_tcp
-{
- my ($self,
- $ip, # Packed IP number of the host
- $timeout # Seconds after which ping times out
- ) = @_;
- my $ret;
- # tcp_connect won't work on win32, so special-case it if need be.
- if ($^O =~ /win32/i) {
- $ret = $self->ping_tcp_win32($ip, $timeout);
- } else {
- $ret = $self->tcp_connect($ip, $timeout);
- $self->{"fh"}->close();
- }
-
- return $ret;
-}
# Description: Perform a stream ping. If the tcp connection isn't
# already open, it opens it. It then sends some data and waits for
@@ -495,8 +471,6 @@ sub ping_stream
$timeout # Seconds after which ping times out
) = @_;
- my $pingstring = "ping!\n"; # The data we exchange with the server
-
# Open the stream if it's not already open
if(!defined $self->{"fh"}->fileno()) {
$self->tcp_connect($ip, $timeout) or return 0;
@@ -505,7 +479,7 @@ sub ping_stream
croak "tried to switch servers while stream pinging"
if $self->{"ip"} ne $ip;
- return $self->tcp_echo($timeout, "pingschwingping!\n");
+ return $self->tcp_echo($timeout, $pingstring);
}
# Description: opens the stream. You would do this if you want to
@@ -513,22 +487,25 @@ sub ping_stream
sub open
{
- my ($self,
- $ip, # Packed IP number of the host
+ my ($self,
+ $host, # Host or IP address
$timeout # Seconds after which open times out
- ) = @_;
+ ) = @_;
- $timeout = $self->{"timeout"} unless $timeout;
+ my ($ip); # Packed IP number of the host
+ $ip = inet_aton($host);
+ $timeout = $self->{"timeout"} unless $timeout;
- if($self->{"proto"} eq "stream") {
- if(defined($self->{"fh"}->fileno())) {
- croak("socket is already open");
- } else {
- $self->tcp_connect($ip, $timeout);
- }
- }
+ if($self->{"proto"} eq "stream") {
+ if(defined($self->{"fh"}->fileno())) {
+ croak("socket is already open");
+ } else {
+ $self->tcp_connect($ip, $timeout);
+ }
+ }
}
+
# Description: Perform a udp echo ping. Construct a message of
# at least the one-byte sequence number and any additional data bytes.
# Send the message out and wait for a message to come back. If we
@@ -598,7 +575,7 @@ sub ping_udp
}
}
return($ret);
-}
+}
# Description: Close the connection unless we are using the tcp
# protocol, since it will already be closed.
@@ -618,6 +595,8 @@ __END__
Net::Ping - check a remote host for reachability
+$Id: Ping.pm,v 1.11 2001/12/04 02:41:51 rob Exp $
+
=head1 SYNOPSIS
use Net::Ping;
@@ -635,8 +614,10 @@ Net::Ping - check a remote host for reachability
sleep(1);
}
$p->close();
-
+
$p = Net::Ping->new("tcp", 2);
+ # Try connecting to the www port instead of the echo port
+ $p->{port_num} = getservbyname("http", "tcp");
while ($stop_time > time())
{
print "$host not reachable ", scalar(localtime()), "\n"
@@ -644,7 +625,7 @@ Net::Ping - check a remote host for reachability
sleep(300);
}
undef($p);
-
+
# For backward compatibility
print "$host is alive.\n" if pingecho($host);
@@ -655,64 +636,38 @@ hosts on a network. A ping object is first created with optional
parameters, a variable number of hosts may be pinged multiple
times and then the connection is closed.
-Ping supports five ping protocols, each with its own strengths
-and weaknesses. The "udp" protocol is the default. A host
-may be configured to respond to only a few of these protocols,
-or even none at all. For example, www.microsoft.com is generally
-alive but not pingable.
+You may choose one of four different protocols to use for the
+ping. The "udp" protocol is the default. Note that a live remote host
+may still fail to be pingable by one or more of these protocols. For
+example, www.microsoft.com is generally alive but not pingable.
-=over 4
-
-=item icmp
-
-The C<ping()> method sends an icmp echo message to the remote host
-(this is what the UNIX ping program does).
-If the echoed message is received from the remote host and
-the echoed information is correct, the remote host is considered
-reachable. Specifying this protocol requires that the program
-be run as root or that the program be setuid to root.
-
-=item udp
+With the "tcp" protocol the ping() method attempts to establish a
+connection to the remote host's echo port. If the connection is
+successfully established, the remote host is considered reachable. No
+data is actually echoed. This protocol does not require any special
+privileges but has higher overhead than the other two protocols.
-The C<ping()> method sends a udp
+Specifying the "udp" protocol causes the ping() method to send a udp
packet to the remote host's echo port. If the echoed packet is
received from the remote host and the received packet contains the
same data as the packet that was sent, the remote host is considered
reachable. This protocol does not require any special privileges.
-
-It should be borne in mind that, for both udp and tcp ping, a host
+It should be borne in mind that, for a udp ping, a host
will be reported as unreachable if it is not running the
-appropriate echo service. For Unix-like systems see L<inetd(8)> for
-more information.
+appropriate echo service. For Unix-like systems see L<inetd(8)>
+for more information.
-=item tcp
+If the "icmp" protocol is specified, the ping() method sends an icmp
+echo message to the remote host, which is what the UNIX ping program
+does. If the echoed message is received from the remote host and
+the echoed information is correct, the remote host is considered
+reachable. Specifying the "icmp" protocol requires that the program
+be run as root or that the program be setuid to root.
-The C<ping()> method attempts to establish a
-connection to the remote host's echo port. If the connection is
-successfully established, the remote host is considered reachable.
-Once the connection is made, it is torn down immediately -- no data
-is actually echoed. This protocol does not require any special
-privileges but has highest overhead of the protocols.
-
-=item stream
-
-This is just like the tcp protocol, except that once it establishes
-the tcp connection, it keeps it up. Each subsequent ping
-request re-uses the existing connection. stream
-provides better performance than tcp since the connection
-doesn't need to be created and torn down with every ping. It is
-also the only protocol that will recognize that the original host is
-gone, even if it is immediately replaced by an
-identical host responding in exactly the same way. The drawback
-is that you can only ping one host per Ping instance. You will get
-an error if you neglect to call C<close()> before trying to ping
-a different network device.
-
-=item external
-
-The ping() method attempts to use the C<Net::Ping::External> module to ping
-the remote host. C<Net::Ping::External> interfaces with your system's default
-L<ping(8)> utility to perform the ping, and generally produces relatively
+If the "external" protocol is specified, the ping() method attempts to
+use the C<Net::Ping::External> module to ping the remote host.
+C<Net::Ping::External> interfaces with your system's default C<ping>
+utility to perform the ping, and generally produces relatively
accurate results. If C<Net::Ping::External> if not installed on your
system, specifying the "external" protocol will result in an error.
@@ -754,7 +709,18 @@ tcp socket. It's only necessary to do this if you want to
provide a different timeout when creating the connection, or
remove the overhead of establishing the connection from the
first ping. If you don't call C<open()>, the connection is
-automatically openeed the first time C<ping()> is called.
+automatically opened the first time C<ping()> is called.
+This call simply does nothing if you are using any protocol other
+than stream.
+
+=item $p->open($host);
+
+When you are using the stream protocol, this call pre-opens the
+tcp socket. It's only necessary to do this if you want to
+provide a different timeout when creating the connection, or
+remove the overhead of establishing the connection from the
+first ping. If you don't call C<open()>, the connection is
+automatically opened the first time C<ping()> is called.
This call simply does nothing if you are using any protocol other
than stream.
@@ -776,6 +742,13 @@ version of Net::Ping.
=back
+=head1 WARNING
+
+pingecho() or a ping object with the tcp protocol use alarm() to
+implement the timeout. So, don't use alarm() in your program while
+you are using pingecho() or a ping object with the tcp protocol. The
+udp and icmp protocols do not use alarm() to implement the timeout.
+
=head1 NOTES
There will be less network overhead (and some efficiency in your
@@ -805,4 +778,30 @@ routines to pack and unpack ICMP packets. It would be better for a
separate module to be written which understands all of the different
kinds of ICMP packets.
+=head1 AUTHOR(S)
+
+ Current maintainer Net::Ping base code:
+ colinm@cpan.org (Colin McMillen)
+
+ Stream protocol:
+ bronson@trestle.com (Scott Bronson)
+
+ Original pingecho():
+ karrer@bernina.ethz.ch (Andreas Karrer)
+ pmarquess@bfsec.bt.co.uk (Paul Marquess)
+
+ Original Net::Ping author:
+ mose@ns.ccsn.edu (Russell Mosemann)
+
+ Compatibility porting:
+ bbb@cpan.org (Rob Brown)
+
+=head1 COPYRIGHT
+
+Copyright (c) 2001, Colin McMillen. All rights reserved.
+Copyright (c) 2001, Rob Brown. All rights reserved.
+
+This program is free software; you may redistribute it and/or
+modify it under the same terms as Perl itself.
+
=cut
diff --git a/lib/Net/t/config.t b/lib/Net/t/config.t
index 560addb689..08df82b1ee 100644
--- a/lib/Net/t/config.t
+++ b/lib/Net/t/config.t
@@ -5,6 +5,11 @@ BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
}
+ if (!eval "require Socket") {
+ print "1..0 # no Socket\n"; exit 0;
+ }
+ undef *{Socket::inet_aton};
+ undef *{Socket::inet_ntoa};
if (ord('A') == 193 && !eval "require Convert::EBCDIC") {
print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0;
}
diff --git a/lib/Net/t/ftp.t b/lib/Net/t/ftp.t
index be62458dc2..32d750efe8 100644
--- a/lib/Net/t/ftp.t
+++ b/lib/Net/t/ftp.t
@@ -5,6 +5,9 @@ BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
}
+ if (!eval "require Socket") {
+ print "1..0 # no Socket\n"; exit 0;
+ }
if (ord('A') == 193 && !eval "require Convert::EBCDIC") {
print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0;
}
diff --git a/lib/Net/t/hostname.t b/lib/Net/t/hostname.t
index 25697226a3..e085591754 100644
--- a/lib/Net/t/hostname.t
+++ b/lib/Net/t/hostname.t
@@ -5,6 +5,9 @@ BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
}
+ if (!eval "require Socket") {
+ print "1..0 # no Socket\n"; exit 0;
+ }
if (ord('A') == 193 && !eval "require Convert::EBCDIC") {
print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0;
}
diff --git a/lib/Net/t/netrc.t b/lib/Net/t/netrc.t
index e87388f83a..c7bbc04706 100644
--- a/lib/Net/t/netrc.t
+++ b/lib/Net/t/netrc.t
@@ -5,6 +5,9 @@ BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
}
+ if (!eval "require Socket") {
+ print "1..0 # no Socket\n"; exit 0;
+ }
if (ord('A') == 193 && !eval "require Convert::EBCDIC") {
print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0;
}
diff --git a/lib/Net/t/nntp.t b/lib/Net/t/nntp.t
index ffeb123aac..7fb99de62c 100644
--- a/lib/Net/t/nntp.t
+++ b/lib/Net/t/nntp.t
@@ -5,6 +5,9 @@ BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
}
+ if (!eval "require Socket") {
+ print "1..0 # no Socket\n"; exit 0;
+ }
if (ord('A') == 193 && !eval "require Convert::EBCDIC") {
print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0;
}
diff --git a/lib/Net/t/require.t b/lib/Net/t/require.t
index 95dea8760b..163c8bd801 100644
--- a/lib/Net/t/require.t
+++ b/lib/Net/t/require.t
@@ -5,6 +5,9 @@ BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
}
+ if (!eval "require Socket") {
+ print "1..0 # no Socket\n"; exit 0;
+ }
if (ord('A') == 193 && !eval "require Convert::EBCDIC") {
print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0;
}
diff --git a/lib/Net/t/smtp.t b/lib/Net/t/smtp.t
index eb52f7c8cc..ac2df6c8b9 100644
--- a/lib/Net/t/smtp.t
+++ b/lib/Net/t/smtp.t
@@ -5,6 +5,9 @@ BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
}
+ if (!eval "require Socket") {
+ print "1..0 # no Socket\n"; exit 0;
+ }
if (ord('A') == 193 && !eval "require Convert::EBCDIC") {
print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0;
}
diff --git a/lib/Net/t/time.t b/lib/Net/t/time.t
index fb169c24b3..a8d416eea2 100644
--- a/lib/Net/t/time.t
+++ b/lib/Net/t/time.t
@@ -5,6 +5,9 @@ BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
}
+ if (!eval "require Socket") {
+ print "1..0 # no Socket\n"; exit 0;
+ }
if (ord('A') == 193 && !eval "require Convert::EBCDIC") {
print "1..0 # EBCDIC but no Convert::EBCDIC\n"; exit 0;
}
diff --git a/lib/Term/Cap.pm b/lib/Term/Cap.pm
index 69a2f5e2e1..a44601afe7 100644
--- a/lib/Term/Cap.pm
+++ b/lib/Term/Cap.pm
@@ -1,10 +1,12 @@
package Term::Cap;
use Carp;
+use strict;
use vars qw($VERSION);
+use vars qw($termpat $state $first $entry);
-$VERSION = '1.03';
+$VERSION = '1.05';
# Version undef: Thu Dec 14 20:02:42 CST 1995 by sanders@bsdi.com
# Version 1.00: Thu Nov 30 23:34:29 EST 2000 by schwern@pobox.com
@@ -19,6 +21,9 @@ $VERSION = '1.03';
# VMS Support from Charles Lane <lane@DUPHY4.Physics.Drexel.Edu>
# Version 1.04: Thu Nov 29 16:22:03 GMT 2001
# Fixed warnings in test
+# Version 1.05: Mon Dec 3 15:33:49 GMT 2001
+# Don't try to fall back on infocmp if it's not there. From chromatic.
+#
# TODO:
# support Berkeley DB termcaps
@@ -189,17 +194,17 @@ sub Tgetent { ## public -- static method
# last resort--fake up a termcap from terminfo
local $ENV{TERM} = $term;
- if ( $^O eq 'VMS' ) {
- chomp(my @entry = <DATA>);
- $entry = join '', @entry;
- }
- else {
- eval
- {
- $entry = `infocmp -C 2>/dev/null`;
- }
- }
-
+ if ( $^O eq 'VMS' ) {
+ chomp(my @entry = <DATA>);
+ $entry = join '', @entry;
+ }
+ else {
+ eval
+ {
+ $entry = `infocmp -C 2>/dev/null`
+ if grep { -x "$_/infocmp" } split /:/, $ENV{PATH};
+ }
+ }
}
croak "Can't find a valid termcap file" unless @termcap_path || $entry;
diff --git a/lib/Unicode/UCD.t b/lib/Unicode/UCD.t
index 1bed138710..5b1f36e741 100644
--- a/lib/Unicode/UCD.t
+++ b/lib/Unicode/UCD.t
@@ -9,7 +9,7 @@ BEGIN {
use strict;
use Unicode::UCD;
-use Test;
+use Test::More;
BEGIN { plan tests => 162 };
@@ -19,223 +19,223 @@ my $charinfo;
$charinfo = charinfo(0x41);
-ok($charinfo->{code}, '0041');
-ok($charinfo->{name}, 'LATIN CAPITAL LETTER A');
-ok($charinfo->{category}, 'Lu');
-ok($charinfo->{combining}, '0');
-ok($charinfo->{bidi}, 'L');
-ok($charinfo->{decomposition}, '');
-ok($charinfo->{decimal}, '');
-ok($charinfo->{digit}, '');
-ok($charinfo->{numeric}, '');
-ok($charinfo->{mirrored}, 'N');
-ok($charinfo->{unicode10}, '');
-ok($charinfo->{comment}, '');
-ok($charinfo->{upper}, '');
-ok($charinfo->{lower}, '0061');
-ok($charinfo->{title}, '');
-ok($charinfo->{block}, 'Basic Latin');
-ok($charinfo->{script}, 'Latin');
+is($charinfo->{code}, '0041', 'LATIN CAPITAL LETTER A');
+is($charinfo->{name}, 'LATIN CAPITAL LETTER A');
+is($charinfo->{category}, 'Lu');
+is($charinfo->{combining}, '0');
+is($charinfo->{bidi}, 'L');
+is($charinfo->{decomposition}, '');
+is($charinfo->{decimal}, '');
+is($charinfo->{digit}, '');
+is($charinfo->{numeric}, '');
+is($charinfo->{mirrored}, 'N');
+is($charinfo->{unicode10}, '');
+is($charinfo->{comment}, '');
+is($charinfo->{upper}, '');
+is($charinfo->{lower}, '0061');
+is($charinfo->{title}, '');
+is($charinfo->{block}, 'Basic Latin');
+is($charinfo->{script}, 'Latin');
$charinfo = charinfo(0x100);
-ok($charinfo->{code}, '0100');
-ok($charinfo->{name}, 'LATIN CAPITAL LETTER A WITH MACRON');
-ok($charinfo->{category}, 'Lu');
-ok($charinfo->{combining}, '0');
-ok($charinfo->{bidi}, 'L');
-ok($charinfo->{decomposition}, '0041 0304');
-ok($charinfo->{decimal}, '');
-ok($charinfo->{digit}, '');
-ok($charinfo->{numeric}, '');
-ok($charinfo->{mirrored}, 'N');
-ok($charinfo->{unicode10}, 'LATIN CAPITAL LETTER A MACRON');
-ok($charinfo->{comment}, '');
-ok($charinfo->{upper}, '');
-ok($charinfo->{lower}, '0101');
-ok($charinfo->{title}, '');
-ok($charinfo->{block}, 'Latin Extended-A');
-ok($charinfo->{script}, 'Latin');
+is($charinfo->{code}, '0100', 'LATIN CAPITAL LETTER A WITH MACRON');
+is($charinfo->{name}, 'LATIN CAPITAL LETTER A WITH MACRON');
+is($charinfo->{category}, 'Lu');
+is($charinfo->{combining}, '0');
+is($charinfo->{bidi}, 'L');
+is($charinfo->{decomposition}, '0041 0304');
+is($charinfo->{decimal}, '');
+is($charinfo->{digit}, '');
+is($charinfo->{numeric}, '');
+is($charinfo->{mirrored}, 'N');
+is($charinfo->{unicode10}, 'LATIN CAPITAL LETTER A MACRON');
+is($charinfo->{comment}, '');
+is($charinfo->{upper}, '');
+is($charinfo->{lower}, '0101');
+is($charinfo->{title}, '');
+is($charinfo->{block}, 'Latin Extended-A');
+is($charinfo->{script}, 'Latin');
# 0x0590 is in the Hebrew block but unused.
$charinfo = charinfo(0x590);
-ok($charinfo->{code}, undef);
-ok($charinfo->{name}, undef);
-ok($charinfo->{category}, undef);
-ok($charinfo->{combining}, undef);
-ok($charinfo->{bidi}, undef);
-ok($charinfo->{decomposition}, undef);
-ok($charinfo->{decimal}, undef);
-ok($charinfo->{digit}, undef);
-ok($charinfo->{numeric}, undef);
-ok($charinfo->{mirrored}, undef);
-ok($charinfo->{unicode10}, undef);
-ok($charinfo->{comment}, undef);
-ok($charinfo->{upper}, undef);
-ok($charinfo->{lower}, undef);
-ok($charinfo->{title}, undef);
-ok($charinfo->{block}, undef);
-ok($charinfo->{script}, undef);
+is($charinfo->{code}, undef, '0x0590 - unused Hebrew');
+is($charinfo->{name}, undef);
+is($charinfo->{category}, undef);
+is($charinfo->{combining}, undef);
+is($charinfo->{bidi}, undef);
+is($charinfo->{decomposition}, undef);
+is($charinfo->{decimal}, undef);
+is($charinfo->{digit}, undef);
+is($charinfo->{numeric}, undef);
+is($charinfo->{mirrored}, undef);
+is($charinfo->{unicode10}, undef);
+is($charinfo->{comment}, undef);
+is($charinfo->{upper}, undef);
+is($charinfo->{lower}, undef);
+is($charinfo->{title}, undef);
+is($charinfo->{block}, undef);
+is($charinfo->{script}, undef);
# 0x05d0 is in the Hebrew block and used.
$charinfo = charinfo(0x5d0);
-ok($charinfo->{code}, '05D0');
-ok($charinfo->{name}, 'HEBREW LETTER ALEF');
-ok($charinfo->{category}, 'Lo');
-ok($charinfo->{combining}, '0');
-ok($charinfo->{bidi}, 'R');
-ok($charinfo->{decomposition}, '');
-ok($charinfo->{decimal}, '');
-ok($charinfo->{digit}, '');
-ok($charinfo->{numeric}, '');
-ok($charinfo->{mirrored}, 'N');
-ok($charinfo->{unicode10}, '');
-ok($charinfo->{comment}, '');
-ok($charinfo->{upper}, '');
-ok($charinfo->{lower}, '');
-ok($charinfo->{title}, '');
-ok($charinfo->{block}, 'Hebrew');
-ok($charinfo->{script}, 'Hebrew');
+is($charinfo->{code}, '05D0', '05D0 - used Hebrew');
+is($charinfo->{name}, 'HEBREW LETTER ALEF');
+is($charinfo->{category}, 'Lo');
+is($charinfo->{combining}, '0');
+is($charinfo->{bidi}, 'R');
+is($charinfo->{decomposition}, '');
+is($charinfo->{decimal}, '');
+is($charinfo->{digit}, '');
+is($charinfo->{numeric}, '');
+is($charinfo->{mirrored}, 'N');
+is($charinfo->{unicode10}, '');
+is($charinfo->{comment}, '');
+is($charinfo->{upper}, '');
+is($charinfo->{lower}, '');
+is($charinfo->{title}, '');
+is($charinfo->{block}, 'Hebrew');
+is($charinfo->{script}, 'Hebrew');
# An open syllable in Hangul.
$charinfo = charinfo(0xAC00);
-ok($charinfo->{code}, 'AC00');
-ok($charinfo->{name}, 'HANGUL SYLLABLE-AC00');
-ok($charinfo->{category}, 'Lo');
-ok($charinfo->{combining}, '0');
-ok($charinfo->{bidi}, 'L');
-ok($charinfo->{decomposition}, undef);
-ok($charinfo->{decimal}, '');
-ok($charinfo->{digit}, '');
-ok($charinfo->{numeric}, '');
-ok($charinfo->{mirrored}, 'N');
-ok($charinfo->{unicode10}, '');
-ok($charinfo->{comment}, '');
-ok($charinfo->{upper}, '');
-ok($charinfo->{lower}, '');
-ok($charinfo->{title}, '');
-ok($charinfo->{block}, 'Hangul Syllables');
-ok($charinfo->{script}, 'Hangul');
+is($charinfo->{code}, 'AC00', 'HANGUL SYLLABLE-AC00');
+is($charinfo->{name}, 'HANGUL SYLLABLE-AC00');
+is($charinfo->{category}, 'Lo');
+is($charinfo->{combining}, '0');
+is($charinfo->{bidi}, 'L');
+is($charinfo->{decomposition}, undef);
+is($charinfo->{decimal}, '');
+is($charinfo->{digit}, '');
+is($charinfo->{numeric}, '');
+is($charinfo->{mirrored}, 'N');
+is($charinfo->{unicode10}, '');
+is($charinfo->{comment}, '');
+is($charinfo->{upper}, '');
+is($charinfo->{lower}, '');
+is($charinfo->{title}, '');
+is($charinfo->{block}, 'Hangul Syllables');
+is($charinfo->{script}, 'Hangul');
# A closed syllable in Hangul.
$charinfo = charinfo(0xAE00);
-ok($charinfo->{code}, 'AE00');
-ok($charinfo->{name}, 'HANGUL SYLLABLE-AE00');
-ok($charinfo->{category}, 'Lo');
-ok($charinfo->{combining}, '0');
-ok($charinfo->{bidi}, 'L');
-ok($charinfo->{decomposition}, undef);
-ok($charinfo->{decimal}, '');
-ok($charinfo->{digit}, '');
-ok($charinfo->{numeric}, '');
-ok($charinfo->{mirrored}, 'N');
-ok($charinfo->{unicode10}, '');
-ok($charinfo->{comment}, '');
-ok($charinfo->{upper}, '');
-ok($charinfo->{lower}, '');
-ok($charinfo->{title}, '');
-ok($charinfo->{block}, 'Hangul Syllables');
-ok($charinfo->{script}, 'Hangul');
+is($charinfo->{code}, 'AE00', 'HANGUL SYLLABLE-AE00');
+is($charinfo->{name}, 'HANGUL SYLLABLE-AE00');
+is($charinfo->{category}, 'Lo');
+is($charinfo->{combining}, '0');
+is($charinfo->{bidi}, 'L');
+is($charinfo->{decomposition}, undef);
+is($charinfo->{decimal}, '');
+is($charinfo->{digit}, '');
+is($charinfo->{numeric}, '');
+is($charinfo->{mirrored}, 'N');
+is($charinfo->{unicode10}, '');
+is($charinfo->{comment}, '');
+is($charinfo->{upper}, '');
+is($charinfo->{lower}, '');
+is($charinfo->{title}, '');
+is($charinfo->{block}, 'Hangul Syllables');
+is($charinfo->{script}, 'Hangul');
$charinfo = charinfo(0x1D400);
-ok($charinfo->{code}, '1D400');
-ok($charinfo->{name}, 'MATHEMATICAL BOLD CAPITAL A');
-ok($charinfo->{category}, 'Lu');
-ok($charinfo->{combining}, '0');
-ok($charinfo->{bidi}, 'L');
-ok($charinfo->{decomposition}, '<font> 0041');
-ok($charinfo->{decimal}, '');
-ok($charinfo->{digit}, '');
-ok($charinfo->{numeric}, '');
-ok($charinfo->{mirrored}, 'N');
-ok($charinfo->{unicode10}, '');
-ok($charinfo->{comment}, '');
-ok($charinfo->{upper}, '');
-ok($charinfo->{lower}, '');
-ok($charinfo->{title}, '');
-ok($charinfo->{block}, 'Mathematical Alphanumeric Symbols');
-ok($charinfo->{script}, undef);
+is($charinfo->{code}, '1D400', 'MATHEMATICAL BOLD CAPITAL A');
+is($charinfo->{name}, 'MATHEMATICAL BOLD CAPITAL A');
+is($charinfo->{category}, 'Lu');
+is($charinfo->{combining}, '0');
+is($charinfo->{bidi}, 'L');
+is($charinfo->{decomposition}, '<font> 0041');
+is($charinfo->{decimal}, '');
+is($charinfo->{digit}, '');
+is($charinfo->{numeric}, '');
+is($charinfo->{mirrored}, 'N');
+is($charinfo->{unicode10}, '');
+is($charinfo->{comment}, '');
+is($charinfo->{upper}, '');
+is($charinfo->{lower}, '');
+is($charinfo->{title}, '');
+is($charinfo->{block}, 'Mathematical Alphanumeric Symbols');
+is($charinfo->{script}, undef);
use Unicode::UCD qw(charblock charscript);
# 0x0590 is in the Hebrew block but unused.
-ok(charblock(0x590), 'Hebrew');
-ok(charscript(0x590), undef);
+is(charblock(0x590), 'Hebrew', '0x0590 - Hebrew unused charblock');
+is(charscript(0x590), undef, '0x0590 - Hebrew unused charscript');
$charinfo = charinfo(0xbe);
-ok($charinfo->{code}, '00BE');
-ok($charinfo->{name}, 'VULGAR FRACTION THREE QUARTERS');
-ok($charinfo->{category}, 'No');
-ok($charinfo->{combining}, '0');
-ok($charinfo->{bidi}, 'ON');
-ok($charinfo->{decomposition}, '<fraction> 0033 2044 0034');
-ok($charinfo->{decimal}, '');
-ok($charinfo->{digit}, '');
-ok($charinfo->{numeric}, '3/4');
-ok($charinfo->{mirrored}, 'N');
-ok($charinfo->{unicode10}, 'FRACTION THREE QUARTERS');
-ok($charinfo->{comment}, '');
-ok($charinfo->{upper}, '');
-ok($charinfo->{lower}, '');
-ok($charinfo->{title}, '');
-ok($charinfo->{block}, 'Latin-1 Supplement');
-ok($charinfo->{script}, undef);
+is($charinfo->{code}, '00BE', 'VULGAR FRACTION THREE QUARTERS');
+is($charinfo->{name}, 'VULGAR FRACTION THREE QUARTERS');
+is($charinfo->{category}, 'No');
+is($charinfo->{combining}, '0');
+is($charinfo->{bidi}, 'ON');
+is($charinfo->{decomposition}, '<fraction> 0033 2044 0034');
+is($charinfo->{decimal}, '');
+is($charinfo->{digit}, '');
+is($charinfo->{numeric}, '3/4');
+is($charinfo->{mirrored}, 'N');
+is($charinfo->{unicode10}, 'FRACTION THREE QUARTERS');
+is($charinfo->{comment}, '');
+is($charinfo->{upper}, '');
+is($charinfo->{lower}, '');
+is($charinfo->{title}, '');
+is($charinfo->{block}, 'Latin-1 Supplement');
+is($charinfo->{script}, undef);
use Unicode::UCD qw(charblocks charscripts);
my $charblocks = charblocks();
-ok(exists $charblocks->{Thai});
-ok($charblocks->{Thai}->[0]->[0], hex('0e00'));
-ok(!exists $charblocks->{PigLatin});
+ok(exists $charblocks->{Thai}, 'Thai charblock exists');
+is($charblocks->{Thai}->[0]->[0], hex('0e00'));
+ok(!exists $charblocks->{PigLatin}, 'PigLatin charblock does not exist');
my $charscripts = charscripts();
-ok(exists $charscripts->{Armenian});
-ok($charscripts->{Armenian}->[0]->[0], hex('0531'));
-ok(!exists $charscripts->{PigLatin});
+ok(exists $charscripts->{Armenian}, 'Armenian charscript exists');
+is($charscripts->{Armenian}->[0]->[0], hex('0531'));
+ok(!exists $charscripts->{PigLatin}, 'PigLatin charscript does not exist');
my $charscript;
$charscript = charscript("12ab");
-ok($charscript, 'Ethiopic');
+is($charscript, 'Ethiopic', 'Ethiopic charscript');
$charscript = charscript("0x12ab");
-ok($charscript, 'Ethiopic');
+is($charscript, 'Ethiopic');
$charscript = charscript("U+12ab");
-ok($charscript, 'Ethiopic');
+is($charscript, 'Ethiopic');
my $ranges;
$ranges = charscript('Ogham');
-ok($ranges->[0]->[0], hex('1681'));
-ok($ranges->[0]->[1], hex('169a'));
+is($ranges->[0]->[0], hex('1681'), 'Ogham charscript');
+is($ranges->[0]->[1], hex('169a'));
use Unicode::UCD qw(charinrange);
$ranges = charscript('Cherokee');
-ok(!charinrange($ranges, "139f"));
+ok(!charinrange($ranges, "139f"), 'Cherokee charscript');
ok( charinrange($ranges, "13a0"));
ok( charinrange($ranges, "13f4"));
ok(!charinrange($ranges, "13f5"));
-ok(Unicode::UCD::UnicodeVersion, '3.1.1');
+is(Unicode::UCD::UnicodeVersion, '3.1.1', 'UnicodeVersion');
use Unicode::UCD qw(compexcl);
-ok(!compexcl(0x0100));
+ok(!compexcl(0x0100), 'compexcl');
ok( compexcl(0x0958));
use Unicode::UCD qw(casefold);
@@ -246,13 +246,13 @@ $casefold = casefold(0x41);
ok($casefold->{code} eq '0041' &&
$casefold->{status} eq 'C' &&
- $casefold->{mapping} eq '0061');
+ $casefold->{mapping} eq '0061', 'casefold 0x41');
$casefold = casefold(0xdf);
ok($casefold->{code} eq '00DF' &&
$casefold->{status} eq 'F' &&
- $casefold->{mapping} eq '0073 0073');
+ $casefold->{mapping} eq '0073 0073', 'casefold 0xDF');
ok(!casefold(0x20));
@@ -268,7 +268,7 @@ ok($casespec->{code} eq '00DF' &&
$casespec->{lower} eq '00DF' &&
$casespec->{title} eq '0053 0073' &&
$casespec->{upper} eq '0053 0053' &&
- $casespec->{condition} eq undef);
+ $casespec->{condition} eq undef, 'casespec 0xDF');
$casespec = casespec(0x307);
@@ -276,4 +276,5 @@ ok($casespec->{az}->{code} eq '0307' &&
$casespec->{az}->{lower} eq '' &&
$casespec->{az}->{title} eq '0307' &&
$casespec->{az}->{upper} eq '0307' &&
- $casespec->{az}->{condition} eq 'az AFTER_i NOT_MORE_ABOVE');
+ $casespec->{az}->{condition} eq 'az AFTER_i NOT_MORE_ABOVE',
+ 'casespec 0x307');
diff --git a/lib/open.pm b/lib/open.pm
index 5140f6b5c9..79cd61b233 100644
--- a/lib/open.pm
+++ b/lib/open.pm
@@ -10,11 +10,8 @@ sub in_locale { $^H & $locale::hint_bits }
sub _get_locale_encoding {
unless (defined $locale_encoding) {
- eval {
- # I18N::Langinfo isn't available everywhere
- require I18N::Langinfo;
- I18N::Langinfo->import('langinfo', 'CODESET');
- };
+ # I18N::Langinfo isn't available everywhere
+ eval "use I18N::Langinfo qw(langinfo CODESET)";
unless ($@) {
$locale_encoding = langinfo(CODESET());
}
diff --git a/lib/open.t b/lib/open.t
index 3a42ce5b15..15a38bc992 100644
--- a/lib/open.t
+++ b/lib/open.t
@@ -183,7 +183,7 @@ eval { open::_get_locale_encoding() };
like( $@, qr/too ambiguous/, 'should die with ambiguous locale encoding' );
%%%
# the special :locale layer
-$ENV{LANG} = 'ru_RU.KOI8-R';
+$ENV{LC_ALL} = $ENV{LANG} = 'ru_RU.KOI8-R';
# the :locale will probe the locale environment variables like LANG
use open OUT => ':locale';
open(O, ">koi8");
diff --git a/mg.c b/mg.c
index 2a80760722..4369e4ae10 100644
--- a/mg.c
+++ b/mg.c
@@ -869,7 +869,6 @@ Perl_magic_setenv(pTHX_ SV *sv, MAGIC *mg)
register char *s;
char *ptr;
STRLEN len, klen;
- I32 i;
s = SvPV(sv,len);
ptr = MgPV(mg,klen);
@@ -922,6 +921,7 @@ Perl_magic_setenv(pTHX_ SV *sv, MAGIC *mg)
while (s < strend) {
char tmpbuf[256];
struct stat st;
+ I32 i;
s = delimcpy(tmpbuf, tmpbuf + sizeof tmpbuf,
s, strend, ':', &i);
s++;
@@ -1102,6 +1102,7 @@ Perl_csighandler_init(void)
for (sig = 1; sig < SIG_SIZE; sig++) {
#ifdef FAKE_DEFAULT_SIGNAL_HANDLERS
+ dTHX;
sig_defaulting[sig] = 1;
(void) rsignal(sig, &Perl_csighandler);
#endif
@@ -1948,7 +1949,7 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
SAVESPTR(PL_last_in_gv);
}
else if (SvOK(sv) && GvIO(PL_last_in_gv))
- IoLINES(GvIOp(PL_last_in_gv)) = (long)SvIV(sv);
+ IoLINES(GvIOp(PL_last_in_gv)) = SvIV(sv);
break;
case '^':
Safefree(IoTOP_NAME(GvIOp(PL_defoutgv)));
@@ -1961,15 +1962,15 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
IoFMT_GV(GvIOp(PL_defoutgv)) = gv_fetchpv(s,TRUE, SVt_PVIO);
break;
case '=':
- IoPAGE_LEN(GvIOp(PL_defoutgv)) = (long)(SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv));
+ IoPAGE_LEN(GvIOp(PL_defoutgv)) = (SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv));
break;
case '-':
- IoLINES_LEFT(GvIOp(PL_defoutgv)) = (long)(SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv));
+ IoLINES_LEFT(GvIOp(PL_defoutgv)) = (SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv));
if (IoLINES_LEFT(GvIOp(PL_defoutgv)) < 0L)
IoLINES_LEFT(GvIOp(PL_defoutgv)) = 0L;
break;
case '%':
- IoPAGE(GvIOp(PL_defoutgv)) = (long)(SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv));
+ IoPAGE(GvIOp(PL_defoutgv)) = (SvIOK(sv) ? SvIVX(sv) : sv_2iv(sv));
break;
case '|':
{
diff --git a/op.c b/op.c
index 8125b308ce..d633b479cb 100644
--- a/op.c
+++ b/op.c
@@ -2053,6 +2053,13 @@ Perl_bind_match(pTHX_ I32 type, OP *left, OP *right)
desc, sample, sample);
}
+ if (right->op_type == OP_CONST &&
+ cSVOPx(right)->op_private & OPpCONST_BARE &&
+ cSVOPx(right)->op_private & OPpCONST_STRICT)
+ {
+ no_bareword_allowed(right);
+ }
+
if (!(right->op_flags & OPf_STACKED) &&
(right->op_type == OP_MATCH ||
right->op_type == OP_SUBST ||
@@ -2936,6 +2943,9 @@ Perl_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
if (!squash)
o->op_private |= OPpTRANS_IDENTICAL;
}
+ else if (!squash && rlen == tlen && memEQ((char*)t, (char*)r, tlen)) {
+ o->op_private |= OPpTRANS_IDENTICAL;
+ }
for (i = 0; i < 256; i++)
tbl[i] = -1;
for (i = 0, j = 0; i < tlen; i++,j++) {
diff --git a/patchlevel.h b/patchlevel.h
index 20c36021c9..640501c18c 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
- ,"DEVEL13384"
+ ,"DEVEL13491"
,NULL
};
diff --git a/pod/buildtoc.PL b/pod/buildtoc.PL
index 0655887c3f..47972b7abf 100644
--- a/pod/buildtoc.PL
+++ b/pod/buildtoc.PL
@@ -192,6 +192,7 @@ if (-d "pod") {
perl572delta
perl571delta
perl570delta
+ perl561delta
perl56delta
perl5005delta
perl5004delta
diff --git a/pod/perl.pod b/pod/perl.pod
index 6a03ee72c7..2cac3f8731 100644
--- a/pod/perl.pod
+++ b/pod/perl.pod
@@ -131,6 +131,7 @@ For ease of access, the Perl manual has been split up into several sections.
perl572delta Perl changes in version 5.7.2
perl571delta Perl changes in version 5.7.1
perl570delta Perl changes in version 5.7.0
+ perl561delta Perl changes in version 5.6.1
perl56delta Perl changes in version 5.6
perl5005delta Perl changes in version 5.005
perl5004delta Perl changes in version 5.004
diff --git a/pod/perl561delta.pod b/pod/perl561delta.pod
new file mode 100644
index 0000000000..86235f0387
--- /dev/null
+++ b/pod/perl561delta.pod
@@ -0,0 +1,3646 @@
+=head1 NAME
+
+perldelta - what's new for perl v5.6.x
+
+=head1 DESCRIPTION
+
+This document describes differences between the 5.005 release and the 5.6.1
+release.
+
+=head1 Summary of changes between 5.6.0 and 5.6.1
+
+This section contains a summary of the changes between the 5.6.0 release
+and the 5.6.1 release. More details about the changes mentioned here
+may be found in the F<Changes> files that accompany the Perl source
+distribution. See L<perlhack> for pointers to online resources where you
+can inspect the individual patches described by these changes.
+
+=head2 Security Issues
+
+suidperl will not run /bin/mail anymore, because some platforms have
+a /bin/mail that is vulnerable to buffer overflow attacks.
+
+Note that suidperl is neither built nor installed by default in
+any recent version of perl. Use of suidperl is highly discouraged.
+If you think you need it, try alternatives such as sudo first.
+See http://www.courtesan.com/sudo/.
+
+=head2 Core bug fixes
+
+This is not an exhaustive list. It is intended to cover only the
+significant user-visible changes.
+
+=over
+
+=item C<UNIVERSAL::isa()>
+
+A bug in the caching mechanism used by C<UNIVERSAL::isa()> that affected
+base.pm has been fixed. The bug has existed since the 5.005 releases,
+but wasn't tickled by base.pm in those releases.
+
+=item Memory leaks
+
+Various cases of memory leaks and attempts to access uninitialized memory
+have been cured. See L</"Known Problems"> below for further issues.
+
+=item Numeric conversions
+
+Numeric conversions did not recognize changes in the string value
+properly in certain circumstances.
+
+In other situations, large unsigned numbers (those above 2**31) could
+sometimes lose their unsignedness, causing bogus results in arithmetic
+operations.
+
+Integer modulus on large unsigned integers sometimes returned
+incorrect values.
+
+Perl 5.6.0 generated "not a number" warnings on certain conversions where
+previous versions didn't.
+
+These problems have all been rectified.
+
+Infinity is now recognized as a number.
+
+=item qw(a\\b)
+
+In Perl 5.6.0, qw(a\\b) produced a string with two backslashes instead
+of one, in a departure from the behavior in previous versions. The
+older behavior has been reinstated.
+
+=item caller()
+
+caller() could cause core dumps in certain situations. Carp was sometimes
+affected by this problem.
+
+=item Bugs in regular expressions
+
+Pattern matches on overloaded values are now handled correctly.
+
+Perl 5.6.0 parsed m/\x{ab}/ incorrectly, leading to spurious warnings.
+This has been corrected.
+
+The RE engine found in Perl 5.6.0 accidentally pessimised certain kinds
+of simple pattern matches. These are now handled better.
+
+Regular expression debug output (whether through C<use re 'debug'>
+or via C<-Dr>) now looks better.
+
+Multi-line matches like C<"a\nxb\n" =~ /(?!\A)x/m> were flawed. The
+bug has been fixed.
+
+Use of $& could trigger a core dump under some situations. This
+is now avoided.
+
+Match variables $1 et al., weren't being unset when a pattern match
+was backtracking, and the anomaly showed up inside C</...(?{ ... }).../>
+etc. These variables are now tracked correctly.
+
+pos() did not return the correct value within s///ge in earlier
+versions. This is now handled correctly.
+
+=item "slurp" mode
+
+readline() on files opened in "slurp" mode could return an extra "" at
+the end in certain situations. This has been corrected.
+
+=item Autovivification of symbolic references to special variables
+
+Autovivification of symbolic references of special variables described
+in L<perlvar> (as in C<${$num}>) was accidentally disabled. This works
+again now.
+
+=item Lexical warnings
+
+Lexical warnings now propagate correctly into C<eval "...">.
+
+C<use warnings qw(FATAL all)> did not work as intended. This has been
+corrected.
+
+Lexical warnings could leak into other scopes in some situations.
+This is now fixed.
+
+warnings::enabled() now reports the state of $^W correctly if the caller
+isn't using lexical warnings.
+
+=item Spurious warnings and errors
+
+Perl 5.6.0 could emit spurious warnings about redefinition of dl_error()
+when statically building extensions into perl. This has been corrected.
+
+"our" variables could result in bogus "Variable will not stay shared"
+warnings. This is now fixed.
+
+"our" variables of the same name declared in two sibling blocks
+resulted in bogus warnings about "redeclaration" of the variables.
+The problem has been corrected.
+
+=item glob()
+
+Compatibility of the builtin glob() with old csh-based glob has been
+improved with the addition of GLOB_ALPHASORT option. See C<File::Glob>.
+
+File::Glob::glob() has been renamed to File::Glob::bsd_glob()
+because the name clashes with the builtin glob(). The older
+name is still available for compatibility, but is deprecated.
+
+Spurious syntax errors generated in certain situations, when glob()
+caused File::Glob to be loaded for the first time, have been fixed.
+
+=item Tainting
+
+Some cases of inconsistent taint propagation (such as within hash
+values) have been fixed.
+
+The tainting behavior of sprintf() has been rationalized. It does
+not taint the result of floating point formats anymore, making the
+behavior consistent with that of string interpolation.
+
+=item sort()
+
+Arguments to sort() weren't being provided the right wantarray() context.
+The comparison block is now run in scalar context, and the arguments to
+be sorted are always provided list context.
+
+sort() is also fully reentrant, in the sense that the sort function
+can itself call sort(). This did not work reliably in previous releases.
+
+=item #line directives
+
+#line directives now work correctly when they appear at the very
+beginning of C<eval "...">.
+
+=item Subroutine prototypes
+
+The (\&) prototype now works properly.
+
+=item map()
+
+map() could get pathologically slow when the result list it generates
+is larger than the source list. The performance has been improved for
+common scenarios.
+
+=item Debugger
+
+Debugger exit code now reflects the script exit code.
+
+Condition C<"0"> in breakpoints is now treated correctly.
+
+The C<d> command now checks the line number.
+
+C<$.> is no longer corrupted by the debugger.
+
+All debugger output now correctly goes to the socket if RemotePort
+is set.
+
+=item PERL5OPT
+
+PERL5OPT can be set to more than one switch group. Previously,
+it used to be limited to one group of options only.
+
+=item chop()
+
+chop(@list) in list context returned the characters chopped in reverse
+order. This has been reversed to be in the right order.
+
+=item Unicode support
+
+Unicode support has seen a large number of incremental improvements,
+but continues to be highly experimental. It is not expected to be
+fully supported in the 5.6.x maintenance releases.
+
+substr(), join(), repeat(), reverse(), quotemeta() and string
+concatenation were all handling Unicode strings incorrectly in
+Perl 5.6.0. This has been corrected.
+
+Support for C<tr///CU> and C<tr///UC> etc., have been removed since
+we realized the interface is broken. For similar functionality,
+see L<perlfunc/pack>.
+
+The Unicode Character Database has been updated to version 3.0.1
+with additions made available to the public as of August 30, 2000.
+
+The Unicode character classes \p{Blank} and \p{SpacePerl} have been
+added. "Blank" is like C isblank(), that is, it contains only
+"horizontal whitespace" (the space character is, the newline isn't),
+and the "SpacePerl" is the Unicode equivalent of C<\s> (\p{Space}
+isn't, since that includes the vertical tabulator character, whereas
+C<\s> doesn't.)
+
+If you are experimenting with Unicode support in perl, the development
+versions of Perl may have more to offer. In particular, I/O layers
+are now available in the development track, but not in the maintenance
+track, primarily to do backward compatibility issues. Unicode support
+is also evolving rapidly on a daily basis in the development track--the
+maintenance track only reflects the most conservative of these changes.
+
+=item 64-bit support
+
+Support for 64-bit platforms has been improved, but continues to be
+experimental. The level of support varies greatly among platforms.
+
+=item Compiler
+
+The B Compiler and its various backends have had many incremental
+improvements, but they continue to remain highly experimental. Use in
+production environments is discouraged.
+
+The perlcc tool has been rewritten so that the user interface is much
+more like that of a C compiler.
+
+The perlbc tools has been removed. Use C<perlcc -B> instead.
+
+=item Lvalue subroutines
+
+There have been various bugfixes to support lvalue subroutines better.
+However, the feature still remains experimental.
+
+=item IO::Socket
+
+IO::Socket::INET failed to open the specified port if the service
+name was not known. It now correctly uses the supplied port number
+as is.
+
+=item File::Find
+
+File::Find now chdir()s correctly when chasing symbolic links.
+
+=item xsubpp
+
+xsubpp now tolerates embedded POD sections.
+
+=item C<no Module;>
+
+C<no Module;> does not produce an error even if Module does not have an
+unimport() method. This parallels the behavior of C<use> vis-a-vis
+C<import>.
+
+=item Tests
+
+A large number of tests have been added.
+
+=back
+
+=head2 Core features
+
+untie() will now call an UNTIE() hook if it exists. See L<perltie>
+for details.
+
+The C<-DT> command line switch outputs copious tokenizing information.
+See L<perlrun>.
+
+Arrays are now always interpolated in double-quotish strings. Previously,
+C<"foo@bar.com"> used to be a fatal error at compile time, if an array
+C<@bar> was not used or declared. This transitional behavior was
+intended to help migrate perl4 code, and is deemed to be no longer useful.
+See L</"Arrays now always interpolate into double-quoted strings">.
+
+keys(), each(), pop(), push(), shift(), splice() and unshift()
+can all be overridden now.
+
+C<my __PACKAGE__ $obj> now does the expected thing.
+
+=head2 Configuration issues
+
+On some systems (IRIX and Solaris among them) the system malloc is demonstrably
+better. While the defaults haven't been changed in order to retain binary
+compatibility with earlier releases, you may be better off building perl
+with C<Configure -Uusemymalloc ...> as discussed in the F<INSTALL> file.
+
+C<Configure> has been enhanced in various ways:
+
+=over
+
+=item *
+
+Minimizes use of temporary files.
+
+=item *
+
+By default, does not link perl with libraries not used by it, such as
+the various dbm libraries. SunOS 4.x hints preserve behavior on that
+platform.
+
+=item *
+
+Support for pdp11-style memory models has been removed due to obsolescence.
+
+=item *
+
+Building outside the source tree is supported on systems that have
+symbolic links. This is done by running
+
+ sh /path/to/source/Configure -Dmksymlinks ...
+ make all test install
+
+in a directory other than the perl source directory. See F<INSTALL>.
+
+=item *
+
+C<Configure -S> can be run non-interactively.
+
+=back
+
+=head2 Documentation
+
+README.aix, README.solaris and README.macos have been added. README.posix-bc
+has been renamed to README.bs2000. These are installed as L<perlaix>,
+L<perlsolaris>, L<perlmacos>, and L<perlbs2000> respectively.
+
+The following pod documents are brand new:
+
+ perlclib Internal replacements for standard C library functions
+ perldebtut Perl debugging tutorial
+ perlebcdic Considerations for running Perl on EBCDIC platforms
+ perlnewmod Perl modules: preparing a new module for distribution
+ perlrequick Perl regular expressions quick start
+ perlretut Perl regular expressions tutorial
+ perlutil utilities packaged with the Perl distribution
+
+The F<INSTALL> file has been expanded to cover various issues, such as
+64-bit support.
+
+A longer list of contributors has been added to the source distribution.
+See the file C<AUTHORS>.
+
+Numerous other changes have been made to the included documentation and FAQs.
+
+=head2 Bundled modules
+
+The following modules have been added.
+
+=over
+
+=item B::Concise
+
+Walks Perl syntax tree, printing concise info about ops. See L<B::Concise>.
+
+=item File::Temp
+
+Returns name and handle of a temporary file safely. See L<File::Temp>.
+
+=item Pod::LaTeX
+
+Converts Pod data to formatted LaTeX. See L<Pod::LaTeX>.
+
+=item Pod::Text::Overstrike
+
+Converts POD data to formatted overstrike text. See L<Pod::Text::Overstrike>.
+
+=back
+
+The following modules have been upgraded.
+
+=over
+
+=item CGI
+
+CGI v2.752 is now included.
+
+=item CPAN
+
+CPAN v1.59_54 is now included.
+
+=item Class::Struct
+
+Various bugfixes have been added.
+
+=item DB_File
+
+DB_File v1.75 supports newer Berkeley DB versions, among other
+improvements.
+
+=item Devel::Peek
+
+Devel::Peek has been enhanced to support dumping of memory statistics,
+when perl is built with the included malloc().
+
+=item File::Find
+
+File::Find now supports pre and post-processing of the files in order
+to sort() them, etc.
+
+=item Getopt::Long
+
+Getopt::Long v2.25 is included.
+
+=item IO::Poll
+
+Various bug fixes have been included.
+
+=item IPC::Open3
+
+IPC::Open3 allows use of numeric file descriptors.
+
+=item Math::BigFloat
+
+The fmod() function supports modulus operations. Various bug fixes
+have also been included.
+
+=item Math::Complex
+
+Math::Complex handles inf, NaN etc., better.
+
+=item Net::Ping
+
+ping() could fail on odd number of data bytes, and when the echo service
+isn't running. This has been corrected.
+
+=item Opcode
+
+A memory leak has been fixed.
+
+=item Pod::Parser
+
+Version 1.13 of the Pod::Parser suite is included.
+
+=item Pod::Text
+
+Pod::Text and related modules have been upgraded to the versions
+in podlators suite v2.08.
+
+=item SDBM_File
+
+On dosish platforms, some keys went missing because of lack of support for
+files with "holes". A workaround for the problem has been added.
+
+=item Sys::Syslog
+
+Various bug fixes have been included.
+
+=item Tie::RefHash
+
+Now supports Tie::RefHash::Nestable to automagically tie hashref values.
+
+=item Tie::SubstrHash
+
+Various bug fixes have been included.
+
+=back
+
+=head2 Platform-specific improvements
+
+The following new ports are now available.
+
+=over
+
+=item NCR MP-RAS
+
+=item NonStop-UX
+
+=back
+
+Perl now builds under Amdahl UTS.
+
+Perl has also been verified to build under Amiga OS.
+
+Support for EPOC has been much improved. See README.epoc.
+
+Building perl with -Duseithreads or -Duse5005threads now works
+under HP-UX 10.20 (previously it only worked under 10.30 or later).
+You will need a thread library package installed. See README.hpux.
+
+Long doubles should now work under Linux.
+
+MacOS Classic is now supported in the mainstream source package.
+See README.macos.
+
+Support for MPE/iX has been updated. See README.mpeix.
+
+Support for OS/2 has been improved. See C<os2/Changes> and README.os2.
+
+Dynamic loading on z/OS (formerly OS/390) has been improved. See
+README.os390.
+
+Support for VMS has seen many incremental improvements, including
+better support for operators like backticks and system(), and better
+%ENV handling. See C<README.vms> and L<perlvms>.
+
+Support for Stratus VOS has been improved. See C<vos/Changes> and README.vos.
+
+Support for Windows has been improved.
+
+=over
+
+=item *
+
+fork() emulation has been improved in various ways, but still continues
+to be experimental. See L<perlfork> for known bugs and caveats.
+
+=item *
+
+%SIG has been enabled under USE_ITHREADS, but its use is completely
+unsupported under all configurations.
+
+=item *
+
+Borland C++ v5.5 is now a supported compiler that can build Perl.
+However, the generated binaries continue to be incompatible with those
+generated by the other supported compilers (GCC and Visual C++).
+
+=item *
+
+Non-blocking waits for child processes (or pseudo-processes) are
+supported via C<waitpid($pid, &POSIX::WNOHANG)>.
+
+=item *
+
+A memory leak in accept() has been fixed.
+
+=item *
+
+wait(), waitpid() and backticks now return the correct exit status under
+Windows 9x.
+
+=item *
+
+Trailing new %ENV entries weren't propagated to child processes. This
+is now fixed.
+
+=item *
+
+Current directory entries in %ENV are now correctly propagated to child
+processes.
+
+=item *
+
+Duping socket handles with open(F, ">&MYSOCK") now works under Windows 9x.
+
+=item *
+
+The makefiles now provide a single switch to bulk-enable all the features
+enabled in ActiveState ActivePerl (a popular binary distribution).
+
+=item *
+
+Win32::GetCwd() correctly returns C:\ instead of C: when at the drive root.
+Other bugs in chdir() and Cwd::cwd() have also been fixed.
+
+=item *
+
+fork() correctly returns undef and sets EAGAIN when it runs out of
+pseudo-process handles.
+
+=item *
+
+ExtUtils::MakeMaker now uses $ENV{LIB} to search for libraries.
+
+=item *
+
+UNC path handling is better when perl is built to support fork().
+
+=item *
+
+A handle leak in socket handling has been fixed.
+
+=item *
+
+send() works from within a pseudo-process.
+
+=back
+
+Unless specifically qualified otherwise, the remainder of this document
+covers changes between the 5.005 and 5.6.0 releases.
+
+=head1 Core Enhancements
+
+=head2 Interpreter cloning, threads, and concurrency
+
+Perl 5.6.0 introduces the beginnings of support for running multiple
+interpreters concurrently in different threads. In conjunction with
+the perl_clone() API call, which can be used to selectively duplicate
+the state of any given interpreter, it is possible to compile a
+piece of code once in an interpreter, clone that interpreter
+one or more times, and run all the resulting interpreters in distinct
+threads.
+
+On the Windows platform, this feature is used to emulate fork() at the
+interpreter level. See L<perlfork> for details about that.
+
+This feature is still in evolution. It is eventually meant to be used
+to selectively clone a subroutine and data reachable from that
+subroutine in a separate interpreter and run the cloned subroutine
+in a separate thread. Since there is no shared data between the
+interpreters, little or no locking will be needed (unless parts of
+the symbol table are explicitly shared). This is obviously intended
+to be an easy-to-use replacement for the existing threads support.
+
+Support for cloning interpreters and interpreter concurrency can be
+enabled using the -Dusethreads Configure option (see win32/Makefile for
+how to enable it on Windows.) The resulting perl executable will be
+functionally identical to one that was built with -Dmultiplicity, but
+the perl_clone() API call will only be available in the former.
+
+-Dusethreads enables the cpp macro USE_ITHREADS by default, which in turn
+enables Perl source code changes that provide a clear separation between
+the op tree and the data it operates with. The former is immutable, and
+can therefore be shared between an interpreter and all of its clones,
+while the latter is considered local to each interpreter, and is therefore
+copied for each clone.
+
+Note that building Perl with the -Dusemultiplicity Configure option
+is adequate if you wish to run multiple B<independent> interpreters
+concurrently in different threads. -Dusethreads only provides the
+additional functionality of the perl_clone() API call and other
+support for running B<cloned> interpreters concurrently.
+
+ NOTE: This is an experimental feature. Implementation details are
+ subject to change.
+
+=head2 Lexically scoped warning categories
+
+You can now control the granularity of warnings emitted by perl at a finer
+level using the C<use warnings> pragma. L<warnings> and L<perllexwarn>
+have copious documentation on this feature.
+
+=head2 Unicode and UTF-8 support
+
+Perl now uses UTF-8 as its internal representation for character
+strings. The C<utf8> and C<bytes> pragmas are used to control this support
+in the current lexical scope. See L<perlunicode>, L<utf8> and L<bytes> for
+more information.
+
+This feature is expected to evolve quickly to support some form of I/O
+disciplines that can be used to specify the kind of input and output data
+(bytes or characters). Until that happens, additional modules from CPAN
+will be needed to complete the toolkit for dealing with Unicode.
+
+ NOTE: This should be considered an experimental feature. Implementation
+ details are subject to change.
+
+=head2 Support for interpolating named characters
+
+The new C<\N> escape interpolates named characters within strings.
+For example, C<"Hi! \N{WHITE SMILING FACE}"> evaluates to a string
+with a Unicode smiley face at the end.
+
+=head2 "our" declarations
+
+An "our" declaration introduces a value that can be best understood
+as a lexically scoped symbolic alias to a global variable in the
+package that was current where the variable was declared. This is
+mostly useful as an alternative to the C<vars> pragma, but also provides
+the opportunity to introduce typing and other attributes for such
+variables. See L<perlfunc/our>.
+
+=head2 Support for strings represented as a vector of ordinals
+
+Literals of the form C<v1.2.3.4> are now parsed as a string composed
+of characters with the specified ordinals. This is an alternative, more
+readable way to construct (possibly Unicode) strings instead of
+interpolating characters, as in C<"\x{1}\x{2}\x{3}\x{4}">. The leading
+C<v> may be omitted if there are more than two ordinals, so C<1.2.3> is
+parsed the same as C<v1.2.3>.
+
+Strings written in this form are also useful to represent version "numbers".
+It is easy to compare such version "numbers" (which are really just plain
+strings) using any of the usual string comparison operators C<eq>, C<ne>,
+C<lt>, C<gt>, etc., or perform bitwise string operations on them using C<|>,
+C<&>, etc.
+
+In conjunction with the new C<$^V> magic variable (which contains
+the perl version as a string), such literals can be used as a readable way
+to check if you're running a particular version of Perl:
+
+ # this will parse in older versions of Perl also
+ if ($^V and $^V gt v5.6.0) {
+ # new features supported
+ }
+
+C<require> and C<use> also have some special magic to support such literals.
+They will be interpreted as a version rather than as a module name:
+
+ require v5.6.0; # croak if $^V lt v5.6.0
+ use v5.6.0; # same, but croaks at compile-time
+
+Alternatively, the C<v> may be omitted if there is more than one dot:
+
+ require 5.6.0;
+ use 5.6.0;
+
+Also, C<sprintf> and C<printf> support the Perl-specific format flag C<%v>
+to print ordinals of characters in arbitrary strings:
+
+ printf "v%vd", $^V; # prints current version, such as "v5.5.650"
+ printf "%*vX", ":", $addr; # formats IPv6 address
+ printf "%*vb", " ", $bits; # displays bitstring
+
+See L<perldata/"Scalar value constructors"> for additional information.
+
+=head2 Improved Perl version numbering system
+
+Beginning with Perl version 5.6.0, the version number convention has been
+changed to a "dotted integer" scheme that is more commonly found in open
+source projects.
+
+Maintenance versions of v5.6.0 will be released as v5.6.1, v5.6.2 etc.
+The next development series following v5.6.0 will be numbered v5.7.x,
+beginning with v5.7.0, and the next major production release following
+v5.6.0 will be v5.8.0.
+
+The English module now sets $PERL_VERSION to $^V (a string value) rather
+than C<$]> (a numeric value). (This is a potential incompatibility.
+Send us a report via perlbug if you are affected by this.)
+
+The v1.2.3 syntax is also now legal in Perl.
+See L<Support for strings represented as a vector of ordinals> for more on that.
+
+To cope with the new versioning system's use of at least three significant
+digits for each version component, the method used for incrementing the
+subversion number has also changed slightly. We assume that versions older
+than v5.6.0 have been incrementing the subversion component in multiples of
+10. Versions after v5.6.0 will increment them by 1. Thus, using the new
+notation, 5.005_03 is the "same" as v5.5.30, and the first maintenance
+version following v5.6.0 will be v5.6.1 (which should be read as being
+equivalent to a floating point value of 5.006_001 in the older format,
+stored in C<$]>).
+
+=head2 New syntax for declaring subroutine attributes
+
+Formerly, if you wanted to mark a subroutine as being a method call or
+as requiring an automatic lock() when it is entered, you had to declare
+that with a C<use attrs> pragma in the body of the subroutine.
+That can now be accomplished with declaration syntax, like this:
+
+ sub mymethod : locked method ;
+ ...
+ sub mymethod : locked method {
+ ...
+ }
+
+ sub othermethod :locked :method ;
+ ...
+ sub othermethod :locked :method {
+ ...
+ }
+
+
+(Note how only the first C<:> is mandatory, and whitespace surrounding
+the C<:> is optional.)
+
+F<AutoSplit.pm> and F<SelfLoader.pm> have been updated to keep the attributes
+with the stubs they provide. See L<attributes>.
+
+=head2 File and directory handles can be autovivified
+
+Similar to how constructs such as C<< $x->[0] >> autovivify a reference,
+handle constructors (open(), opendir(), pipe(), socketpair(), sysopen(),
+socket(), and accept()) now autovivify a file or directory handle
+if the handle passed to them is an uninitialized scalar variable. This
+allows the constructs such as C<open(my $fh, ...)> and C<open(local $fh,...)>
+to be used to create filehandles that will conveniently be closed
+automatically when the scope ends, provided there are no other references
+to them. This largely eliminates the need for typeglobs when opening
+filehandles that must be passed around, as in the following example:
+
+ sub myopen {
+ open my $fh, "@_"
+ or die "Can't open '@_': $!";
+ return $fh;
+ }
+
+ {
+ my $f = myopen("</etc/motd");
+ print <$f>;
+ # $f implicitly closed here
+ }
+
+=head2 open() with more than two arguments
+
+If open() is passed three arguments instead of two, the second argument
+is used as the mode and the third argument is taken to be the file name.
+This is primarily useful for protecting against unintended magic behavior
+of the traditional two-argument form. See L<perlfunc/open>.
+
+=head2 64-bit support
+
+Any platform that has 64-bit integers either
+
+ (1) natively as longs or ints
+ (2) via special compiler flags
+ (3) using long long or int64_t
+
+is able to use "quads" (64-bit integers) as follows:
+
+=over 4
+
+=item *
+
+constants (decimal, hexadecimal, octal, binary) in the code
+
+=item *
+
+arguments to oct() and hex()
+
+=item *
+
+arguments to print(), printf() and sprintf() (flag prefixes ll, L, q)
+
+=item *
+
+printed as such
+
+=item *
+
+pack() and unpack() "q" and "Q" formats
+
+=item *
+
+in basic arithmetics: + - * / % (NOTE: operating close to the limits
+of the integer values may produce surprising results)
+
+=item *
+
+in bit arithmetics: & | ^ ~ << >> (NOTE: these used to be forced
+to be 32 bits wide but now operate on the full native width.)
+
+=item *
+
+vec()
+
+=back
+
+Note that unless you have the case (a) you will have to configure
+and compile Perl using the -Duse64bitint Configure flag.
+
+ NOTE: The Configure flags -Duselonglong and -Duse64bits have been
+ deprecated. Use -Duse64bitint instead.
+
+There are actually two modes of 64-bitness: the first one is achieved
+using Configure -Duse64bitint and the second one using Configure
+-Duse64bitall. The difference is that the first one is minimal and
+the second one maximal. The first works in more places than the second.
+
+The C<use64bitint> does only as much as is required to get 64-bit
+integers into Perl (this may mean, for example, using "long longs")
+while your memory may still be limited to 2 gigabytes (because your
+pointers could still be 32-bit). Note that the name C<64bitint> does
+not imply that your C compiler will be using 64-bit C<int>s (it might,
+but it doesn't have to): the C<use64bitint> means that you will be
+able to have 64 bits wide scalar values.
+
+The C<use64bitall> goes all the way by attempting to switch also
+integers (if it can), longs (and pointers) to being 64-bit. This may
+create an even more binary incompatible Perl than -Duse64bitint: the
+resulting executable may not run at all in a 32-bit box, or you may
+have to reboot/reconfigure/rebuild your operating system to be 64-bit
+aware.
+
+Natively 64-bit systems like Alpha and Cray need neither -Duse64bitint
+nor -Duse64bitall.
+
+Last but not least: note that due to Perl's habit of always using
+floating point numbers, the quads are still not true integers.
+When quads overflow their limits (0...18_446_744_073_709_551_615 unsigned,
+-9_223_372_036_854_775_808...9_223_372_036_854_775_807 signed), they
+are silently promoted to floating point numbers, after which they will
+start losing precision (in their lower digits).
+
+ NOTE: 64-bit support is still experimental on most platforms.
+ Existing support only covers the LP64 data model. In particular, the
+ LLP64 data model is not yet supported. 64-bit libraries and system
+ APIs on many platforms have not stabilized--your mileage may vary.
+
+=head2 Large file support
+
+If you have filesystems that support "large files" (files larger than
+2 gigabytes), you may now also be able to create and access them from
+Perl.
+
+ NOTE: The default action is to enable large file support, if
+ available on the platform.
+
+If the large file support is on, and you have a Fcntl constant
+O_LARGEFILE, the O_LARGEFILE is automatically added to the flags
+of sysopen().
+
+Beware that unless your filesystem also supports "sparse files" seeking
+to umpteen petabytes may be inadvisable.
+
+Note that in addition to requiring a proper file system to do large
+files you may also need to adjust your per-process (or your
+per-system, or per-process-group, or per-user-group) maximum filesize
+limits before running Perl scripts that try to handle large files,
+especially if you intend to write such files.
+
+Finally, in addition to your process/process group maximum filesize
+limits, you may have quota limits on your filesystems that stop you
+(your user id or your user group id) from using large files.
+
+Adjusting your process/user/group/file system/operating system limits
+is outside the scope of Perl core language. For process limits, you
+may try increasing the limits using your shell's limits/limit/ulimit
+command before running Perl. The BSD::Resource extension (not
+included with the standard Perl distribution) may also be of use, it
+offers the getrlimit/setrlimit interface that can be used to adjust
+process resource usage limits, including the maximum filesize limit.
+
+=head2 Long doubles
+
+In some systems you may be able to use long doubles to enhance the
+range and precision of your double precision floating point numbers
+(that is, Perl's numbers). Use Configure -Duselongdouble to enable
+this support (if it is available).
+
+=head2 "more bits"
+
+You can "Configure -Dusemorebits" to turn on both the 64-bit support
+and the long double support.
+
+=head2 Enhanced support for sort() subroutines
+
+Perl subroutines with a prototype of C<($$)>, and XSUBs in general, can
+now be used as sort subroutines. In either case, the two elements to
+be compared are passed as normal parameters in @_. See L<perlfunc/sort>.
+
+For unprototyped sort subroutines, the historical behavior of passing
+the elements to be compared as the global variables $a and $b remains
+unchanged.
+
+=head2 C<sort $coderef @foo> allowed
+
+sort() did not accept a subroutine reference as the comparison
+function in earlier versions. This is now permitted.
+
+=head2 File globbing implemented internally
+
+Perl now uses the File::Glob implementation of the glob() operator
+automatically. This avoids using an external csh process and the
+problems associated with it.
+
+ NOTE: This is currently an experimental feature. Interfaces and
+ implementation are subject to change.
+
+=head2 Support for CHECK blocks
+
+In addition to C<BEGIN>, C<INIT>, C<END>, C<DESTROY> and C<AUTOLOAD>,
+subroutines named C<CHECK> are now special. These are queued up during
+compilation and behave similar to END blocks, except they are called at
+the end of compilation rather than at the end of execution. They cannot
+be called directly.
+
+=head2 POSIX character class syntax [: :] supported
+
+For example to match alphabetic characters use /[[:alpha:]]/.
+See L<perlre> for details.
+
+=head2 Better pseudo-random number generator
+
+In 5.005_0x and earlier, perl's rand() function used the C library
+rand(3) function. As of 5.005_52, Configure tests for drand48(),
+random(), and rand() (in that order) and picks the first one it finds.
+
+These changes should result in better random numbers from rand().
+
+=head2 Improved C<qw//> operator
+
+The C<qw//> operator is now evaluated at compile time into a true list
+instead of being replaced with a run time call to C<split()>. This
+removes the confusing misbehaviour of C<qw//> in scalar context, which
+had inherited that behaviour from split().
+
+Thus:
+
+ $foo = ($bar) = qw(a b c); print "$foo|$bar\n";
+
+now correctly prints "3|a", instead of "2|a".
+
+=head2 Better worst-case behavior of hashes
+
+Small changes in the hashing algorithm have been implemented in
+order to improve the distribution of lower order bits in the
+hashed value. This is expected to yield better performance on
+keys that are repeated sequences.
+
+=head2 pack() format 'Z' supported
+
+The new format type 'Z' is useful for packing and unpacking null-terminated
+strings. See L<perlfunc/"pack">.
+
+=head2 pack() format modifier '!' supported
+
+The new format type modifier '!' is useful for packing and unpacking
+native shorts, ints, and longs. See L<perlfunc/"pack">.
+
+=head2 pack() and unpack() support counted strings
+
+The template character '/' can be used to specify a counted string
+type to be packed or unpacked. See L<perlfunc/"pack">.
+
+=head2 Comments in pack() templates
+
+The '#' character in a template introduces a comment up to
+end of the line. This facilitates documentation of pack()
+templates.
+
+=head2 Weak references
+
+In previous versions of Perl, you couldn't cache objects so as
+to allow them to be deleted if the last reference from outside
+the cache is deleted. The reference in the cache would hold a
+reference count on the object and the objects would never be
+destroyed.
+
+Another familiar problem is with circular references. When an
+object references itself, its reference count would never go
+down to zero, and it would not get destroyed until the program
+is about to exit.
+
+Weak references solve this by allowing you to "weaken" any
+reference, that is, make it not count towards the reference count.
+When the last non-weak reference to an object is deleted, the object
+is destroyed and all the weak references to the object are
+automatically undef-ed.
+
+To use this feature, you need the WeakRef package from CPAN, which
+contains additional documentation.
+
+ NOTE: This is an experimental feature. Details are subject to change.
+
+=head2 Binary numbers supported
+
+Binary numbers are now supported as literals, in s?printf formats, and
+C<oct()>:
+
+ $answer = 0b101010;
+ printf "The answer is: %b\n", oct("0b101010");
+
+=head2 Lvalue subroutines
+
+Subroutines can now return modifiable lvalues.
+See L<perlsub/"Lvalue subroutines">.
+
+ NOTE: This is an experimental feature. Details are subject to change.
+
+=head2 Some arrows may be omitted in calls through references
+
+Perl now allows the arrow to be omitted in many constructs
+involving subroutine calls through references. For example,
+C<< $foo[10]->('foo') >> may now be written C<$foo[10]('foo')>.
+This is rather similar to how the arrow may be omitted from
+C<< $foo[10]->{'foo'} >>. Note however, that the arrow is still
+required for C<< foo(10)->('bar') >>.
+
+=head2 Boolean assignment operators are legal lvalues
+
+Constructs such as C<($a ||= 2) += 1> are now allowed.
+
+=head2 exists() is supported on subroutine names
+
+The exists() builtin now works on subroutine names. A subroutine
+is considered to exist if it has been declared (even if implicitly).
+See L<perlfunc/exists> for examples.
+
+=head2 exists() and delete() are supported on array elements
+
+The exists() and delete() builtins now work on simple arrays as well.
+The behavior is similar to that on hash elements.
+
+exists() can be used to check whether an array element has been
+initialized. This avoids autovivifying array elements that don't exist.
+If the array is tied, the EXISTS() method in the corresponding tied
+package will be invoked.
+
+delete() may be used to remove an element from the array and return
+it. The array element at that position returns to its uninitialized
+state, so that testing for the same element with exists() will return
+false. If the element happens to be the one at the end, the size of
+the array also shrinks up to the highest element that tests true for
+exists(), or 0 if none such is found. If the array is tied, the DELETE()
+method in the corresponding tied package will be invoked.
+
+See L<perlfunc/exists> and L<perlfunc/delete> for examples.
+
+=head2 Pseudo-hashes work better
+
+Dereferencing some types of reference values in a pseudo-hash,
+such as C<< $ph->{foo}[1] >>, was accidentally disallowed. This has
+been corrected.
+
+When applied to a pseudo-hash element, exists() now reports whether
+the specified value exists, not merely if the key is valid.
+
+delete() now works on pseudo-hashes. When given a pseudo-hash element
+or slice it deletes the values corresponding to the keys (but not the keys
+themselves). See L<perlref/"Pseudo-hashes: Using an array as a hash">.
+
+Pseudo-hash slices with constant keys are now optimized to array lookups
+at compile-time.
+
+List assignments to pseudo-hash slices are now supported.
+
+The C<fields> pragma now provides ways to create pseudo-hashes, via
+fields::new() and fields::phash(). See L<fields>.
+
+ NOTE: The pseudo-hash data type continues to be experimental.
+ Limiting oneself to the interface elements provided by the
+ fields pragma will provide protection from any future changes.
+
+=head2 Automatic flushing of output buffers
+
+fork(), exec(), system(), qx//, and pipe open()s now flush buffers
+of all files opened for output when the operation was attempted. This
+mostly eliminates confusing buffering mishaps suffered by users unaware
+of how Perl internally handles I/O.
+
+This is not supported on some platforms like Solaris where a suitably
+correct implementation of fflush(NULL) isn't available.
+
+=head2 Better diagnostics on meaningless filehandle operations
+
+Constructs such as C<< open(<FH>) >> and C<< close(<FH>) >>
+are compile time errors. Attempting to read from filehandles that
+were opened only for writing will now produce warnings (just as
+writing to read-only filehandles does).
+
+=head2 Where possible, buffered data discarded from duped input filehandle
+
+C<< open(NEW, "<&OLD") >> now attempts to discard any data that
+was previously read and buffered in C<OLD> before duping the handle.
+On platforms where doing this is allowed, the next read operation
+on C<NEW> will return the same data as the corresponding operation
+on C<OLD>. Formerly, it would have returned the data from the start
+of the following disk block instead.
+
+=head2 eof() has the same old magic as <>
+
+C<eof()> would return true if no attempt to read from C<< <> >> had
+yet been made. C<eof()> has been changed to have a little magic of its
+own, it now opens the C<< <> >> files.
+
+=head2 binmode() can be used to set :crlf and :raw modes
+
+binmode() now accepts a second argument that specifies a discipline
+for the handle in question. The two pseudo-disciplines ":raw" and
+":crlf" are currently supported on DOS-derivative platforms.
+See L<perlfunc/"binmode"> and L<open>.
+
+=head2 C<-T> filetest recognizes UTF-8 encoded files as "text"
+
+The algorithm used for the C<-T> filetest has been enhanced to
+correctly identify UTF-8 content as "text".
+
+=head2 system(), backticks and pipe open now reflect exec() failure
+
+On Unix and similar platforms, system(), qx() and open(FOO, "cmd |")
+etc., are implemented via fork() and exec(). When the underlying
+exec() fails, earlier versions did not report the error properly,
+since the exec() happened to be in a different process.
+
+The child process now communicates with the parent about the
+error in launching the external command, which allows these
+constructs to return with their usual error value and set $!.
+
+=head2 Improved diagnostics
+
+Line numbers are no longer suppressed (under most likely circumstances)
+during the global destruction phase.
+
+Diagnostics emitted from code running in threads other than the main
+thread are now accompanied by the thread ID.
+
+Embedded null characters in diagnostics now actually show up. They
+used to truncate the message in prior versions.
+
+$foo::a and $foo::b are now exempt from "possible typo" warnings only
+if sort() is encountered in package C<foo>.
+
+Unrecognized alphabetic escapes encountered when parsing quote
+constructs now generate a warning, since they may take on new
+semantics in later versions of Perl.
+
+Many diagnostics now report the internal operation in which the warning
+was provoked, like so:
+
+ Use of uninitialized value in concatenation (.) at (eval 1) line 1.
+ Use of uninitialized value in print at (eval 1) line 1.
+
+Diagnostics that occur within eval may also report the file and line
+number where the eval is located, in addition to the eval sequence
+number and the line number within the evaluated text itself. For
+example:
+
+ Not enough arguments for scalar at (eval 4)[newlib/perl5db.pl:1411] line 2, at EOF
+
+=head2 Diagnostics follow STDERR
+
+Diagnostic output now goes to whichever file the C<STDERR> handle
+is pointing at, instead of always going to the underlying C runtime
+library's C<stderr>.
+
+=head2 More consistent close-on-exec behavior
+
+On systems that support a close-on-exec flag on filehandles, the
+flag is now set for any handles created by pipe(), socketpair(),
+socket(), and accept(), if that is warranted by the value of $^F
+that may be in effect. Earlier versions neglected to set the flag
+for handles created with these operators. See L<perlfunc/pipe>,
+L<perlfunc/socketpair>, L<perlfunc/socket>, L<perlfunc/accept>,
+and L<perlvar/$^F>.
+
+=head2 syswrite() ease-of-use
+
+The length argument of C<syswrite()> has become optional.
+
+=head2 Better syntax checks on parenthesized unary operators
+
+Expressions such as:
+
+ print defined(&foo,&bar,&baz);
+ print uc("foo","bar","baz");
+ undef($foo,&bar);
+
+used to be accidentally allowed in earlier versions, and produced
+unpredictable behaviour. Some produced ancillary warnings
+when used in this way; others silently did the wrong thing.
+
+The parenthesized forms of most unary operators that expect a single
+argument now ensure that they are not called with more than one
+argument, making the cases shown above syntax errors. The usual
+behaviour of:
+
+ print defined &foo, &bar, &baz;
+ print uc "foo", "bar", "baz";
+ undef $foo, &bar;
+
+remains unchanged. See L<perlop>.
+
+=head2 Bit operators support full native integer width
+
+The bit operators (& | ^ ~ << >>) now operate on the full native
+integral width (the exact size of which is available in $Config{ivsize}).
+For example, if your platform is either natively 64-bit or if Perl
+has been configured to use 64-bit integers, these operations apply
+to 8 bytes (as opposed to 4 bytes on 32-bit platforms).
+For portability, be sure to mask off the excess bits in the result of
+unary C<~>, e.g., C<~$x & 0xffffffff>.
+
+=head2 Improved security features
+
+More potentially unsafe operations taint their results for improved
+security.
+
+The C<passwd> and C<shell> fields returned by the getpwent(), getpwnam(),
+and getpwuid() are now tainted, because the user can affect their own
+encrypted password and login shell.
+
+The variable modified by shmread(), and messages returned by msgrcv()
+(and its object-oriented interface IPC::SysV::Msg::rcv) are also tainted,
+because other untrusted processes can modify messages and shared memory
+segments for their own nefarious purposes.
+
+=head2 More functional bareword prototype (*)
+
+Bareword prototypes have been rationalized to enable them to be used
+to override builtins that accept barewords and interpret them in
+a special way, such as C<require> or C<do>.
+
+Arguments prototyped as C<*> will now be visible within the subroutine
+as either a simple scalar or as a reference to a typeglob.
+See L<perlsub/Prototypes>.
+
+=head2 C<require> and C<do> may be overridden
+
+C<require> and C<do 'file'> operations may be overridden locally
+by importing subroutines of the same name into the current package
+(or globally by importing them into the CORE::GLOBAL:: namespace).
+Overriding C<require> will also affect C<use>, provided the override
+is visible at compile-time.
+See L<perlsub/"Overriding Built-in Functions">.
+
+=head2 $^X variables may now have names longer than one character
+
+Formerly, $^X was synonymous with ${"\cX"}, but $^XY was a syntax
+error. Now variable names that begin with a control character may be
+arbitrarily long. However, for compatibility reasons, these variables
+I<must> be written with explicit braces, as C<${^XY}> for example.
+C<${^XYZ}> is synonymous with ${"\cXYZ"}. Variable names with more
+than one control character, such as C<${^XY^Z}>, are illegal.
+
+The old syntax has not changed. As before, `^X' may be either a
+literal control-X character or the two-character sequence `caret' plus
+`X'. When braces are omitted, the variable name stops after the
+control character. Thus C<"$^XYZ"> continues to be synonymous with
+C<$^X . "YZ"> as before.
+
+As before, lexical variables may not have names beginning with control
+characters. As before, variables whose names begin with a control
+character are always forced to be in package `main'. All such variables
+are reserved for future extensions, except those that begin with
+C<^_>, which may be used by user programs and are guaranteed not to
+acquire special meaning in any future version of Perl.
+
+=head2 New variable $^C reflects C<-c> switch
+
+C<$^C> has a boolean value that reflects whether perl is being run
+in compile-only mode (i.e. via the C<-c> switch). Since
+BEGIN blocks are executed under such conditions, this variable
+enables perl code to determine whether actions that make sense
+only during normal running are warranted. See L<perlvar>.
+
+=head2 New variable $^V contains Perl version as a string
+
+C<$^V> contains the Perl version number as a string composed of
+characters whose ordinals match the version numbers, i.e. v5.6.0.
+This may be used in string comparisons.
+
+See C<Support for strings represented as a vector of ordinals> for an
+example.
+
+=head2 Optional Y2K warnings
+
+If Perl is built with the cpp macro C<PERL_Y2KWARN> defined,
+it emits optional warnings when concatenating the number 19
+with another number.
+
+This behavior must be specifically enabled when running Configure.
+See F<INSTALL> and F<README.Y2K>.
+
+=head2 Arrays now always interpolate into double-quoted strings
+
+In double-quoted strings, arrays now interpolate, no matter what. The
+behavior in earlier versions of perl 5 was that arrays would interpolate
+into strings if the array had been mentioned before the string was
+compiled, and otherwise Perl would raise a fatal compile-time error.
+In versions 5.000 through 5.003, the error was
+
+ Literal @example now requires backslash
+
+In versions 5.004_01 through 5.6.0, the error was
+
+ In string, @example now must be written as \@example
+
+The idea here was to get people into the habit of writing
+C<"fred\@example.com"> when they wanted a literal C<@> sign, just as
+they have always written C<"Give me back my \$5"> when they wanted a
+literal C<$> sign.
+
+Starting with 5.6.1, when Perl now sees an C<@> sign in a
+double-quoted string, it I<always> attempts to interpolate an array,
+regardless of whether or not the array has been used or declared
+already. The fatal error has been downgraded to an optional warning:
+
+ Possible unintended interpolation of @example in string
+
+This warns you that C<"fred@example.com"> is going to turn into
+C<fred.com> if you don't backslash the C<@>.
+See http://www.plover.com/~mjd/perl/at-error.html for more details
+about the history here.
+
+=head1 Modules and Pragmata
+
+=head2 Modules
+
+=over 4
+
+=item attributes
+
+While used internally by Perl as a pragma, this module also
+provides a way to fetch subroutine and variable attributes.
+See L<attributes>.
+
+=item B
+
+The Perl Compiler suite has been extensively reworked for this
+release. More of the standard Perl testsuite passes when run
+under the Compiler, but there is still a significant way to
+go to achieve production quality compiled executables.
+
+ NOTE: The Compiler suite remains highly experimental. The
+ generated code may not be correct, even when it manages to execute
+ without errors.
+
+=item Benchmark
+
+Overall, Benchmark results exhibit lower average error and better timing
+accuracy.
+
+You can now run tests for I<n> seconds instead of guessing the right
+number of tests to run: e.g., timethese(-5, ...) will run each
+code for at least 5 CPU seconds. Zero as the "number of repetitions"
+means "for at least 3 CPU seconds". The output format has also
+changed. For example:
+
+ use Benchmark;$x=3;timethese(-5,{a=>sub{$x*$x},b=>sub{$x**2}})
+
+will now output something like this:
+
+ Benchmark: running a, b, each for at least 5 CPU seconds...
+ a: 5 wallclock secs ( 5.77 usr + 0.00 sys = 5.77 CPU) @ 200551.91/s (n=1156516)
+ b: 4 wallclock secs ( 5.00 usr + 0.02 sys = 5.02 CPU) @ 159605.18/s (n=800686)
+
+New features: "each for at least N CPU seconds...", "wallclock secs",
+and the "@ operations/CPU second (n=operations)".
+
+timethese() now returns a reference to a hash of Benchmark objects containing
+the test results, keyed on the names of the tests.
+
+timethis() now returns the iterations field in the Benchmark result object
+instead of 0.
+
+timethese(), timethis(), and the new cmpthese() (see below) can also take
+a format specifier of 'none' to suppress output.
+
+A new function countit() is just like timeit() except that it takes a
+TIME instead of a COUNT.
+
+A new function cmpthese() prints a chart comparing the results of each test
+returned from a timethese() call. For each possible pair of tests, the
+percentage speed difference (iters/sec or seconds/iter) is shown.
+
+For other details, see L<Benchmark>.
+
+=item ByteLoader
+
+The ByteLoader is a dedicated extension to generate and run
+Perl bytecode. See L<ByteLoader>.
+
+=item constant
+
+References can now be used.
+
+The new version also allows a leading underscore in constant names, but
+disallows a double leading underscore (as in "__LINE__"). Some other names
+are disallowed or warned against, including BEGIN, END, etc. Some names
+which were forced into main:: used to fail silently in some cases; now they're
+fatal (outside of main::) and an optional warning (inside of main::).
+The ability to detect whether a constant had been set with a given name has
+been added.
+
+See L<constant>.
+
+=item charnames
+
+This pragma implements the C<\N> string escape. See L<charnames>.
+
+=item Data::Dumper
+
+A C<Maxdepth> setting can be specified to avoid venturing
+too deeply into deep data structures. See L<Data::Dumper>.
+
+The XSUB implementation of Dump() is now automatically called if the
+C<Useqq> setting is not in use.
+
+Dumping C<qr//> objects works correctly.
+
+=item DB
+
+C<DB> is an experimental module that exposes a clean abstraction
+to Perl's debugging API.
+
+=item DB_File
+
+DB_File can now be built with Berkeley DB versions 1, 2 or 3.
+See C<ext/DB_File/Changes>.
+
+=item Devel::DProf
+
+Devel::DProf, a Perl source code profiler has been added. See
+L<Devel::DProf> and L<dprofpp>.
+
+=item Devel::Peek
+
+The Devel::Peek module provides access to the internal representation
+of Perl variables and data. It is a data debugging tool for the XS programmer.
+
+=item Dumpvalue
+
+The Dumpvalue module provides screen dumps of Perl data.
+
+=item DynaLoader
+
+DynaLoader now supports a dl_unload_file() function on platforms that
+support unloading shared objects using dlclose().
+
+Perl can also optionally arrange to unload all extension shared objects
+loaded by Perl. To enable this, build Perl with the Configure option
+C<-Accflags=-DDL_UNLOAD_ALL_AT_EXIT>. (This maybe useful if you are
+using Apache with mod_perl.)
+
+=item English
+
+$PERL_VERSION now stands for C<$^V> (a string value) rather than for C<$]>
+(a numeric value).
+
+=item Env
+
+Env now supports accessing environment variables like PATH as array
+variables.
+
+=item Fcntl
+
+More Fcntl constants added: F_SETLK64, F_SETLKW64, O_LARGEFILE for
+large file (more than 4GB) access (NOTE: the O_LARGEFILE is
+automatically added to sysopen() flags if large file support has been
+configured, as is the default), Free/Net/OpenBSD locking behaviour
+flags F_FLOCK, F_POSIX, Linux F_SHLCK, and O_ACCMODE: the combined
+mask of O_RDONLY, O_WRONLY, and O_RDWR. The seek()/sysseek()
+constants SEEK_SET, SEEK_CUR, and SEEK_END are available via the
+C<:seek> tag. The chmod()/stat() S_IF* constants and S_IS* functions
+are available via the C<:mode> tag.
+
+=item File::Compare
+
+A compare_text() function has been added, which allows custom
+comparison functions. See L<File::Compare>.
+
+=item File::Find
+
+File::Find now works correctly when the wanted() function is either
+autoloaded or is a symbolic reference.
+
+A bug that caused File::Find to lose track of the working directory
+when pruning top-level directories has been fixed.
+
+File::Find now also supports several other options to control its
+behavior. It can follow symbolic links if the C<follow> option is
+specified. Enabling the C<no_chdir> option will make File::Find skip
+changing the current directory when walking directories. The C<untaint>
+flag can be useful when running with taint checks enabled.
+
+See L<File::Find>.
+
+=item File::Glob
+
+This extension implements BSD-style file globbing. By default,
+it will also be used for the internal implementation of the glob()
+operator. See L<File::Glob>.
+
+=item File::Spec
+
+New methods have been added to the File::Spec module: devnull() returns
+the name of the null device (/dev/null on Unix) and tmpdir() the name of
+the temp directory (normally /tmp on Unix). There are now also methods
+to convert between absolute and relative filenames: abs2rel() and
+rel2abs(). For compatibility with operating systems that specify volume
+names in file paths, the splitpath(), splitdir(), and catdir() methods
+have been added.
+
+=item File::Spec::Functions
+
+The new File::Spec::Functions modules provides a function interface
+to the File::Spec module. Allows shorthand
+
+ $fullname = catfile($dir1, $dir2, $file);
+
+instead of
+
+ $fullname = File::Spec->catfile($dir1, $dir2, $file);
+
+=item Getopt::Long
+
+Getopt::Long licensing has changed to allow the Perl Artistic License
+as well as the GPL. It used to be GPL only, which got in the way of
+non-GPL applications that wanted to use Getopt::Long.
+
+Getopt::Long encourages the use of Pod::Usage to produce help
+messages. For example:
+
+ use Getopt::Long;
+ use Pod::Usage;
+ my $man = 0;
+ my $help = 0;
+ GetOptions('help|?' => \$help, man => \$man) or pod2usage(2);
+ pod2usage(1) if $help;
+ pod2usage(-exitstatus => 0, -verbose => 2) if $man;
+
+ __END__
+
+ =head1 NAME
+
+ sample - Using GetOpt::Long and Pod::Usage
+
+ =head1 SYNOPSIS
+
+ sample [options] [file ...]
+
+ Options:
+ -help brief help message
+ -man full documentation
+
+ =head1 OPTIONS
+
+ =over 8
+
+ =item B<-help>
+
+ Print a brief help message and exits.
+
+ =item B<-man>
+
+ Prints the manual page and exits.
+
+ =back
+
+ =head1 DESCRIPTION
+
+ B<This program> will read the given input file(s) and do something
+ useful with the contents thereof.
+
+ =cut
+
+See L<Pod::Usage> for details.
+
+A bug that prevented the non-option call-back <> from being
+specified as the first argument has been fixed.
+
+To specify the characters < and > as option starters, use ><. Note,
+however, that changing option starters is strongly deprecated.
+
+=item IO
+
+write() and syswrite() will now accept a single-argument
+form of the call, for consistency with Perl's syswrite().
+
+You can now create a TCP-based IO::Socket::INET without forcing
+a connect attempt. This allows you to configure its options
+(like making it non-blocking) and then call connect() manually.
+
+A bug that prevented the IO::Socket::protocol() accessor
+from ever returning the correct value has been corrected.
+
+IO::Socket::connect now uses non-blocking IO instead of alarm()
+to do connect timeouts.
+
+IO::Socket::accept now uses select() instead of alarm() for doing
+timeouts.
+
+IO::Socket::INET->new now sets $! correctly on failure. $@ is
+still set for backwards compatibility.
+
+=item JPL
+
+Java Perl Lingo is now distributed with Perl. See jpl/README
+for more information.
+
+=item lib
+
+C<use lib> now weeds out any trailing duplicate entries.
+C<no lib> removes all named entries.
+
+=item Math::BigInt
+
+The bitwise operations C<<< << >>>, C<<< >> >>>, C<&>, C<|>,
+and C<~> are now supported on bigints.
+
+=item Math::Complex
+
+The accessor methods Re, Im, arg, abs, rho, and theta can now also
+act as mutators (accessor $z->Re(), mutator $z->Re(3)).
+
+The class method C<display_format> and the corresponding object method
+C<display_format>, in addition to accepting just one argument, now can
+also accept a parameter hash. Recognized keys of a parameter hash are
+C<"style">, which corresponds to the old one parameter case, and two
+new parameters: C<"format">, which is a printf()-style format string
+(defaults usually to C<"%.15g">, you can revert to the default by
+setting the format string to C<undef>) used for both parts of a
+complex number, and C<"polar_pretty_print"> (defaults to true),
+which controls whether an attempt is made to try to recognize small
+multiples and rationals of pi (2pi, pi/2) at the argument (angle) of a
+polar complex number.
+
+The potentially disruptive change is that in list context both methods
+now I<return the parameter hash>, instead of only the value of the
+C<"style"> parameter.
+
+=item Math::Trig
+
+A little bit of radial trigonometry (cylindrical and spherical),
+radial coordinate conversions, and the great circle distance were added.
+
+=item Pod::Parser, Pod::InputObjects
+
+Pod::Parser is a base class for parsing and selecting sections of
+pod documentation from an input stream. This module takes care of
+identifying pod paragraphs and commands in the input and hands off the
+parsed paragraphs and commands to user-defined methods which are free
+to interpret or translate them as they see fit.
+
+Pod::InputObjects defines some input objects needed by Pod::Parser, and
+for advanced users of Pod::Parser that need more about a command besides
+its name and text.
+
+As of release 5.6.0 of Perl, Pod::Parser is now the officially sanctioned
+"base parser code" recommended for use by all pod2xxx translators.
+Pod::Text (pod2text) and Pod::Man (pod2man) have already been converted
+to use Pod::Parser and efforts to convert Pod::HTML (pod2html) are already
+underway. For any questions or comments about pod parsing and translating
+issues and utilities, please use the pod-people@perl.org mailing list.
+
+For further information, please see L<Pod::Parser> and L<Pod::InputObjects>.
+
+=item Pod::Checker, podchecker
+
+This utility checks pod files for correct syntax, according to
+L<perlpod>. Obvious errors are flagged as such, while warnings are
+printed for mistakes that can be handled gracefully. The checklist is
+not complete yet. See L<Pod::Checker>.
+
+=item Pod::ParseUtils, Pod::Find
+
+These modules provide a set of gizmos that are useful mainly for pod
+translators. L<Pod::Find|Pod::Find> traverses directory structures and
+returns found pod files, along with their canonical names (like
+C<File::Spec::Unix>). L<Pod::ParseUtils|Pod::ParseUtils> contains
+B<Pod::List> (useful for storing pod list information), B<Pod::Hyperlink>
+(for parsing the contents of C<LE<lt>E<gt>> sequences) and B<Pod::Cache>
+(for caching information about pod files, e.g., link nodes).
+
+=item Pod::Select, podselect
+
+Pod::Select is a subclass of Pod::Parser which provides a function
+named "podselect()" to filter out user-specified sections of raw pod
+documentation from an input stream. podselect is a script that provides
+access to Pod::Select from other scripts to be used as a filter.
+See L<Pod::Select>.
+
+=item Pod::Usage, pod2usage
+
+Pod::Usage provides the function "pod2usage()" to print usage messages for
+a Perl script based on its embedded pod documentation. The pod2usage()
+function is generally useful to all script authors since it lets them
+write and maintain a single source (the pods) for documentation, thus
+removing the need to create and maintain redundant usage message text
+consisting of information already in the pods.
+
+There is also a pod2usage script which can be used from other kinds of
+scripts to print usage messages from pods (even for non-Perl scripts
+with pods embedded in comments).
+
+For details and examples, please see L<Pod::Usage>.
+
+=item Pod::Text and Pod::Man
+
+Pod::Text has been rewritten to use Pod::Parser. While pod2text() is
+still available for backwards compatibility, the module now has a new
+preferred interface. See L<Pod::Text> for the details. The new Pod::Text
+module is easily subclassed for tweaks to the output, and two such
+subclasses (Pod::Text::Termcap for man-page-style bold and underlining
+using termcap information, and Pod::Text::Color for markup with ANSI color
+sequences) are now standard.
+
+pod2man has been turned into a module, Pod::Man, which also uses
+Pod::Parser. In the process, several outstanding bugs related to quotes
+in section headers, quoting of code escapes, and nested lists have been
+fixed. pod2man is now a wrapper script around this module.
+
+=item SDBM_File
+
+An EXISTS method has been added to this module (and sdbm_exists() has
+been added to the underlying sdbm library), so one can now call exists
+on an SDBM_File tied hash and get the correct result, rather than a
+runtime error.
+
+A bug that may have caused data loss when more than one disk block
+happens to be read from the database in a single FETCH() has been
+fixed.
+
+=item Sys::Syslog
+
+Sys::Syslog now uses XSUBs to access facilities from syslog.h so it
+no longer requires syslog.ph to exist.
+
+=item Sys::Hostname
+
+Sys::Hostname now uses XSUBs to call the C library's gethostname() or
+uname() if they exist.
+
+=item Term::ANSIColor
+
+Term::ANSIColor is a very simple module to provide easy and readable
+access to the ANSI color and highlighting escape sequences, supported by
+most ANSI terminal emulators. It is now included standard.
+
+=item Time::Local
+
+The timelocal() and timegm() functions used to silently return bogus
+results when the date fell outside the machine's integer range. They
+now consistently croak() if the date falls in an unsupported range.
+
+=item Win32
+
+The error return value in list context has been changed for all functions
+that return a list of values. Previously these functions returned a list
+with a single element C<undef> if an error occurred. Now these functions
+return the empty list in these situations. This applies to the following
+functions:
+
+ Win32::FsType
+ Win32::GetOSVersion
+
+The remaining functions are unchanged and continue to return C<undef> on
+error even in list context.
+
+The Win32::SetLastError(ERROR) function has been added as a complement
+to the Win32::GetLastError() function.
+
+The new Win32::GetFullPathName(FILENAME) returns the full absolute
+pathname for FILENAME in scalar context. In list context it returns
+a two-element list containing the fully qualified directory name and
+the filename. See L<Win32>.
+
+=item XSLoader
+
+The XSLoader extension is a simpler alternative to DynaLoader.
+See L<XSLoader>.
+
+=item DBM Filters
+
+A new feature called "DBM Filters" has been added to all the
+DBM modules--DB_File, GDBM_File, NDBM_File, ODBM_File, and SDBM_File.
+DBM Filters add four new methods to each DBM module:
+
+ filter_store_key
+ filter_store_value
+ filter_fetch_key
+ filter_fetch_value
+
+These can be used to filter key-value pairs before the pairs are
+written to the database or just after they are read from the database.
+See L<perldbmfilter> for further information.
+
+=back
+
+=head2 Pragmata
+
+C<use attrs> is now obsolete, and is only provided for
+backward-compatibility. It's been replaced by the C<sub : attributes>
+syntax. See L<perlsub/"Subroutine Attributes"> and L<attributes>.
+
+Lexical warnings pragma, C<use warnings;>, to control optional warnings.
+See L<perllexwarn>.
+
+C<use filetest> to control the behaviour of filetests (C<-r> C<-w>
+...). Currently only one subpragma implemented, "use filetest
+'access';", that uses access(2) or equivalent to check permissions
+instead of using stat(2) as usual. This matters in filesystems
+where there are ACLs (access control lists): the stat(2) might lie,
+but access(2) knows better.
+
+The C<open> pragma can be used to specify default disciplines for
+handle constructors (e.g. open()) and for qx//. The two
+pseudo-disciplines C<:raw> and C<:crlf> are currently supported on
+DOS-derivative platforms (i.e. where binmode is not a no-op).
+See also L</"binmode() can be used to set :crlf and :raw modes">.
+
+=head1 Utility Changes
+
+=head2 dprofpp
+
+C<dprofpp> is used to display profile data generated using C<Devel::DProf>.
+See L<dprofpp>.
+
+=head2 find2perl
+
+The C<find2perl> utility now uses the enhanced features of the File::Find
+module. The -depth and -follow options are supported. Pod documentation
+is also included in the script.
+
+=head2 h2xs
+
+The C<h2xs> tool can now work in conjunction with C<C::Scan> (available
+from CPAN) to automatically parse real-life header files. The C<-M>,
+C<-a>, C<-k>, and C<-o> options are new.
+
+=head2 perlcc
+
+C<perlcc> now supports the C and Bytecode backends. By default,
+it generates output from the simple C backend rather than the
+optimized C backend.
+
+Support for non-Unix platforms has been improved.
+
+=head2 perldoc
+
+C<perldoc> has been reworked to avoid possible security holes.
+It will not by default let itself be run as the superuser, but you
+may still use the B<-U> switch to try to make it drop privileges
+first.
+
+=head2 The Perl Debugger
+
+Many bug fixes and enhancements were added to F<perl5db.pl>, the
+Perl debugger. The help documentation was rearranged. New commands
+include C<< < ? >>, C<< > ? >>, and C<< { ? >> to list out current
+actions, C<man I<docpage>> to run your doc viewer on some perl
+docset, and support for quoted options. The help information was
+rearranged, and should be viewable once again if you're using B<less>
+as your pager. A serious security hole was plugged--you should
+immediately remove all older versions of the Perl debugger as
+installed in previous releases, all the way back to perl3, from
+your system to avoid being bitten by this.
+
+=head1 Improved Documentation
+
+Many of the platform-specific README files are now part of the perl
+installation. See L<perl> for the complete list.
+
+=over 4
+
+=item perlapi.pod
+
+The official list of public Perl API functions.
+
+=item perlboot.pod
+
+A tutorial for beginners on object-oriented Perl.
+
+=item perlcompile.pod
+
+An introduction to using the Perl Compiler suite.
+
+=item perldbmfilter.pod
+
+A howto document on using the DBM filter facility.
+
+=item perldebug.pod
+
+All material unrelated to running the Perl debugger, plus all
+low-level guts-like details that risked crushing the casual user
+of the debugger, have been relocated from the old manpage to the
+next entry below.
+
+=item perldebguts.pod
+
+This new manpage contains excessively low-level material not related
+to the Perl debugger, but slightly related to debugging Perl itself.
+It also contains some arcane internal details of how the debugging
+process works that may only be of interest to developers of Perl
+debuggers.
+
+=item perlfork.pod
+
+Notes on the fork() emulation currently available for the Windows platform.
+
+=item perlfilter.pod
+
+An introduction to writing Perl source filters.
+
+=item perlhack.pod
+
+Some guidelines for hacking the Perl source code.
+
+=item perlintern.pod
+
+A list of internal functions in the Perl source code.
+(List is currently empty.)
+
+=item perllexwarn.pod
+
+Introduction and reference information about lexically scoped
+warning categories.
+
+=item perlnumber.pod
+
+Detailed information about numbers as they are represented in Perl.
+
+=item perlopentut.pod
+
+A tutorial on using open() effectively.
+
+=item perlreftut.pod
+
+A tutorial that introduces the essentials of references.
+
+=item perltootc.pod
+
+A tutorial on managing class data for object modules.
+
+=item perltodo.pod
+
+Discussion of the most often wanted features that may someday be
+supported in Perl.
+
+=item perlunicode.pod
+
+An introduction to Unicode support features in Perl.
+
+=back
+
+=head1 Performance enhancements
+
+=head2 Simple sort() using { $a <=> $b } and the like are optimized
+
+Many common sort() operations using a simple inlined block are now
+optimized for faster performance.
+
+=head2 Optimized assignments to lexical variables
+
+Certain operations in the RHS of assignment statements have been
+optimized to directly set the lexical variable on the LHS,
+eliminating redundant copying overheads.
+
+=head2 Faster subroutine calls
+
+Minor changes in how subroutine calls are handled internally
+provide marginal improvements in performance.
+
+=head2 delete(), each(), values() and hash iteration are faster
+
+The hash values returned by delete(), each(), values() and hashes in a
+list context are the actual values in the hash, instead of copies.
+This results in significantly better performance, because it eliminates
+needless copying in most situations.
+
+=head1 Installation and Configuration Improvements
+
+=head2 -Dusethreads means something different
+
+The -Dusethreads flag now enables the experimental interpreter-based thread
+support by default. To get the flavor of experimental threads that was in
+5.005 instead, you need to run Configure with "-Dusethreads -Duse5005threads".
+
+As of v5.6.0, interpreter-threads support is still lacking a way to
+create new threads from Perl (i.e., C<use Thread;> will not work with
+interpreter threads). C<use Thread;> continues to be available when you
+specify the -Duse5005threads option to Configure, bugs and all.
+
+ NOTE: Support for threads continues to be an experimental feature.
+ Interfaces and implementation are subject to sudden and drastic changes.
+
+=head2 New Configure flags
+
+The following new flags may be enabled on the Configure command line
+by running Configure with C<-Dflag>.
+
+ usemultiplicity
+ usethreads useithreads (new interpreter threads: no Perl API yet)
+ usethreads use5005threads (threads as they were in 5.005)
+
+ use64bitint (equal to now deprecated 'use64bits')
+ use64bitall
+
+ uselongdouble
+ usemorebits
+ uselargefiles
+ usesocks (only SOCKS v5 supported)
+
+=head2 Threadedness and 64-bitness now more daring
+
+The Configure options enabling the use of threads and the use of
+64-bitness are now more daring in the sense that they no more have an
+explicit list of operating systems of known threads/64-bit
+capabilities. In other words: if your operating system has the
+necessary APIs and datatypes, you should be able just to go ahead and
+use them, for threads by Configure -Dusethreads, and for 64 bits
+either explicitly by Configure -Duse64bitint or implicitly if your
+system has 64-bit wide datatypes. See also L<"64-bit support">.
+
+=head2 Long Doubles
+
+Some platforms have "long doubles", floating point numbers of even
+larger range than ordinary "doubles". To enable using long doubles for
+Perl's scalars, use -Duselongdouble.
+
+=head2 -Dusemorebits
+
+You can enable both -Duse64bitint and -Duselongdouble with -Dusemorebits.
+See also L<"64-bit support">.
+
+=head2 -Duselargefiles
+
+Some platforms support system APIs that are capable of handling large files
+(typically, files larger than two gigabytes). Perl will try to use these
+APIs if you ask for -Duselargefiles.
+
+See L<"Large file support"> for more information.
+
+=head2 installusrbinperl
+
+You can use "Configure -Uinstallusrbinperl" which causes installperl
+to skip installing perl also as /usr/bin/perl. This is useful if you
+prefer not to modify /usr/bin for some reason or another but harmful
+because many scripts assume to find Perl in /usr/bin/perl.
+
+=head2 SOCKS support
+
+You can use "Configure -Dusesocks" which causes Perl to probe
+for the SOCKS proxy protocol library (v5, not v4). For more information
+on SOCKS, see:
+
+ http://www.socks.nec.com/
+
+=head2 C<-A> flag
+
+You can "post-edit" the Configure variables using the Configure C<-A>
+switch. The editing happens immediately after the platform specific
+hints files have been processed but before the actual configuration
+process starts. Run C<Configure -h> to find out the full C<-A> syntax.
+
+=head2 Enhanced Installation Directories
+
+The installation structure has been enriched to improve the support
+for maintaining multiple versions of perl, to provide locations for
+vendor-supplied modules, scripts, and manpages, and to ease maintenance
+of locally-added modules, scripts, and manpages. See the section on
+Installation Directories in the INSTALL file for complete details.
+For most users building and installing from source, the defaults should
+be fine.
+
+If you previously used C<Configure -Dsitelib> or C<-Dsitearch> to set
+special values for library directories, you might wish to consider using
+the new C<-Dsiteprefix> setting instead. Also, if you wish to re-use a
+config.sh file from an earlier version of perl, you should be sure to
+check that Configure makes sensible choices for the new directories.
+See INSTALL for complete details.
+
+=head2 gcc automatically tried if 'cc' does not seem to be working
+
+In many platforms the vendor-supplied 'cc' is too stripped-down to
+build Perl (basically, the 'cc' doesn't do ANSI C). If this seems
+to be the case and the 'cc' does not seem to be the GNU C compiler
+'gcc', an automatic attempt is made to find and use 'gcc' instead.
+
+=head1 Platform specific changes
+
+=head2 Supported platforms
+
+=over 4
+
+=item *
+
+The Mach CThreads (NEXTSTEP, OPENSTEP) are now supported by the Thread
+extension.
+
+=item *
+
+GNU/Hurd is now supported.
+
+=item *
+
+Rhapsody/Darwin is now supported.
+
+=item *
+
+EPOC is now supported (on Psion 5).
+
+=item *
+
+The cygwin port (formerly cygwin32) has been greatly improved.
+
+=back
+
+=head2 DOS
+
+=over 4
+
+=item *
+
+Perl now works with djgpp 2.02 (and 2.03 alpha).
+
+=item *
+
+Environment variable names are not converted to uppercase any more.
+
+=item *
+
+Incorrect exit codes from backticks have been fixed.
+
+=item *
+
+This port continues to use its own builtin globbing (not File::Glob).
+
+=back
+
+=head2 OS390 (OpenEdition MVS)
+
+Support for this EBCDIC platform has not been renewed in this release.
+There are difficulties in reconciling Perl's standardization on UTF-8
+as its internal representation for characters with the EBCDIC character
+set, because the two are incompatible.
+
+It is unclear whether future versions will renew support for this
+platform, but the possibility exists.
+
+=head2 VMS
+
+Numerous revisions and extensions to configuration, build, testing, and
+installation process to accommodate core changes and VMS-specific options.
+
+Expand %ENV-handling code to allow runtime mapping to logical names,
+CLI symbols, and CRTL environ array.
+
+Extension of subprocess invocation code to accept filespecs as command
+"verbs".
+
+Add to Perl command line processing the ability to use default file types and
+to recognize Unix-style C<2E<gt>&1>.
+
+Expansion of File::Spec::VMS routines, and integration into ExtUtils::MM_VMS.
+
+Extension of ExtUtils::MM_VMS to handle complex extensions more flexibly.
+
+Barewords at start of Unix-syntax paths may be treated as text rather than
+only as logical names.
+
+Optional secure translation of several logical names used internally by Perl.
+
+Miscellaneous bugfixing and porting of new core code to VMS.
+
+Thanks are gladly extended to the many people who have contributed VMS
+patches, testing, and ideas.
+
+=head2 Win32
+
+Perl can now emulate fork() internally, using multiple interpreters running
+in different concurrent threads. This support must be enabled at build
+time. See L<perlfork> for detailed information.
+
+When given a pathname that consists only of a drivename, such as C<A:>,
+opendir() and stat() now use the current working directory for the drive
+rather than the drive root.
+
+The builtin XSUB functions in the Win32:: namespace are documented. See
+L<Win32>.
+
+$^X now contains the full path name of the running executable.
+
+A Win32::GetLongPathName() function is provided to complement
+Win32::GetFullPathName() and Win32::GetShortPathName(). See L<Win32>.
+
+POSIX::uname() is supported.
+
+system(1,...) now returns true process IDs rather than process
+handles. kill() accepts any real process id, rather than strictly
+return values from system(1,...).
+
+For better compatibility with Unix, C<kill(0, $pid)> can now be used to
+test whether a process exists.
+
+The C<Shell> module is supported.
+
+Better support for building Perl under command.com in Windows 95
+has been added.
+
+Scripts are read in binary mode by default to allow ByteLoader (and
+the filter mechanism in general) to work properly. For compatibility,
+the DATA filehandle will be set to text mode if a carriage return is
+detected at the end of the line containing the __END__ or __DATA__
+token; if not, the DATA filehandle will be left open in binary mode.
+Earlier versions always opened the DATA filehandle in text mode.
+
+The glob() operator is implemented via the C<File::Glob> extension,
+which supports glob syntax of the C shell. This increases the flexibility
+of the glob() operator, but there may be compatibility issues for
+programs that relied on the older globbing syntax. If you want to
+preserve compatibility with the older syntax, you might want to run
+perl with C<-MFile::DosGlob>. For details and compatibility information,
+see L<File::Glob>.
+
+=head1 Significant bug fixes
+
+=head2 <HANDLE> on empty files
+
+With C<$/> set to C<undef>, "slurping" an empty file returns a string of
+zero length (instead of C<undef>, as it used to) the first time the
+HANDLE is read after C<$/> is set to C<undef>. Further reads yield
+C<undef>.
+
+This means that the following will append "foo" to an empty file (it used
+to do nothing):
+
+ perl -0777 -pi -e 's/^/foo/' empty_file
+
+The behaviour of:
+
+ perl -pi -e 's/^/foo/' empty_file
+
+is unchanged (it continues to leave the file empty).
+
+=head2 C<eval '...'> improvements
+
+Line numbers (as reflected by caller() and most diagnostics) within
+C<eval '...'> were often incorrect where here documents were involved.
+This has been corrected.
+
+Lexical lookups for variables appearing in C<eval '...'> within
+functions that were themselves called within an C<eval '...'> were
+searching the wrong place for lexicals. The lexical search now
+correctly ends at the subroutine's block boundary.
+
+The use of C<return> within C<eval {...}> caused $@ not to be reset
+correctly when no exception occurred within the eval. This has
+been fixed.
+
+Parsing of here documents used to be flawed when they appeared as
+the replacement expression in C<eval 's/.../.../e'>. This has
+been fixed.
+
+=head2 All compilation errors are true errors
+
+Some "errors" encountered at compile time were by necessity
+generated as warnings followed by eventual termination of the
+program. This enabled more such errors to be reported in a
+single run, rather than causing a hard stop at the first error
+that was encountered.
+
+The mechanism for reporting such errors has been reimplemented
+to queue compile-time errors and report them at the end of the
+compilation as true errors rather than as warnings. This fixes
+cases where error messages leaked through in the form of warnings
+when code was compiled at run time using C<eval STRING>, and
+also allows such errors to be reliably trapped using C<eval "...">.
+
+=head2 Implicitly closed filehandles are safer
+
+Sometimes implicitly closed filehandles (as when they are localized,
+and Perl automatically closes them on exiting the scope) could
+inadvertently set $? or $!. This has been corrected.
+
+
+=head2 Behavior of list slices is more consistent
+
+When taking a slice of a literal list (as opposed to a slice of
+an array or hash), Perl used to return an empty list if the
+result happened to be composed of all undef values.
+
+The new behavior is to produce an empty list if (and only if)
+the original list was empty. Consider the following example:
+
+ @a = (1,undef,undef,2)[2,1,2];
+
+The old behavior would have resulted in @a having no elements.
+The new behavior ensures it has three undefined elements.
+
+Note in particular that the behavior of slices of the following
+cases remains unchanged:
+
+ @a = ()[1,2];
+ @a = (getpwent)[7,0];
+ @a = (anything_returning_empty_list())[2,1,2];
+ @a = @b[2,1,2];
+ @a = @c{'a','b','c'};
+
+See L<perldata>.
+
+=head2 C<(\$)> prototype and C<$foo{a}>
+
+A scalar reference prototype now correctly allows a hash or
+array element in that slot.
+
+=head2 C<goto &sub> and AUTOLOAD
+
+The C<goto &sub> construct works correctly when C<&sub> happens
+to be autoloaded.
+
+=head2 C<-bareword> allowed under C<use integer>
+
+The autoquoting of barewords preceded by C<-> did not work
+in prior versions when the C<integer> pragma was enabled.
+This has been fixed.
+
+=head2 Failures in DESTROY()
+
+When code in a destructor threw an exception, it went unnoticed
+in earlier versions of Perl, unless someone happened to be
+looking in $@ just after the point the destructor happened to
+run. Such failures are now visible as warnings when warnings are
+enabled.
+
+=head2 Locale bugs fixed
+
+printf() and sprintf() previously reset the numeric locale
+back to the default "C" locale. This has been fixed.
+
+Numbers formatted according to the local numeric locale
+(such as using a decimal comma instead of a decimal dot) caused
+"isn't numeric" warnings, even while the operations accessing
+those numbers produced correct results. These warnings have been
+discontinued.
+
+=head2 Memory leaks
+
+The C<eval 'return sub {...}'> construct could sometimes leak
+memory. This has been fixed.
+
+Operations that aren't filehandle constructors used to leak memory
+when used on invalid filehandles. This has been fixed.
+
+Constructs that modified C<@_> could fail to deallocate values
+in C<@_> and thus leak memory. This has been corrected.
+
+=head2 Spurious subroutine stubs after failed subroutine calls
+
+Perl could sometimes create empty subroutine stubs when a
+subroutine was not found in the package. Such cases stopped
+later method lookups from progressing into base packages.
+This has been corrected.
+
+=head2 Taint failures under C<-U>
+
+When running in unsafe mode, taint violations could sometimes
+cause silent failures. This has been fixed.
+
+=head2 END blocks and the C<-c> switch
+
+Prior versions used to run BEGIN B<and> END blocks when Perl was
+run in compile-only mode. Since this is typically not the expected
+behavior, END blocks are not executed anymore when the C<-c> switch
+is used, or if compilation fails.
+
+See L</"Support for CHECK blocks"> for how to run things when the compile
+phase ends.
+
+=head2 Potential to leak DATA filehandles
+
+Using the C<__DATA__> token creates an implicit filehandle to
+the file that contains the token. It is the program's
+responsibility to close it when it is done reading from it.
+
+This caveat is now better explained in the documentation.
+See L<perldata>.
+
+=head1 New or Changed Diagnostics
+
+=over 4
+
+=item "%s" variable %s masks earlier declaration in same %s
+
+(W misc) A "my" or "our" variable has been redeclared in the current scope or statement,
+effectively eliminating all access to the previous instance. This is almost
+always a typographical error. Note that the earlier variable will still exist
+until the end of the scope or until all closure referents to it are
+destroyed.
+
+=item "my sub" not yet implemented
+
+(F) Lexically scoped subroutines are not yet implemented. Don't try that
+yet.
+
+=item "our" variable %s redeclared
+
+(W misc) You seem to have already declared the same global once before in the
+current lexical scope.
+
+=item '!' allowed only after types %s
+
+(F) The '!' is allowed in pack() and unpack() only after certain types.
+See L<perlfunc/pack>.
+
+=item / cannot take a count
+
+(F) You had an unpack template indicating a counted-length string,
+but you have also specified an explicit size for the string.
+See L<perlfunc/pack>.
+
+=item / must be followed by a, A or Z
+
+(F) You had an unpack template indicating a counted-length string,
+which must be followed by one of the letters a, A or Z
+to indicate what sort of string is to be unpacked.
+See L<perlfunc/pack>.
+
+=item / must be followed by a*, A* or Z*
+
+(F) You had a pack template indicating a counted-length string,
+Currently the only things that can have their length counted are a*, A* or Z*.
+See L<perlfunc/pack>.
+
+=item / must follow a numeric type
+
+(F) You had an unpack template that contained a '#',
+but this did not follow some numeric unpack specification.
+See L<perlfunc/pack>.
+
+=item /%s/: Unrecognized escape \\%c passed through
+
+(W regexp) You used a backslash-character combination which is not recognized
+by Perl. This combination appears in an interpolated variable or a
+C<'>-delimited regular expression. The character was understood literally.
+
+=item /%s/: Unrecognized escape \\%c in character class passed through
+
+(W regexp) You used a backslash-character combination which is not recognized
+by Perl inside character classes. The character was understood literally.
+
+=item /%s/ should probably be written as "%s"
+
+(W syntax) You have used a pattern where Perl expected to find a string,
+as in the first argument to C<join>. Perl will treat the true
+or false result of matching the pattern against $_ as the string,
+which is probably not what you had in mind.
+
+=item %s() called too early to check prototype
+
+(W prototype) You've called a function that has a prototype before the parser saw a
+definition or declaration for it, and Perl could not check that the call
+conforms to the prototype. You need to either add an early prototype
+declaration for the subroutine in question, or move the subroutine
+definition ahead of the call to get proper prototype checking. Alternatively,
+if you are certain that you're calling the function correctly, you may put
+an ampersand before the name to avoid the warning. See L<perlsub>.
+
+=item %s argument is not a HASH or ARRAY element
+
+(F) The argument to exists() must be a hash or array element, such as:
+
+ $foo{$bar}
+ $ref->{"susie"}[12]
+
+=item %s argument is not a HASH or ARRAY element or slice
+
+(F) The argument to delete() must be either a hash or array element, such as:
+
+ $foo{$bar}
+ $ref->{"susie"}[12]
+
+or a hash or array slice, such as:
+
+ @foo[$bar, $baz, $xyzzy]
+ @{$ref->[12]}{"susie", "queue"}
+
+=item %s argument is not a subroutine name
+
+(F) The argument to exists() for C<exists &sub> must be a subroutine
+name, and not a subroutine call. C<exists &sub()> will generate this error.
+
+=item %s package attribute may clash with future reserved word: %s
+
+(W reserved) A lowercase attribute name was used that had a package-specific handler.
+That name might have a meaning to Perl itself some day, even though it
+doesn't yet. Perhaps you should use a mixed-case attribute name, instead.
+See L<attributes>.
+
+=item (in cleanup) %s
+
+(W misc) This prefix usually indicates that a DESTROY() method raised
+the indicated exception. Since destructors are usually called by
+the system at arbitrary points during execution, and often a vast
+number of times, the warning is issued only once for any number
+of failures that would otherwise result in the same message being
+repeated.
+
+Failure of user callbacks dispatched using the C<G_KEEPERR> flag
+could also result in this warning. See L<perlcall/G_KEEPERR>.
+
+=item <> should be quotes
+
+(F) You wrote C<< require <file> >> when you should have written
+C<require 'file'>.
+
+=item Attempt to join self
+
+(F) You tried to join a thread from within itself, which is an
+impossible task. You may be joining the wrong thread, or you may
+need to move the join() to some other thread.
+
+=item Bad evalled substitution pattern
+
+(F) You've used the /e switch to evaluate the replacement for a
+substitution, but perl found a syntax error in the code to evaluate,
+most likely an unexpected right brace '}'.
+
+=item Bad realloc() ignored
+
+(S) An internal routine called realloc() on something that had never been
+malloc()ed in the first place. Mandatory, but can be disabled by
+setting environment variable C<PERL_BADFREE> to 1.
+
+=item Bareword found in conditional
+
+(W bareword) The compiler found a bareword where it expected a conditional,
+which often indicates that an || or && was parsed as part of the
+last argument of the previous construct, for example:
+
+ open FOO || die;
+
+It may also indicate a misspelled constant that has been interpreted
+as a bareword:
+
+ use constant TYPO => 1;
+ if (TYOP) { print "foo" }
+
+The C<strict> pragma is useful in avoiding such errors.
+
+=item Binary number > 0b11111111111111111111111111111111 non-portable
+
+(W portable) The binary number you specified is larger than 2**32-1
+(4294967295) and therefore non-portable between systems. See
+L<perlport> for more on portability concerns.
+
+=item Bit vector size > 32 non-portable
+
+(W portable) Using bit vector sizes larger than 32 is non-portable.
+
+=item Buffer overflow in prime_env_iter: %s
+
+(W internal) A warning peculiar to VMS. While Perl was preparing to iterate over
+%ENV, it encountered a logical name or symbol definition which was too long,
+so it was truncated to the string shown.
+
+=item Can't check filesystem of script "%s"
+
+(P) For some reason you can't check the filesystem of the script for nosuid.
+
+=item Can't declare class for non-scalar %s in "%s"
+
+(S) Currently, only scalar variables can declared with a specific class
+qualifier in a "my" or "our" declaration. The semantics may be extended
+for other types of variables in future.
+
+=item Can't declare %s in "%s"
+
+(F) Only scalar, array, and hash variables may be declared as "my" or
+"our" variables. They must have ordinary identifiers as names.
+
+=item Can't ignore signal CHLD, forcing to default
+
+(W signal) Perl has detected that it is being run with the SIGCHLD signal
+(sometimes known as SIGCLD) disabled. Since disabling this signal
+will interfere with proper determination of exit status of child
+processes, Perl has reset the signal to its default value.
+This situation typically indicates that the parent program under
+which Perl may be running (e.g., cron) is being very careless.
+
+=item Can't modify non-lvalue subroutine call
+
+(F) Subroutines meant to be used in lvalue context should be declared as
+such, see L<perlsub/"Lvalue subroutines">.
+
+=item Can't read CRTL environ
+
+(S) A warning peculiar to VMS. Perl tried to read an element of %ENV
+from the CRTL's internal environment array and discovered the array was
+missing. You need to figure out where your CRTL misplaced its environ
+or define F<PERL_ENV_TABLES> (see L<perlvms>) so that environ is not searched.
+
+=item Can't remove %s: %s, skipping file
+
+(S) You requested an inplace edit without creating a backup file. Perl
+was unable to remove the original file to replace it with the modified
+file. The file was left unmodified.
+
+=item Can't return %s from lvalue subroutine
+
+(F) Perl detected an attempt to return illegal lvalues (such
+as temporary or readonly values) from a subroutine used as an lvalue.
+This is not allowed.
+
+=item Can't weaken a nonreference
+
+(F) You attempted to weaken something that was not a reference. Only
+references can be weakened.
+
+=item Character class [:%s:] unknown
+
+(F) The class in the character class [: :] syntax is unknown.
+See L<perlre>.
+
+=item Character class syntax [%s] belongs inside character classes
+
+(W unsafe) The character class constructs [: :], [= =], and [. .] go
+I<inside> character classes, the [] are part of the construct,
+for example: /[012[:alpha:]345]/. Note that [= =] and [. .]
+are not currently implemented; they are simply placeholders for
+future extensions.
+
+=item Constant is not %s reference
+
+(F) A constant value (perhaps declared using the C<use constant> pragma)
+is being dereferenced, but it amounts to the wrong type of reference. The
+message indicates the type of reference that was expected. This usually
+indicates a syntax error in dereferencing the constant value.
+See L<perlsub/"Constant Functions"> and L<constant>.
+
+=item constant(%s): %s
+
+(F) The parser found inconsistencies either while attempting to define an
+overloaded constant, or when trying to find the character name specified
+in the C<\N{...}> escape. Perhaps you forgot to load the corresponding
+C<overload> or C<charnames> pragma? See L<charnames> and L<overload>.
+
+=item CORE::%s is not a keyword
+
+(F) The CORE:: namespace is reserved for Perl keywords.
+
+=item defined(@array) is deprecated
+
+(D) defined() is not usually useful on arrays because it checks for an
+undefined I<scalar> value. If you want to see if the array is empty,
+just use C<if (@array) { # not empty }> for example.
+
+=item defined(%hash) is deprecated
+
+(D) defined() is not usually useful on hashes because it checks for an
+undefined I<scalar> value. If you want to see if the hash is empty,
+just use C<if (%hash) { # not empty }> for example.
+
+=item Did not produce a valid header
+
+See Server error.
+
+=item (Did you mean "local" instead of "our"?)
+
+(W misc) Remember that "our" does not localize the declared global variable.
+You have declared it again in the same lexical scope, which seems superfluous.
+
+=item Document contains no data
+
+See Server error.
+
+=item entering effective %s failed
+
+(F) While under the C<use filetest> pragma, switching the real and
+effective uids or gids failed.
+
+=item false [] range "%s" in regexp
+
+(W regexp) A character class range must start and end at a literal character, not
+another character class like C<\d> or C<[:alpha:]>. The "-" in your false
+range is interpreted as a literal "-". Consider quoting the "-", "\-".
+See L<perlre>.
+
+=item Filehandle %s opened only for output
+
+(W io) You tried to read from a filehandle opened only for writing. If you
+intended it to be a read/write filehandle, you needed to open it with
+"+<" or "+>" or "+>>" instead of with "<" or nothing. If
+you intended only to read from the file, use "<". See
+L<perlfunc/open>.
+
+=item flock() on closed filehandle %s
+
+(W closed) The filehandle you're attempting to flock() got itself closed some
+time before now. Check your logic flow. flock() operates on filehandles.
+Are you attempting to call flock() on a dirhandle by the same name?
+
+=item Global symbol "%s" requires explicit package name
+
+(F) You've said "use strict vars", which indicates that all variables
+must either be lexically scoped (using "my"), declared beforehand using
+"our", or explicitly qualified to say which package the global variable
+is in (using "::").
+
+=item Hexadecimal number > 0xffffffff non-portable
+
+(W portable) The hexadecimal number you specified is larger than 2**32-1
+(4294967295) and therefore non-portable between systems. See
+L<perlport> for more on portability concerns.
+
+=item Ill-formed CRTL environ value "%s"
+
+(W internal) A warning peculiar to VMS. Perl tried to read the CRTL's internal
+environ array, and encountered an element without the C<=> delimiter
+used to separate keys from values. The element is ignored.
+
+=item Ill-formed message in prime_env_iter: |%s|
+
+(W internal) A warning peculiar to VMS. Perl tried to read a logical name
+or CLI symbol definition when preparing to iterate over %ENV, and
+didn't see the expected delimiter between key and value, so the
+line was ignored.
+
+=item Illegal binary digit %s
+
+(F) You used a digit other than 0 or 1 in a binary number.
+
+=item Illegal binary digit %s ignored
+
+(W digit) You may have tried to use a digit other than 0 or 1 in a binary number.
+Interpretation of the binary number stopped before the offending digit.
+
+=item Illegal number of bits in vec
+
+(F) The number of bits in vec() (the third argument) must be a power of
+two from 1 to 32 (or 64, if your platform supports that).
+
+=item Integer overflow in %s number
+
+(W overflow) The hexadecimal, octal or binary number you have specified either
+as a literal or as an argument to hex() or oct() is too big for your
+architecture, and has been converted to a floating point number. On a
+32-bit architecture the largest hexadecimal, octal or binary number
+representable without overflow is 0xFFFFFFFF, 037777777777, or
+0b11111111111111111111111111111111 respectively. Note that Perl
+transparently promotes all numbers to a floating point representation
+internally--subject to loss of precision errors in subsequent
+operations.
+
+=item Invalid %s attribute: %s
+
+The indicated attribute for a subroutine or variable was not recognized
+by Perl or by a user-supplied handler. See L<attributes>.
+
+=item Invalid %s attributes: %s
+
+The indicated attributes for a subroutine or variable were not recognized
+by Perl or by a user-supplied handler. See L<attributes>.
+
+=item invalid [] range "%s" in regexp
+
+The offending range is now explicitly displayed.
+
+=item Invalid separator character %s in attribute list
+
+(F) Something other than a colon or whitespace was seen between the
+elements of an attribute list. If the previous attribute
+had a parenthesised parameter list, perhaps that list was terminated
+too soon. See L<attributes>.
+
+=item Invalid separator character %s in subroutine attribute list
+
+(F) Something other than a colon or whitespace was seen between the
+elements of a subroutine attribute list. If the previous attribute
+had a parenthesised parameter list, perhaps that list was terminated
+too soon.
+
+=item leaving effective %s failed
+
+(F) While under the C<use filetest> pragma, switching the real and
+effective uids or gids failed.
+
+=item Lvalue subs returning %s not implemented yet
+
+(F) Due to limitations in the current implementation, array and hash
+values cannot be returned in subroutines used in lvalue context.
+See L<perlsub/"Lvalue subroutines">.
+
+=item Method %s not permitted
+
+See Server error.
+
+=item Missing %sbrace%s on \N{}
+
+(F) Wrong syntax of character name literal C<\N{charname}> within
+double-quotish context.
+
+=item Missing command in piped open
+
+(W pipe) You used the C<open(FH, "| command")> or C<open(FH, "command |")>
+construction, but the command was missing or blank.
+
+=item Missing name in "my sub"
+
+(F) The reserved syntax for lexically scoped subroutines requires that they
+have a name with which they can be found.
+
+=item No %s specified for -%c
+
+(F) The indicated command line switch needs a mandatory argument, but
+you haven't specified one.
+
+=item No package name allowed for variable %s in "our"
+
+(F) Fully qualified variable names are not allowed in "our" declarations,
+because that doesn't make much sense under existing semantics. Such
+syntax is reserved for future extensions.
+
+=item No space allowed after -%c
+
+(F) The argument to the indicated command line switch must follow immediately
+after the switch, without intervening spaces.
+
+=item no UTC offset information; assuming local time is UTC
+
+(S) A warning peculiar to VMS. Perl was unable to find the local
+timezone offset, so it's assuming that local system time is equivalent
+to UTC. If it's not, define the logical name F<SYS$TIMEZONE_DIFFERENTIAL>
+to translate to the number of seconds which need to be added to UTC to
+get local time.
+
+=item Octal number > 037777777777 non-portable
+
+(W portable) The octal number you specified is larger than 2**32-1 (4294967295)
+and therefore non-portable between systems. See L<perlport> for more
+on portability concerns.
+
+See also L<perlport> for writing portable code.
+
+=item panic: del_backref
+
+(P) Failed an internal consistency check while trying to reset a weak
+reference.
+
+=item panic: kid popen errno read
+
+(F) forked child returned an incomprehensible message about its errno.
+
+=item panic: magic_killbackrefs
+
+(P) Failed an internal consistency check while trying to reset all weak
+references to an object.
+
+=item Parentheses missing around "%s" list
+
+(W parenthesis) You said something like
+
+ my $foo, $bar = @_;
+
+when you meant
+
+ my ($foo, $bar) = @_;
+
+Remember that "my", "our", and "local" bind tighter than comma.
+
+=item Possible unintended interpolation of %s in string
+
+(W ambiguous) It used to be that Perl would try to guess whether you
+wanted an array interpolated or a literal @. It no longer does this;
+arrays are now I<always> interpolated into strings. This means that
+if you try something like:
+
+ print "fred@example.com";
+
+and the array C<@example> doesn't exist, Perl is going to print
+C<fred.com>, which is probably not what you wanted. To get a literal
+C<@> sign in a string, put a backslash before it, just as you would
+to get a literal C<$> sign.
+
+=item Possible Y2K bug: %s
+
+(W y2k) You are concatenating the number 19 with another number, which
+could be a potential Year 2000 problem.
+
+=item pragma "attrs" is deprecated, use "sub NAME : ATTRS" instead
+
+(W deprecated) You have written something like this:
+
+ sub doit
+ {
+ use attrs qw(locked);
+ }
+
+You should use the new declaration syntax instead.
+
+ sub doit : locked
+ {
+ ...
+
+The C<use attrs> pragma is now obsolete, and is only provided for
+backward-compatibility. See L<perlsub/"Subroutine Attributes">.
+
+
+=item Premature end of script headers
+
+See Server error.
+
+=item Repeat count in pack overflows
+
+(F) You can't specify a repeat count so large that it overflows
+your signed integers. See L<perlfunc/pack>.
+
+=item Repeat count in unpack overflows
+
+(F) You can't specify a repeat count so large that it overflows
+your signed integers. See L<perlfunc/unpack>.
+
+=item realloc() of freed memory ignored
+
+(S) An internal routine called realloc() on something that had already
+been freed.
+
+=item Reference is already weak
+
+(W misc) You have attempted to weaken a reference that is already weak.
+Doing so has no effect.
+
+=item setpgrp can't take arguments
+
+(F) Your system has the setpgrp() from BSD 4.2, which takes no arguments,
+unlike POSIX setpgid(), which takes a process ID and process group ID.
+
+=item Strange *+?{} on zero-length expression
+
+(W regexp) You applied a regular expression quantifier in a place where it
+makes no sense, such as on a zero-width assertion.
+Try putting the quantifier inside the assertion instead. For example,
+the way to match "abc" provided that it is followed by three
+repetitions of "xyz" is C</abc(?=(?:xyz){3})/>, not C</abc(?=xyz){3}/>.
+
+=item switching effective %s is not implemented
+
+(F) While under the C<use filetest> pragma, we cannot switch the
+real and effective uids or gids.
+
+=item This Perl can't reset CRTL environ elements (%s)
+
+=item This Perl can't set CRTL environ elements (%s=%s)
+
+(W internal) Warnings peculiar to VMS. You tried to change or delete an element
+of the CRTL's internal environ array, but your copy of Perl wasn't
+built with a CRTL that contained the setenv() function. You'll need to
+rebuild Perl with a CRTL that does, or redefine F<PERL_ENV_TABLES> (see
+L<perlvms>) so that the environ array isn't the target of the change to
+%ENV which produced the warning.
+
+=item Too late to run %s block
+
+(W void) A CHECK or INIT block is being defined during run time proper,
+when the opportunity to run them has already passed. Perhaps you are
+loading a file with C<require> or C<do> when you should be using
+C<use> instead. Or perhaps you should put the C<require> or C<do>
+inside a BEGIN block.
+
+=item Unknown open() mode '%s'
+
+(F) The second argument of 3-argument open() is not among the list
+of valid modes: C<< < >>, C<< > >>, C<<< >> >>>, C<< +< >>,
+C<< +> >>, C<<< +>> >>>, C<-|>, C<|->.
+
+=item Unknown process %x sent message to prime_env_iter: %s
+
+(P) An error peculiar to VMS. Perl was reading values for %ENV before
+iterating over it, and someone else stuck a message in the stream of
+data Perl expected. Someone's very confused, or perhaps trying to
+subvert Perl's population of %ENV for nefarious purposes.
+
+=item Unrecognized escape \\%c passed through
+
+(W misc) You used a backslash-character combination which is not recognized
+by Perl. The character was understood literally.
+
+=item Unterminated attribute parameter in attribute list
+
+(F) The lexer saw an opening (left) parenthesis character while parsing an
+attribute list, but the matching closing (right) parenthesis
+character was not found. You may need to add (or remove) a backslash
+character to get your parentheses to balance. See L<attributes>.
+
+=item Unterminated attribute list
+
+(F) The lexer found something other than a simple identifier at the start
+of an attribute, and it wasn't a semicolon or the start of a
+block. Perhaps you terminated the parameter list of the previous attribute
+too soon. See L<attributes>.
+
+=item Unterminated attribute parameter in subroutine attribute list
+
+(F) The lexer saw an opening (left) parenthesis character while parsing a
+subroutine attribute list, but the matching closing (right) parenthesis
+character was not found. You may need to add (or remove) a backslash
+character to get your parentheses to balance.
+
+=item Unterminated subroutine attribute list
+
+(F) The lexer found something other than a simple identifier at the start
+of a subroutine attribute, and it wasn't a semicolon or the start of a
+block. Perhaps you terminated the parameter list of the previous attribute
+too soon.
+
+=item Value of CLI symbol "%s" too long
+
+(W misc) A warning peculiar to VMS. Perl tried to read the value of an %ENV
+element from a CLI symbol table, and found a resultant string longer
+than 1024 characters. The return value has been truncated to 1024
+characters.
+
+=item Version number must be a constant number
+
+(P) The attempt to translate a C<use Module n.n LIST> statement into
+its equivalent C<BEGIN> block found an internal inconsistency with
+the version number.
+
+=back
+
+=head1 New tests
+
+=over 4
+
+=item lib/attrs
+
+Compatibility tests for C<sub : attrs> vs the older C<use attrs>.
+
+=item lib/env
+
+Tests for new environment scalar capability (e.g., C<use Env qw($BAR);>).
+
+=item lib/env-array
+
+Tests for new environment array capability (e.g., C<use Env qw(@PATH);>).
+
+=item lib/io_const
+
+IO constants (SEEK_*, _IO*).
+
+=item lib/io_dir
+
+Directory-related IO methods (new, read, close, rewind, tied delete).
+
+=item lib/io_multihomed
+
+INET sockets with multi-homed hosts.
+
+=item lib/io_poll
+
+IO poll().
+
+=item lib/io_unix
+
+UNIX sockets.
+
+=item op/attrs
+
+Regression tests for C<my ($x,@y,%z) : attrs> and <sub : attrs>.
+
+=item op/filetest
+
+File test operators.
+
+=item op/lex_assign
+
+Verify operations that access pad objects (lexicals and temporaries).
+
+=item op/exists_sub
+
+Verify C<exists &sub> operations.
+
+=back
+
+=head1 Incompatible Changes
+
+=head2 Perl Source Incompatibilities
+
+Beware that any new warnings that have been added or old ones
+that have been enhanced are B<not> considered incompatible changes.
+
+Since all new warnings must be explicitly requested via the C<-w>
+switch or the C<warnings> pragma, it is ultimately the programmer's
+responsibility to ensure that warnings are enabled judiciously.
+
+=over 4
+
+=item CHECK is a new keyword
+
+All subroutine definitions named CHECK are now special. See
+C</"Support for CHECK blocks"> for more information.
+
+=item Treatment of list slices of undef has changed
+
+There is a potential incompatibility in the behavior of list slices
+that are comprised entirely of undefined values.
+See L</"Behavior of list slices is more consistent">.
+
+=item Format of $English::PERL_VERSION is different
+
+The English module now sets $PERL_VERSION to $^V (a string value) rather
+than C<$]> (a numeric value). This is a potential incompatibility.
+Send us a report via perlbug if you are affected by this.
+
+See L</"Improved Perl version numbering system"> for the reasons for
+this change.
+
+=item Literals of the form C<1.2.3> parse differently
+
+Previously, numeric literals with more than one dot in them were
+interpreted as a floating point number concatenated with one or more
+numbers. Such "numbers" are now parsed as strings composed of the
+specified ordinals.
+
+For example, C<print 97.98.99> used to output C<97.9899> in earlier
+versions, but now prints C<abc>.
+
+See L</"Support for strings represented as a vector of ordinals">.
+
+=item Possibly changed pseudo-random number generator
+
+Perl programs that depend on reproducing a specific set of pseudo-random
+numbers may now produce different output due to improvements made to the
+rand() builtin. You can use C<sh Configure -Drandfunc=rand> to obtain
+the old behavior.
+
+See L</"Better pseudo-random number generator">.
+
+=item Hashing function for hash keys has changed
+
+Even though Perl hashes are not order preserving, the apparently
+random order encountered when iterating on the contents of a hash
+is actually determined by the hashing algorithm used. Improvements
+in the algorithm may yield a random order that is B<different> from
+that of previous versions, especially when iterating on hashes.
+
+See L</"Better worst-case behavior of hashes"> for additional
+information.
+
+=item C<undef> fails on read only values
+
+Using the C<undef> operator on a readonly value (such as $1) has
+the same effect as assigning C<undef> to the readonly value--it
+throws an exception.
+
+=item Close-on-exec bit may be set on pipe and socket handles
+
+Pipe and socket handles are also now subject to the close-on-exec
+behavior determined by the special variable $^F.
+
+See L</"More consistent close-on-exec behavior">.
+
+=item Writing C<"$$1"> to mean C<"${$}1"> is unsupported
+
+Perl 5.004 deprecated the interpretation of C<$$1> and
+similar within interpolated strings to mean C<$$ . "1">,
+but still allowed it.
+
+In Perl 5.6.0 and later, C<"$$1"> always means C<"${$1}">.
+
+=item delete(), each(), values() and C<\(%h)>
+
+operate on aliases to values, not copies
+
+delete(), each(), values() and hashes (e.g. C<\(%h)>)
+in a list context return the actual
+values in the hash, instead of copies (as they used to in earlier
+versions). Typical idioms for using these constructs copy the
+returned values, but this can make a significant difference when
+creating references to the returned values. Keys in the hash are still
+returned as copies when iterating on a hash.
+
+See also L</"delete(), each(), values() and hash iteration are faster">.
+
+=item vec(EXPR,OFFSET,BITS) enforces powers-of-two BITS
+
+vec() generates a run-time error if the BITS argument is not
+a valid power-of-two integer.
+
+=item Text of some diagnostic output has changed
+
+Most references to internal Perl operations in diagnostics
+have been changed to be more descriptive. This may be an
+issue for programs that may incorrectly rely on the exact
+text of diagnostics for proper functioning.
+
+=item C<%@> has been removed
+
+The undocumented special variable C<%@> that used to accumulate
+"background" errors (such as those that happen in DESTROY())
+has been removed, because it could potentially result in memory
+leaks.
+
+=item Parenthesized not() behaves like a list operator
+
+The C<not> operator now falls under the "if it looks like a function,
+it behaves like a function" rule.
+
+As a result, the parenthesized form can be used with C<grep> and C<map>.
+The following construct used to be a syntax error before, but it works
+as expected now:
+
+ grep not($_), @things;
+
+On the other hand, using C<not> with a literal list slice may not
+work. The following previously allowed construct:
+
+ print not (1,2,3)[0];
+
+needs to be written with additional parentheses now:
+
+ print not((1,2,3)[0]);
+
+The behavior remains unaffected when C<not> is not followed by parentheses.
+
+=item Semantics of bareword prototype C<(*)> have changed
+
+The semantics of the bareword prototype C<*> have changed. Perl 5.005
+always coerced simple scalar arguments to a typeglob, which wasn't useful
+in situations where the subroutine must distinguish between a simple
+scalar and a typeglob. The new behavior is to not coerce bareword
+arguments to a typeglob. The value will always be visible as either
+a simple scalar or as a reference to a typeglob.
+
+See L</"More functional bareword prototype (*)">.
+
+=item Semantics of bit operators may have changed on 64-bit platforms
+
+If your platform is either natively 64-bit or if Perl has been
+configured to used 64-bit integers, i.e., $Config{ivsize} is 8,
+there may be a potential incompatibility in the behavior of bitwise
+numeric operators (& | ^ ~ << >>). These operators used to strictly
+operate on the lower 32 bits of integers in previous versions, but now
+operate over the entire native integral width. In particular, note
+that unary C<~> will produce different results on platforms that have
+different $Config{ivsize}. For portability, be sure to mask off
+the excess bits in the result of unary C<~>, e.g., C<~$x & 0xffffffff>.
+
+See L</"Bit operators support full native integer width">.
+
+=item More builtins taint their results
+
+As described in L</"Improved security features">, there may be more
+sources of taint in a Perl program.
+
+To avoid these new tainting behaviors, you can build Perl with the
+Configure option C<-Accflags=-DINCOMPLETE_TAINTS>. Beware that the
+ensuing perl binary may be insecure.
+
+=back
+
+=head2 C Source Incompatibilities
+
+=over 4
+
+=item C<PERL_POLLUTE>
+
+Release 5.005 grandfathered old global symbol names by providing preprocessor
+macros for extension source compatibility. As of release 5.6.0, these
+preprocessor definitions are not available by default. You need to explicitly
+compile perl with C<-DPERL_POLLUTE> to get these definitions. For
+extensions still using the old symbols, this option can be
+specified via MakeMaker:
+
+ perl Makefile.PL POLLUTE=1
+
+=item C<PERL_IMPLICIT_CONTEXT>
+
+This new build option provides a set of macros for all API functions
+such that an implicit interpreter/thread context argument is passed to
+every API function. As a result of this, something like C<sv_setsv(foo,bar)>
+amounts to a macro invocation that actually translates to something like
+C<Perl_sv_setsv(my_perl,foo,bar)>. While this is generally expected
+to not have any significant source compatibility issues, the difference
+between a macro and a real function call will need to be considered.
+
+This means that there B<is> a source compatibility issue as a result of
+this if your extensions attempt to use pointers to any of the Perl API
+functions.
+
+Note that the above issue is not relevant to the default build of
+Perl, whose interfaces continue to match those of prior versions
+(but subject to the other options described here).
+
+See L<perlguts/"The Perl API"> for detailed information on the
+ramifications of building Perl with this option.
+
+ NOTE: PERL_IMPLICIT_CONTEXT is automatically enabled whenever Perl is built
+ with one of -Dusethreads, -Dusemultiplicity, or both. It is not
+ intended to be enabled by users at this time.
+
+=item C<PERL_POLLUTE_MALLOC>
+
+Enabling Perl's malloc in release 5.005 and earlier caused the namespace of
+the system's malloc family of functions to be usurped by the Perl versions,
+since by default they used the same names. Besides causing problems on
+platforms that do not allow these functions to be cleanly replaced, this
+also meant that the system versions could not be called in programs that
+used Perl's malloc. Previous versions of Perl have allowed this behaviour
+to be suppressed with the HIDEMYMALLOC and EMBEDMYMALLOC preprocessor
+definitions.
+
+As of release 5.6.0, Perl's malloc family of functions have default names
+distinct from the system versions. You need to explicitly compile perl with
+C<-DPERL_POLLUTE_MALLOC> to get the older behaviour. HIDEMYMALLOC
+and EMBEDMYMALLOC have no effect, since the behaviour they enabled is now
+the default.
+
+Note that these functions do B<not> constitute Perl's memory allocation API.
+See L<perlguts/"Memory Allocation"> for further information about that.
+
+=back
+
+=head2 Compatible C Source API Changes
+
+=over 4
+
+=item C<PATCHLEVEL> is now C<PERL_VERSION>
+
+The cpp macros C<PERL_REVISION>, C<PERL_VERSION>, and C<PERL_SUBVERSION>
+are now available by default from perl.h, and reflect the base revision,
+patchlevel, and subversion respectively. C<PERL_REVISION> had no
+prior equivalent, while C<PERL_VERSION> and C<PERL_SUBVERSION> were
+previously available as C<PATCHLEVEL> and C<SUBVERSION>.
+
+The new names cause less pollution of the B<cpp> namespace and reflect what
+the numbers have come to stand for in common practice. For compatibility,
+the old names are still supported when F<patchlevel.h> is explicitly
+included (as required before), so there is no source incompatibility
+from the change.
+
+=back
+
+=head2 Binary Incompatibilities
+
+In general, the default build of this release is expected to be binary
+compatible for extensions built with the 5.005 release or its maintenance
+versions. However, specific platforms may have broken binary compatibility
+due to changes in the defaults used in hints files. Therefore, please be
+sure to always check the platform-specific README files for any notes to
+the contrary.
+
+The usethreads or usemultiplicity builds are B<not> binary compatible
+with the corresponding builds in 5.005.
+
+On platforms that require an explicit list of exports (AIX, OS/2 and Windows,
+among others), purely internal symbols such as parser functions and the
+run time opcodes are not exported by default. Perl 5.005 used to export
+all functions irrespective of whether they were considered part of the
+public API or not.
+
+For the full list of public API functions, see L<perlapi>.
+
+=head1 Known Problems
+
+=head2 Localizing a tied hash element may leak memory
+
+As of the 5.6.1 release, there is a known leak when code such as this
+is executed:
+
+ use Tie::Hash;
+ tie my %tie_hash => 'Tie::StdHash';
+
+ ...
+
+ local($tie_hash{Foo}) = 1; # leaks
+
+=head2 Known test failures
+
+=over
+
+=item 64-bit builds
+
+Subtest #15 of lib/b.t may fail under 64-bit builds on platforms such
+as HP-UX PA64 and Linux IA64. The issue is still being investigated.
+
+The lib/io_multihomed test may hang in HP-UX if Perl has been
+configured to be 64-bit. Because other 64-bit platforms do not
+hang in this test, HP-UX is suspect. All other tests pass
+in 64-bit HP-UX. The test attempts to create and connect to
+"multihomed" sockets (sockets which have multiple IP addresses).
+
+Note that 64-bit support is still experimental.
+
+=item Failure of Thread tests
+
+The subtests 19 and 20 of lib/thr5005.t test are known to fail due to
+fundamental problems in the 5.005 threading implementation. These are
+not new failures--Perl 5.005_0x has the same bugs, but didn't have these
+tests. (Note that support for 5.005-style threading remains experimental.)
+
+=item NEXTSTEP 3.3 POSIX test failure
+
+In NEXTSTEP 3.3p2 the implementation of the strftime(3) in the
+operating system libraries is buggy: the %j format numbers the days of
+a month starting from zero, which, while being logical to programmers,
+will cause the subtests 19 to 27 of the lib/posix test may fail.
+
+=item Tru64 (aka Digital UNIX, aka DEC OSF/1) lib/sdbm test failure with gcc
+
+If compiled with gcc 2.95 the lib/sdbm test will fail (dump core).
+The cure is to use the vendor cc, it comes with the operating system
+and produces good code.
+
+=back
+
+=head2 EBCDIC platforms not fully supported
+
+In earlier releases of Perl, EBCDIC environments like OS390 (also
+known as Open Edition MVS) and VM-ESA were supported. Due to changes
+required by the UTF-8 (Unicode) support, the EBCDIC platforms are not
+supported in Perl 5.6.0.
+
+The 5.6.1 release improves support for EBCDIC platforms, but they
+are not fully supported yet.
+
+=head2 UNICOS/mk CC failures during Configure run
+
+In UNICOS/mk the following errors may appear during the Configure run:
+
+ Guessing which symbols your C compiler and preprocessor define...
+ CC-20 cc: ERROR File = try.c, Line = 3
+ ...
+ bad switch yylook 79bad switch yylook 79bad switch yylook 79bad switch yylook 79#ifdef A29K
+ ...
+ 4 errors detected in the compilation of "try.c".
+
+The culprit is the broken awk of UNICOS/mk. The effect is fortunately
+rather mild: Perl itself is not adversely affected by the error, only
+the h2ph utility coming with Perl, and that is rather rarely needed
+these days.
+
+=head2 Arrow operator and arrays
+
+When the left argument to the arrow operator C<< -> >> is an array, or
+the C<scalar> operator operating on an array, the result of the
+operation must be considered erroneous. For example:
+
+ @x->[2]
+ scalar(@x)->[2]
+
+These expressions will get run-time errors in some future release of
+Perl.
+
+=head2 Experimental features
+
+As discussed above, many features are still experimental. Interfaces and
+implementation of these features are subject to change, and in extreme cases,
+even subject to removal in some future release of Perl. These features
+include the following:
+
+=over 4
+
+=item Threads
+
+=item Unicode
+
+=item 64-bit support
+
+=item Lvalue subroutines
+
+=item Weak references
+
+=item The pseudo-hash data type
+
+=item The Compiler suite
+
+=item Internal implementation of file globbing
+
+=item The DB module
+
+=item The regular expression code constructs:
+
+C<(?{ code })> and C<(??{ code })>
+
+=back
+
+=head1 Obsolete Diagnostics
+
+=over 4
+
+=item Character class syntax [: :] is reserved for future extensions
+
+(W) Within regular expression character classes ([]) the syntax beginning
+with "[:" and ending with ":]" is reserved for future extensions.
+If you need to represent those character sequences inside a regular
+expression character class, just quote the square brackets with the
+backslash: "\[:" and ":\]".
+
+=item Ill-formed logical name |%s| in prime_env_iter
+
+(W) A warning peculiar to VMS. A logical name was encountered when preparing
+to iterate over %ENV which violates the syntactic rules governing logical
+names. Because it cannot be translated normally, it is skipped, and will not
+appear in %ENV. This may be a benign occurrence, as some software packages
+might directly modify logical name tables and introduce nonstandard names,
+or it may indicate that a logical name table has been corrupted.
+
+=item In string, @%s now must be written as \@%s
+
+The description of this error used to say:
+
+ (Someday it will simply assume that an unbackslashed @
+ interpolates an array.)
+
+That day has come, and this fatal error has been removed. It has been
+replaced by a non-fatal warning instead.
+See L</Arrays now always interpolate into double-quoted strings> for
+details.
+
+=item Probable precedence problem on %s
+
+(W) The compiler found a bareword where it expected a conditional,
+which often indicates that an || or && was parsed as part of the
+last argument of the previous construct, for example:
+
+ open FOO || die;
+
+=item regexp too big
+
+(F) The current implementation of regular expressions uses shorts as
+address offsets within a string. Unfortunately this means that if
+the regular expression compiles to longer than 32767, it'll blow up.
+Usually when you want a regular expression this big, there is a better
+way to do it with multiple statements. See L<perlre>.
+
+=item Use of "$$<digit>" to mean "${$}<digit>" is deprecated
+
+(D) Perl versions before 5.004 misinterpreted any type marker followed
+by "$" and a digit. For example, "$$0" was incorrectly taken to mean
+"${$}0" instead of "${$0}". This bug is (mostly) fixed in Perl 5.004.
+
+However, the developers of Perl 5.004 could not fix this bug completely,
+because at least two widely-used modules depend on the old meaning of
+"$$0" in a string. So Perl 5.004 still interprets "$$<digit>" in the
+old (broken) way inside strings; but it generates this message as a
+warning. And in Perl 5.005, this special treatment will cease.
+
+=back
+
+=head1 Reporting Bugs
+
+If you find what you think is a bug, you might check the
+articles recently posted to the comp.lang.perl.misc newsgroup.
+There may also be information at http://www.perl.com/, the Perl
+Home Page.
+
+If you believe you have an unreported bug, please run the B<perlbug>
+program included with your release. Be sure to trim your bug down
+to a tiny but sufficient test case. Your bug report, along with the
+output of C<perl -V>, will be sent off to perlbug@perl.org to be
+analysed by the Perl porting team.
+
+=head1 SEE ALSO
+
+The F<Changes> file for exhaustive details on what changed.
+
+The F<INSTALL> file for how to build Perl.
+
+The F<README> file for general stuff.
+
+The F<Artistic> and F<Copying> files for copyright information.
+
+=head1 HISTORY
+
+Written by Gurusamy Sarathy <F<gsar@ActiveState.com>>, with many
+contributions from The Perl Porters.
+
+Send omissions or corrections to <F<perlbug@perl.org>>.
+
+=cut
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index f8cf85f13f..31e9b30435 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -4,8 +4,45 @@ perldelta - what is new for perl v5.8.0
=head1 DESCRIPTION
-This document describes differences between the 5.6.0 release and the
-5.8.0 release.
+This document describes differences between the 5.6.0 release
+and the 5.8.0 release.
+
+Many of the bug fixes in 5.8.0 were already seen in the 5.6.1
+maintenance release since the two releases were kept closely
+coordinated.
+
+If you are upgrading from Perl 5.005_03, you might also want
+to read L<perl56delta>.
+
+=head1 Highlights In 5.8.0
+
+=over 4
+
+=item *
+
+Better Unicode support
+
+=item *
+
+New Thread Implementation
+
+=item *
+
+Many New Modules
+
+=item *
+
+Better Numeric Accuracy
+
+=item *
+
+Safe Signals
+
+=item *
+
+More Extensive Regression Testing
+
+=back
=head1 Incompatible Changes
@@ -35,6 +72,13 @@ statically built in. This may or may not be a problem with ancient
TCP/IP stacks of VMS: we do not know since we weren't able to test
Perl in such configurations.
+=head2 IEEE-format Floating Point Default on OpenVMS Alpha
+
+Perl now uses IEEE format (T_FLOAT) as the default internal floating
+point format on OpenVMS Alpha, potentially breaking binary compatibility
+with external libraries or existing data. G_FLOAT is still available as
+a configuration option. The default on VAX (D_FLOAT) has not changed.
+
=head2 Different Definition of the Unicode Character Classes \p{In...}
As suggested by the Unicode consortium, the Unicode character classes
@@ -105,11 +149,17 @@ any C<\w> character.
=item *
The list of filenames from glob() (or <...>) is now by default sorted
-alphabetically to be csh-compliant. (bsd_glob() does still sort platform
+alphabetically to be csh-compliant (which is what happened before
+in most UNIX platforms). (bsd_glob() does still sort platform
natively, ASCII or EBCDIC, unless GLOB_ALPHASORT is specified.)
=item *
+Spurious syntax errors generated in certain situations, when glob()
+caused File::Glob to be loaded for the first time, have been fixed.
+
+=item *
+
Although "you shouldn't do that", it was possible to write code that
depends on Perl's hashed key order (Data::Dumper does this). The new
algorithm "One-at-a-Time" produces a different hashed key order.
@@ -323,6 +373,7 @@ Formats now support zero-padded decimal fields.
=item *
Lvalue subroutines can now return C<undef> in list context.
+However, the lvalue subroutine feature still remains experimental.
=item *
@@ -358,8 +409,9 @@ C<%\d+\$> and C<*\d+\$> syntaxes. For example
print "%2\$s %1\$s\n", "foo", "bar";
-will print "bar foo\n"; This feature helps in writing
-internationalised software.
+will print "bar foo\n". This feature helps in writing
+internationalised software, and in general when the order
+of the parameters can vary.
=item *
@@ -372,7 +424,8 @@ prototype(\[$@%&]) is now available to implicitly create references
=item *
-UNTIE method is now recognised.
+untie() will now call an UNTIE() hook if it exists. See L<perltie>
+for details.
=item *
@@ -799,6 +852,11 @@ using B::Deparse.
=item *
+DB_File now supports newer Berkeley DB versions, among
+other improvements.
+
+=item *
+
The English module can now be used without the infamous performance
hit by saying
@@ -816,6 +874,10 @@ This means that they will be more robust and hopefully faster.
=item *
+File::Find now chdir()s correctly when chasing symbolic links.
+
+=item *
+
File::Find now has pre- and post-processing callbacks. It also
correctly changes directories when chasing symbolic links. Callbacks
(naughtily) exiting with "next;" instead of "return;" now work.
@@ -875,20 +937,35 @@ bignum libraries such as GMP and PARI as their backends.
=item *
+Math::Complex handles inf, NaN etc., better.
+
+=item *
+
Net::Ping has been enhanced. There is now "external" protocol which
uses Net::Ping::External module which runs external ping(1) and parses
-the output. An alpha version of Net::Ping::External is available in
-CPAN and in 5.7.2 the Net::Ping::External may be integrated to Perl.
+the output. A version of Net::Ping::External is available in CPAN.
=item *
-C<POSIX::sigaction()> is now much more flexible and robust.
+POSIX::sigaction() is now much more flexible and robust.
You can now install coderef handlers, 'DEFAULT', and 'IGNORE'
handlers, installing new handlers was not atomic.
=item *
-C<%INC> now localised in a Safe compartment so that use/require work.
+In Safe the C<%INC> now localised in a Safe compartment so that
+use/require work.
+
+=item *
+
+In SDBM_File on dosish platforms, some keys went missing because of
+lack of support for files with "holes". A workaround for the problem
+has been added.
+
+=item *
+
+In Search::Dict one can now have a pre-processing hook for the
+lines being searched.
=item *
@@ -900,7 +977,7 @@ The Test module has been significantly enhanced.
=item *
-The C<vars> pragma now supports declaring fully qualified variables.
+The vars pragma now supports declaring fully qualified variables.
(Something that C<our()> does not and will not support.)
=item *
@@ -963,6 +1040,7 @@ perl.org, not perl.com.
C<perlcc> has been rewritten and its user interface (that is,
command line) is much more like that of the UNIX C compiler, cc.
+(The perlbc tools has been removed. Use C<perlcc -B> instead.)
=item *
@@ -1103,7 +1181,9 @@ confusion with the perlwin32 documentation on 8.3-restricted filesystems.
=item *
-map() that changes the size of the list should now work faster.
+map() could get pathologically slow when the result list it generates
+is larger than the source list. The performance has been improved for
+common scenarios.
=item *
@@ -1252,6 +1332,11 @@ Configure C<-S> can now run non-interactively.
=item *
+Configure support for pdp11-style memory models has been removed due
+to obsolescence.
+
+=item *
+
configure.gnu now works with options with whitespace in them.
=item *
@@ -1447,6 +1532,10 @@ NonStop-UX is now supported.
=item *
+NEC SUPER-UX is now supported.
+
+=item *
+
Amdahl UTS UNIX mainframe platform is now supported.
=item *
@@ -1475,6 +1564,11 @@ The autouse pragma didn't work for Multi::Part::Function::Names.
=item *
+caller() could cause core dumps in certain situations. Carp was sometimes
+affected by this problem.
+
+=item *
+
chop(@list) in list context returned the characters chopped in
reverse order. This has been reversed to be in the right order.
@@ -1501,8 +1595,13 @@ The order of DESTROYs has been made more predictable.
Several debugger fixes: exit code now reflects the script exit code,
condition C<"0"> now treated correctly, the C<d> command now checks
-line number, the C<$.> no longer gets corrupted, all debugger output now
-goes correctly to the socket if RemotePort is set.
+line number, the C<$.> no longer gets corrupted, all debugger output
+now goes correctly to the socket if RemotePort is set.
+
+=item *
+
+Perl 5.6.0 could emit spurious warnings about redefinition of dl_error()
+when statically building extensions into perl. This has been corrected.
=item *
@@ -1511,6 +1610,9 @@ L<dprofpp> -R didn't work.
=item *
C<*foo{FORMAT}> now works.
+=item *
+
+Infinity is now recognized as a number.
=item *
@@ -1530,7 +1632,18 @@ were declared before the lexicals.
=item *
-Lexical warnings now propagating correctly between scopes.
+Lexical warnings now propagating correctly between scopes
+and into C<eval "...">.
+
+=item *
+
+C<use warnings qw(FATAL all)> did not work as intended. This has been
+corrected.
+
+=item *
+
+warnings::enabled() now reports the state of $^W correctly if the caller
+isn't using lexical warnings.
=item *
@@ -1564,6 +1677,11 @@ more compatible with 5.005. Infinity is now recognised as a number.
=item *
+Numeric conversions did not recognize changes in the string value
+properly in certain circumstances.
+
+=item *
+
Attributes (like :shared) didn't work with our().
=item *
@@ -1572,6 +1690,12 @@ our() variables will not cause "will not stay shared" warnings.
=item *
+"our" variables of the same name declared in two sibling blocks
+resulted in bogus warnings about "redeclaration" of the variables.
+The problem has been corrected.
+
+=item *
+
pack "Z" now correctly terminates the string with "\0".
=item *
@@ -1594,7 +1718,12 @@ printf() no longer resets the numeric locale to "C".
=item *
-C<q(a\\b)> now parses correctly as C<'a\\b'>.
+C<qw(a\\b)> now parses correctly as C<'a\\b'>.
+
+=item *
+
+pos() did not return the correct value within s///ge in earlier
+versions. This is now handled correctly.
=item *
@@ -1622,6 +1751,8 @@ SOCKS support is now much more robust.
sort() arguments are now compiled in the right wantarray context
(they were accidentally using the context of the sort() itself).
+The comparison block is now run in scalar context, and the arguments
+to be sorted are always provided list context.
=item *
@@ -1638,13 +1769,49 @@ behaviour consistent with that of string interpolation.
=item *
+Some cases of inconsistent taint propagation (such as within hash
+values) have been fixed.
+
+=item *
+
+The RE engine found in Perl 5.6.0 accidentally pessimised certain kinds
+of simple pattern matches. These are now handled better.
+
+=item *
+
+Regular expression debug output (whether through C<use re 'debug'>
+or via C<-Dr>) now looks better.
+
+=item *
+
+Multi-line matches like C<"a\nxb\n" =~ /(?!\A)x/m> were flawed. The
+bug has been fixed.
+
+=item *
+
+Use of $& could trigger a core dump under some situations. This
+is now avoided.
+
+=item *
+
The regular expression captured submatches ($1, $2, ...) are now
more consistently unset if the match fails, instead of leaving false
data lying around in them.
=item *
-C<Sys::Syslog> ignored the C<LOG_AUTH> constant.
+readline() on files opened in "slurp" mode could return an extra "" at
+the end in certain situations. This has been corrected.
+
+=item *
+
+Autovivification of symbolic references of special variables described
+in L<perlvar> (as in C<${$num}>) was accidentally disabled. This works
+again now.
+
+=item *
+
+Sys::Syslog ignored the C<LOG_AUTH> constant.
=item *
@@ -1705,10 +1872,20 @@ C<eval "v200"> now works.
=item *
+Perl 5.6.0 parsed m/\x{ab}/ incorrectly, leading to spurious warnings.
+This has been corrected.
+
+=item *
+
Zero entries were missing from the Unicode classes like C<IsDigit>.
=back
+=item *
+
+Large unsigned numbers (those above 2**31) could sometimes lose their
+unsignedness, causing bogus results in arithmetic operations.
+
=back
=head2 Platform Specific Changes and Fixes
@@ -1837,6 +2014,20 @@ VMS
chdir() now works better despite a CRT bug; now works with MULTIPLICITY
(see INSTALL); now works with Perl's malloc.
+The tainting of C<%ENV> elements via C<keys> or C<values> was previously
+unimplemented. It now works as documented.
+
+The C<waitpid> emulation has been improved. The worst bug (now fixed)
+was that a pid of -1 would cause a wildcard search of all processes on
+the system. The most significant enhancement is that we can now
+usually get the completion status of a terminated process.
+
+POSIX-style signals are now emulated much better on VMS versions prior
+to 7.0.
+
+The C<system> function and backticks operator have improved
+functionality and better error handling.
+
=item *
Windows
@@ -1867,12 +2058,17 @@ New %ENV entries now propagate to subprocesses.
=item *
+Current directory entries in %ENV are now correctly propagated to child
+processes.
+
+=item *
+
$ENV{LIB} now used to search for libs under Visual C.
=item *
-Win32::GetCwd() correctly returns C:\ instead of C: when at the drive root.
-Other bugs in chdir() and Cwd::cwd() have also been fixed.
+fork() emulation has been improved in various ways, but still continues
+to be experimental. See L<perlfork> for known bugs and caveats.
=item *
@@ -1880,6 +2076,11 @@ A failed (pseudo)fork now returns undef and sets errno to EAGAIN.
=item *
+Win32::GetCwd() correctly returns C:\ instead of C: when at the drive root.
+Other bugs in chdir() and Cwd::cwd() have also been fixed.
+
+=item *
+
HTML files will be installed in c:\perl\html instead of c:\perl\lib\pod\html
=item *
@@ -1901,6 +2102,11 @@ Fake signal handling reenabled, bugs and all.
=item *
+%SIG has been enabled under USE_ITHREADS, but its use is completely
+unsupported under all configurations.
+
+=item *
+
Less stack reserved per thread so that more threads can run
concurrently. (Still 16M per thread.)
@@ -1915,7 +2121,8 @@ Better UNC path handling under ithreads.
=item *
-wait() and waitpid() now work much better.
+wait(), waitpid() and backticks now return the correct exit status under
+Windows 9x.
=item *
@@ -2093,7 +2300,18 @@ such as sudo (see http://www.courtesan.com/sudo/).
=head1 New Tests
-Several new tests have been added, especially for the F<lib> subsection.
+Several new tests have been added, especially for the F<lib>
+subsection. There are now about 34 000 individual tests (spread over
+about 530 test scripts), in the regression suite (5.6.1 has about
+11700 tests, in 258 test scripts) Many of the new tests are introduced
+by the new modules, but still in general Perl is now more thoroughly
+tested.
+
+Because of the large number of tests, running the regression suite
+will take considerably longer time than it used to: expect the suite
+to take up to 4-5 times longer to run than in perl 5.6. In a really
+fast machine you can hope to finish the suite in about 5 minutes
+(wallclock time).
The tests are now reported in a different order than in earlier Perls.
(This happens because the test scripts from under t/lib have been moved
@@ -2101,10 +2319,6 @@ to be closer to the library/extension they are testing.)
=head1 Known Problems
-Note that unlike other sections in this document (which describe
-changes since 5.7.0) this section is cumulative containing known
-problems for all the 5.7 releases.
-
=head2 AIX
=over 4
@@ -2164,6 +2378,17 @@ subtest 9 failed.
No known fix.
+=head2 Mac OS X
+
+The following tests are known to fail:
+
+ Failed Test Stat Wstat Total Fail Failed List of Failed
+ -------------------------------------------------------------------------
+ ../ext/DB_File/t/db-btree.t 0 11 ?? ?? % ??
+ ../ext/DB_File/t/db-recno.t 149 3 2.01% 61 63 65
+ ../ext/POSIX/t/posix.t 31 1 3.23% 10
+ ../lib/warnings.t 450 1 0.22% 316
+
=head2 OS/390
OS/390 has rather many test failures but the situation is actually
@@ -2203,14 +2428,18 @@ the printf format "%.0f", most often they produce "0" and "-0".)
=head2 Failure of Thread tests
-B<Note that support for 5.005-style threading remains experimental.>
+B<Note that support for 5.005-style threading remains experimental
+and practically unsupported.>
The following tests are known to fail due to fundamental problems in
the 5.005 threading implementation. These are not new failures--Perl
5.005_0x has the same bugs, but didn't have these tests.
- lib/autouse.t 4
- t/lib/thr5005.t 19-20
+ ext/List/Util/t/first 2
+ lib/autouse 4
+ ext/Thread/thr5005 19-20
+
+These failures are unlikely to get fixed.
=head2 UNICOS
@@ -2245,20 +2474,9 @@ There are a few known test failures, see L<perluts>.
=head2 VMS
-Rather a lot of tests are failing in VMS, but actually more tests
-succeed in VMS than they used to; it's just that there are many,
-many more tests than there used to be.
-
-Here are the known failures from some compiler/platform combinations.
-
-Compaq C V6.2-009 on OpenVMS Alpha V7.3
+There is one known test failure with a default configuration:
[.run]switches..........................FAILED on test 1
- [-.ext.posix.t]posix....................FAILED on test 10
- [-.ext.time.hires]hires.................FAILED on test 17
- [-.lib]db...............................FAILED on test 24
- [-.lib.net]hostent......................FAILED on test 5
- [-.lib.pod.t]basic......................FAILED on test 10
=head2 Win32
@@ -2325,8 +2543,8 @@ pP are testing for Unicode code points, not knowing about EBCDIC.
=head2 The Compiler Suite Is Still Experimental
-The compiler suite is slowly getting better but is nowhere near
-working order yet.
+The compiler suite is slowly getting better but it continues to be
+highly experimental. Use in production environments is discouraged.
=head2 The Long Double Support is Still Experimental
diff --git a/pod/perlnewmod.pod b/pod/perlnewmod.pod
index 28a82d9b65..dd058e88b3 100644
--- a/pod/perlnewmod.pod
+++ b/pod/perlnewmod.pod
@@ -283,4 +283,4 @@ Simon Cozens, C<simon@cpan.org>
L<perlmod>, L<perlmodlib>, L<perlmodinstall>, L<h2xs>, L<strict>,
L<Carp>, L<Exporter>, L<perlpod>, L<Test>, L<ExtUtils::MakeMaker>,
http://www.cpan.org/, Ken Williams' tutorial on building your own
-module at http://www.swarthmore.edu/~ken/perl_modules.html
+module at http://mathforum.org/~ken/perl_modules.html
diff --git a/pod/perlpacktut.pod b/pod/perlpacktut.pod
index 28e585d4be..93ec186a43 100644
--- a/pod/perlpacktut.pod
+++ b/pod/perlpacktut.pod
@@ -59,7 +59,7 @@ corresponding to a byte:
What was in this chunk of memory? Numbers, characters, or a mixture of
both? Assuming that we're on a computer where ASCII (or some similar)
encoding is used: hexadecimal values in the range C<0x40> - C<0x5A>
-indicate an uppercase letter, and <0x20> encodes a space. So we might
+indicate an uppercase letter, and C<0x20> encodes a space. So we might
assume it is a piece of text, which some are able to read like a tabloid;
but others will have to get hold of an ASCII table and relive that
firstgrader feeling. Not caring too much about which way to read this,
@@ -382,7 +382,7 @@ tolerated for completeness' sake.
=head2 Unpacking a Stack Frame
Requesting a particular byte ordering may be necessary when you work with
-binary data coming from some specific architecture while your program could
+binary data coming from some specific architecture whereas your program could
run on a totally different system. As an example, assume you have 24 bytes
containing a stack frame as it happens on an Intel 8086:
@@ -423,10 +423,11 @@ together, we may now write:
$si, $di, $bp, $ds, $es ) =
unpack( 'v2' . ('vXXCC' x 5) . 'v5', $frame );
-We've taken some pains to get construct the template so that it matches
+We've taken some pains to construct the template so that it matches
the contents of our frame buffer. Otherwise we'd either get undefined values,
or C<unpack> could not unpack all. If C<pack> runs out of items, it will
-supply null strings.
+supply null strings (which are coerced into zeroes whenever the pack code
+says so).
=head2 How to Eat an Egg on a Net
@@ -514,14 +515,14 @@ status register (a "-" stands for a "reserved" bit):
Converting these two bytes to a string can be done with the unpack
template C<'b16'>. To obtain the individual bit values from the bit
-string we use C<split> with the "empty" separator pattern which splits
+string we use C<split> with the "empty" separator pattern which dissects
into individual characters. Bit values from the "reserved" positions are
simply assigned to C<undef>, a convenient notation for "I don't care where
this goes".
($carry, undef, $parity, undef, $auxcarry, undef, $sign,
$trace, $interrupt, $direction, $overflow) =
- split( '', unpack( 'b16', $status ) );
+ split( //, unpack( 'b16', $status ) );
We could have used an unpack template C<'b12'> just as well, since the
last 4 bits can be ignored anyway.
@@ -618,6 +619,22 @@ Usually you'll want to pack or unpack UTF-8 strings:
my @hebrew = unpack( 'U*', $utf );
+=head2 Another Portable Binary Encoding
+
+The pack code C<w> has been added to support a portable binary data
+encoding scheme that goes way beyond simple integers. (Details can
+be found at L<Casbah.org>, the Scarab project.) A BER (Binary Encoded
+Representation) compressed unsigned integer stores base 128
+digits, most significant digit first, with as few digits as possible.
+Bit eight (the high bit) is set on each byte except the last. There
+is no size limit to BER encoding, but Perl won't go to extremes.
+
+ my $berbuf = pack( 'w*', 1, 128, 128+1, 128*128+127 );
+
+A hex dump of C<$berbuf>, with spaces inserted at the right places,
+shows 01 8100 8101 81807F. Since the last byte is always less than
+128, C<unpack> knows where to stop.
+
=head1 Lengths and Widths
@@ -703,33 +720,25 @@ strings, with C<=> between the name and the value, followed by an
additional delimiting null byte. Here's how:
my $env = pack( 'A*A*Z*' x keys( %Env ) . 'C',
- map{ ( $_, '=', $Env{$_} ) } keys( %Env ), 0 );
+ map( { ( $_, '=', $Env{$_} ) } keys( %Env ) ), 0 );
+
+Let's examine the cogs of this byte mill, one by one. There's the C<map>
+call, creating the items we intend to stuff into the C<$env> buffer:
+to each key (in C<$_>) it adds the C<=> separator and the hash entry value.
+Each triplet is packed with the template code sequence C<A*A*Z*> that
+is multiplied with the number of keys. (Yes, that's what the C<keys>
+function resturns in scalar context.) To get the very last null byte,
+we add a C<0> at the end of the C<pack> list, to be packed with C<C>.
+(Attentive readers may have noticed that we could have omitted the 0.)
For the reverse operation, we'll have to determine the number of items
in the buffer before we can let C<unpack> rip it apart:
my $n = $env =~ tr/\0// - 1;
- my %env = map { split( '=', $_ ) } unpack( 'Z*' x $n, $env );
+ my %env = map( split( /=/, $_ ), unpack( 'Z*' x $n, $env ) );
The C<tr> counts the null bytes. The C<unpack> call returns a list of
-name-value pairs each of which is taken apart in the C<map> block.
-
-
-=head2 Another Portable Binary Encoding
-
-The pack code C<w> has been added to support a portable binary data
-encoding scheme that goes way beyond simple integers. (Details can
-be found at L<Casbah.org>, the Scarab project.) A BER (Binary Encoded
-Representation) compressed unsigned integer stores base 128
-digits, most significant digit first, with as few digits as possible.
-Bit eight (the high bit) is set on each byte except the last. There
-is no size limit to BER encoding, but Perl won't go to extremes.
-
- my $berbuf = pack( 'w*', 1, 128, 128+1, 128*128+127 );
-
-A hex dump of C<$berbuf>, with spaces inserted at the right places,
-shows 01 8100 8101 81807F. Since the last byte is always less than
-128, C<unpack> knows where to stop.
+name-value pairs each of which is taken apart in the C<map> block.
=head1 Packing and Unpacking C Structures
@@ -1034,6 +1043,18 @@ spacing - 16 bytes to a line:
length( $mem ) % 16 ? "\n" : '';
+=head1 Funnies Section
+
+ # Pulling digits out of nowhere...
+ print unpack( 'C', pack( 'x' ) ),
+ unpack( '%B*', pack( 'A' ) ),
+ unpack( 'H', pack( 'A' ) ),
+ unpack( 'A', unpack( 'C', pack( 'A' ) ) ), "\n";
+
+ # One for the road ;-)
+ my $advice = pack( 'all u can in a van' );
+
+
=head1 Authors
Simon Cozens and Wolfgang Laun.
diff --git a/pod/perlport.pod b/pod/perlport.pod
index 3b11a4f45e..c89e288755 100644
--- a/pod/perlport.pod
+++ b/pod/perlport.pod
@@ -267,6 +267,13 @@ S<RISC OS> perl can emulate Unix filenames with C</> as path
separator, or go native and use C<.> for path separator and C<:> to
signal filesystems and disk names.
+Don't assume UNIX filesystem access semantics: that read, write,
+and execute are all the permissions there are, and even if they exist,
+that their semantics (for example what do r, w, and x mean on
+a directory) are the UNIX ones. The various UNIX/POSIX compatibility
+layers usually try to make interfaces like chmod() work, but sometimes
+there simply is no good mapping.
+
If all this is intimidating, have no (well, maybe only a little)
fear. There are modules that can help. The File::Spec modules
provide methods to do the Right Thing on whatever platform happens
@@ -538,13 +545,31 @@ more efficient that the first.
Most multi-user platforms provide basic levels of security, usually
implemented at the filesystem level. Some, however, do
-not--unfortunately. Thus the notion of user id, or "home" directory,
+not-- unfortunately. Thus the notion of user id, or "home" directory,
or even the state of being logged-in, may be unrecognizable on many
platforms. If you write programs that are security-conscious, it
is usually best to know what type of system you will be running
under so that you can write code explicitly for that platform (or
class of platforms).
+Don't assume the UNIX filesystem access semantics: the operating
+system or the filesystem may be using some ACL systems, which are
+richer languages than the usual rwx. Even if the rwx exist,
+their semantics might be different.
+
+(From security viewpoint testing for permissions before attempting to
+do something is silly anyway: if one tries this, there is potential
+for race conditions-- someone or something might change the
+permissions between the permissions check and the actual operation.
+Just try the operation.)
+
+Don't assume the UNIX user and group semantics: especially, don't
+expect the C<< $< >> and C<< $> >> (or the C<$(> and C<$)>) to work
+for switching identities (or memberships).
+
+Don't assume set-uid and set-gid semantics. (And even if you do,
+think twice: set-uid and set-gid are a known can of security worms.)
+
=head2 Style
For those times when it is necessary to have platform-specific code,
diff --git a/pod/perltoc.pod b/pod/perltoc.pod
index 6e045f4ffd..29f97db2a7 100644
--- a/pod/perltoc.pod
+++ b/pod/perltoc.pod
@@ -426,22 +426,22 @@ lstat EXPR, lstat, m//, map BLOCK LIST, map EXPR,LIST, mkdir FILENAME,MASK,
mkdir FILENAME, msgctl ID,CMD,ARG, msgget KEY,FLAGS, msgrcv
ID,VAR,SIZE,TYPE,FLAGS, msgsnd ID,MSG,FLAGS, my EXPR, my EXPR : ATTRIBUTES,
next LABEL, next, no Module LIST, oct EXPR, oct, open FILEHANDLE,EXPR, open
-FILEHANDLE,MODE,EXPR, open FILEHANDLE,MODE,EXPR,LIST, open FILEHANDLE,
-opendir DIRHANDLE,EXPR, ord EXPR, ord, our EXPR, our EXPR : ATTRIBUTES,
-pack TEMPLATE,LIST, package NAMESPACE, package, pipe
-READHANDLE,WRITEHANDLE, pop ARRAY, pop, pos SCALAR, pos, print FILEHANDLE
-LIST, print LIST, print, printf FILEHANDLE FORMAT, LIST, printf FORMAT,
-LIST, prototype FUNCTION, push ARRAY,LIST, q/STRING/, qq/STRING/,
-qr/STRING/, qx/STRING/, qw/STRING/, quotemeta EXPR, quotemeta, rand EXPR,
-rand, read FILEHANDLE,SCALAR,LENGTH,OFFSET, read FILEHANDLE,SCALAR,LENGTH,
-readdir DIRHANDLE, readline EXPR, readlink EXPR, readlink, readpipe EXPR,
-recv SOCKET,SCALAR,LENGTH,FLAGS, redo LABEL, redo, ref EXPR, ref, rename
-OLDNAME,NEWNAME, require VERSION, require EXPR, require, reset EXPR, reset,
-return EXPR, return, reverse LIST, rewinddir DIRHANDLE, rindex
-STR,SUBSTR,POSITION, rindex STR,SUBSTR, rmdir FILENAME, rmdir, s///, scalar
-EXPR, seek FILEHANDLE,POSITION,WHENCE, seekdir DIRHANDLE,POS, select
-FILEHANDLE, select, select RBITS,WBITS,EBITS,TIMEOUT, semctl
-ID,SEMNUM,CMD,ARG, semget KEY,NSEMS,FLAGS, semop KEY,OPSTRING, send
+FILEHANDLE,MODE,EXPR, open FILEHANDLE,MODE,EXPR,LIST, open
+FILEHANDLE,MODE,REFERENCE, open FILEHANDLE, opendir DIRHANDLE,EXPR, ord
+EXPR, ord, our EXPR, our EXPR : ATTRIBUTES, pack TEMPLATE,LIST, package
+NAMESPACE, package, pipe READHANDLE,WRITEHANDLE, pop ARRAY, pop, pos
+SCALAR, pos, print FILEHANDLE LIST, print LIST, print, printf FILEHANDLE
+FORMAT, LIST, printf FORMAT, LIST, prototype FUNCTION, push ARRAY,LIST,
+q/STRING/, qq/STRING/, qr/STRING/, qx/STRING/, qw/STRING/, quotemeta EXPR,
+quotemeta, rand EXPR, rand, read FILEHANDLE,SCALAR,LENGTH,OFFSET, read
+FILEHANDLE,SCALAR,LENGTH, readdir DIRHANDLE, readline EXPR, readlink EXPR,
+readlink, readpipe EXPR, recv SOCKET,SCALAR,LENGTH,FLAGS, redo LABEL, redo,
+ref EXPR, ref, rename OLDNAME,NEWNAME, require VERSION, require EXPR,
+require, reset EXPR, reset, return EXPR, return, reverse LIST, rewinddir
+DIRHANDLE, rindex STR,SUBSTR,POSITION, rindex STR,SUBSTR, rmdir FILENAME,
+rmdir, s///, scalar EXPR, seek FILEHANDLE,POSITION,WHENCE, seekdir
+DIRHANDLE,POS, select FILEHANDLE, select, select RBITS,WBITS,EBITS,TIMEOUT,
+semctl ID,SEMNUM,CMD,ARG, semget KEY,NSEMS,FLAGS, semop KEY,OPSTRING, send
SOCKET,MSG,FLAGS,TO, send SOCKET,MSG,FLAGS, setpgrp PID,PGRP, setpriority
WHICH,WHO,PRIORITY, setsockopt SOCKET,LEVEL,OPTNAME,OPTVAL, shift ARRAY,
shift, shmctl ID,CMD,ARG, shmget KEY,SIZE,FLAGS, shmread ID,VAR,POS,SIZE,
@@ -1168,6 +1168,8 @@ $ARGV, @ARGV, @F, @INC, @_, %INC, %ENV, $ENV{expr}, %SIG, $SIG{expr}
=item Unicode
+=item Another Portable Binary Encoding
+
=back
=item Lengths and Widths
@@ -1178,8 +1180,6 @@ $ARGV, @ARGV, @F, @INC, @_, %INC, %ENV, $ENV{expr}, %SIG, $SIG{expr}
=item Dynamic Templates
-=item Another Portable Binary Encoding
-
=back
=item Packing and Unpacking C Structures
@@ -1198,6 +1198,8 @@ $ARGV, @ARGV, @F, @INC, @_, %INC, %ENV, $ENV{expr}, %SIG, $SIG{expr}
=item Pack Recipes
+=item Funnies Section
+
=item Authors
=back
@@ -4977,6 +4979,8 @@ I<The Road goes ever on and on, down from the door where it began.>
=item DESCRIPTION
+=item Highlights
+
=item Incompatible Changes
=over 4
@@ -4987,6 +4991,8 @@ I<The Road goes ever on and on, down from the door where it began.>
=item Socket Extension Dynamic in VMS
+=item IEEE-format Floating Point Default on OpenVMS Alpha
+
=item Different Definition of the Unicode Character Classes \p{In...}
=item Perl Parser Stress Tested
@@ -5073,6 +5079,8 @@ I<The Road goes ever on and on, down from the door where it began.>
=item Linux With Sfio Fails op/misc Test 48
+=item Mac OS X
+
=item OS/390
=item op/sprintf tests 129 and 130
@@ -5451,6 +5459,420 @@ d_strtoq, d_u32align, d_ualarm, d_usleep
=back
+=head2 perl561delta, perldelta - what's new for perl v5.6.x
+
+=over 4
+
+=item DESCRIPTION
+
+=item Summary of changes between 5.6.0 and 5.6.1
+
+=over 4
+
+=item Security Issues
+
+=item Core bug fixes
+
+C<UNIVERSAL::isa()>, Memory leaks, Numeric conversions, qw(a\\b), caller(),
+Bugs in regular expressions, "slurp" mode, Autovivification of symbolic
+references to special variables, Lexical warnings, Spurious warnings and
+errors, glob(), Tainting, sort(), #line directives, Subroutine prototypes,
+map(), Debugger, PERL5OPT, chop(), Unicode support, 64-bit support,
+Compiler, Lvalue subroutines, IO::Socket, File::Find, xsubpp, C<no
+Module;>, Tests
+
+=item Core features
+
+=item Configuration issues
+
+=item Documentation
+
+=item Bundled modules
+
+B::Concise, File::Temp, Pod::LaTeX, Pod::Text::Overstrike, CGI, CPAN,
+Class::Struct, DB_File, Devel::Peek, File::Find, Getopt::Long, IO::Poll,
+IPC::Open3, Math::BigFloat, Math::Complex, Net::Ping, Opcode, Pod::Parser,
+Pod::Text, SDBM_File, Sys::Syslog, Tie::RefHash, Tie::SubstrHash
+
+=item Platform-specific improvements
+
+NCR MP-RAS, NonStop-UX
+
+=item Interpreter cloning, threads, and concurrency
+
+=item Lexically scoped warning categories
+
+=item Unicode and UTF-8 support
+
+=item Support for interpolating named characters
+
+=item "our" declarations
+
+=item Support for strings represented as a vector of ordinals
+
+=item Improved Perl version numbering system
+
+=item New syntax for declaring subroutine attributes
+
+=item File and directory handles can be autovivified
+
+=item open() with more than two arguments
+
+=item 64-bit support
+
+=item Large file support
+
+=item Long doubles
+
+=item "more bits"
+
+=item Enhanced support for sort() subroutines
+
+=item C<sort $coderef @foo> allowed
+
+=item File globbing implemented internally
+
+=item Support for CHECK blocks
+
+=item POSIX character class syntax [: :] supported
+
+=item Better pseudo-random number generator
+
+=item Improved C<qw//> operator
+
+=item Better worst-case behavior of hashes
+
+=item pack() format 'Z' supported
+
+=item pack() format modifier '!' supported
+
+=item pack() and unpack() support counted strings
+
+=item Comments in pack() templates
+
+=item Weak references
+
+=item Binary numbers supported
+
+=item Lvalue subroutines
+
+=item Some arrows may be omitted in calls through references
+
+=item Boolean assignment operators are legal lvalues
+
+=item exists() is supported on subroutine names
+
+=item exists() and delete() are supported on array elements
+
+=item Pseudo-hashes work better
+
+=item Automatic flushing of output buffers
+
+=item Better diagnostics on meaningless filehandle operations
+
+=item Where possible, buffered data discarded from duped input filehandle
+
+=item eof() has the same old magic as <>
+
+=item binmode() can be used to set :crlf and :raw modes
+
+=item C<-T> filetest recognizes UTF-8 encoded files as "text"
+
+=item system(), backticks and pipe open now reflect exec() failure
+
+=item Improved diagnostics
+
+=item Diagnostics follow STDERR
+
+=item More consistent close-on-exec behavior
+
+=item syswrite() ease-of-use
+
+=item Better syntax checks on parenthesized unary operators
+
+=item Bit operators support full native integer width
+
+=item Improved security features
+
+=item More functional bareword prototype (*)
+
+=item C<require> and C<do> may be overridden
+
+=item $^X variables may now have names longer than one character
+
+=item New variable $^C reflects C<-c> switch
+
+=item New variable $^V contains Perl version as a string
+
+=item Optional Y2K warnings
+
+=item Arrays now always interpolate into double-quoted strings
+
+=back
+
+=item Modules and Pragmata
+
+=over 4
+
+=item Modules
+
+attributes, B, Benchmark, ByteLoader, constant, charnames, Data::Dumper,
+DB, DB_File, Devel::DProf, Devel::Peek, Dumpvalue, DynaLoader, English,
+Env, Fcntl, File::Compare, File::Find, File::Glob, File::Spec,
+File::Spec::Functions, Getopt::Long, IO, JPL, lib, Math::BigInt,
+Math::Complex, Math::Trig, Pod::Parser, Pod::InputObjects, Pod::Checker,
+podchecker, Pod::ParseUtils, Pod::Find, Pod::Select, podselect, Pod::Usage,
+pod2usage, Pod::Text and Pod::Man, SDBM_File, Sys::Syslog, Sys::Hostname,
+Term::ANSIColor, Time::Local, Win32, XSLoader, DBM Filters
+
+=item Pragmata
+
+=back
+
+=item Utility Changes
+
+=over 4
+
+=item dprofpp
+
+=item find2perl
+
+=item h2xs
+
+=item perlcc
+
+=item perldoc
+
+=item The Perl Debugger
+
+=back
+
+=item Improved Documentation
+
+perlapi.pod, perlboot.pod, perlcompile.pod, perldbmfilter.pod,
+perldebug.pod, perldebguts.pod, perlfork.pod, perlfilter.pod, perlhack.pod,
+perlintern.pod, perllexwarn.pod, perlnumber.pod, perlopentut.pod,
+perlreftut.pod, perltootc.pod, perltodo.pod, perlunicode.pod
+
+=item Performance enhancements
+
+=over 4
+
+=item Simple sort() using { $a <=> $b } and the like are optimized
+
+=item Optimized assignments to lexical variables
+
+=item Faster subroutine calls
+
+=item delete(), each(), values() and hash iteration are faster
+
+=back
+
+=item Installation and Configuration Improvements
+
+=over 4
+
+=item -Dusethreads means something different
+
+=item New Configure flags
+
+=item Threadedness and 64-bitness now more daring
+
+=item Long Doubles
+
+=item -Dusemorebits
+
+=item -Duselargefiles
+
+=item installusrbinperl
+
+=item SOCKS support
+
+=item C<-A> flag
+
+=item Enhanced Installation Directories
+
+=item gcc automatically tried if 'cc' does not seem to be working
+
+=back
+
+=item Platform specific changes
+
+=over 4
+
+=item Supported platforms
+
+=item DOS
+
+=item OS390 (OpenEdition MVS)
+
+=item VMS
+
+=item Win32
+
+=back
+
+=item Significant bug fixes
+
+=over 4
+
+=item <HANDLE> on empty files
+
+=item C<eval '...'> improvements
+
+=item All compilation errors are true errors
+
+=item Implicitly closed filehandles are safer
+
+=item Behavior of list slices is more consistent
+
+=item C<(\$)> prototype and C<$foo{a}>
+
+=item C<goto &sub> and AUTOLOAD
+
+=item C<-bareword> allowed under C<use integer>
+
+=item Failures in DESTROY()
+
+=item Locale bugs fixed
+
+=item Memory leaks
+
+=item Spurious subroutine stubs after failed subroutine calls
+
+=item Taint failures under C<-U>
+
+=item END blocks and the C<-c> switch
+
+=item Potential to leak DATA filehandles
+
+=back
+
+=item New or Changed Diagnostics
+
+"%s" variable %s masks earlier declaration in same %s, "my sub" not yet
+implemented, "our" variable %s redeclared, '!' allowed only after types %s,
+/ cannot take a count, / must be followed by a, A or Z, / must be followed
+by a*, A* or Z*, / must follow a numeric type, /%s/: Unrecognized escape
+\\%c passed through, /%s/: Unrecognized escape \\%c in character class
+passed through, /%s/ should probably be written as "%s", %s() called too
+early to check prototype, %s argument is not a HASH or ARRAY element, %s
+argument is not a HASH or ARRAY element or slice, %s argument is not a
+subroutine name, %s package attribute may clash with future reserved word:
+%s, (in cleanup) %s, <> should be quotes, Attempt to join self, Bad evalled
+substitution pattern, Bad realloc() ignored, Bareword found in conditional,
+Binary number > 0b11111111111111111111111111111111 non-portable, Bit vector
+size > 32 non-portable, Buffer overflow in prime_env_iter: %s, Can't check
+filesystem of script "%s", Can't declare class for non-scalar %s in "%s",
+Can't declare %s in "%s", Can't ignore signal CHLD, forcing to default,
+Can't modify non-lvalue subroutine call, Can't read CRTL environ, Can't
+remove %s: %s, skipping file, Can't return %s from lvalue subroutine, Can't
+weaken a nonreference, Character class [:%s:] unknown, Character class
+syntax [%s] belongs inside character classes, Constant is not %s reference,
+constant(%s): %s, CORE::%s is not a keyword, defined(@array) is deprecated,
+defined(%hash) is deprecated, Did not produce a valid header, (Did you mean
+"local" instead of "our"?), Document contains no data, entering effective
+%s failed, false [] range "%s" in regexp, Filehandle %s opened only for
+output, flock() on closed filehandle %s, Global symbol "%s" requires
+explicit package name, Hexadecimal number > 0xffffffff non-portable,
+Ill-formed CRTL environ value "%s", Ill-formed message in prime_env_iter:
+|%s|, Illegal binary digit %s, Illegal binary digit %s ignored, Illegal
+number of bits in vec, Integer overflow in %s number, Invalid %s attribute:
+%s, Invalid %s attributes: %s, invalid [] range "%s" in regexp, Invalid
+separator character %s in attribute list, Invalid separator character %s in
+subroutine attribute list, leaving effective %s failed, Lvalue subs
+returning %s not implemented yet, Method %s not permitted, Missing
+%sbrace%s on \N{}, Missing command in piped open, Missing name in "my sub",
+No %s specified for -%c, No package name allowed for variable %s in "our",
+No space allowed after -%c, no UTC offset information; assuming local time
+is UTC, Octal number > 037777777777 non-portable, panic: del_backref,
+panic: kid popen errno read, panic: magic_killbackrefs, Parentheses missing
+around "%s" list, Possible unintended interpolation of %s in string,
+Possible Y2K bug: %s, pragma "attrs" is deprecated, use "sub NAME : ATTRS"
+instead, Premature end of script headers, Repeat count in pack overflows,
+Repeat count in unpack overflows, realloc() of freed memory ignored,
+Reference is already weak, setpgrp can't take arguments, Strange *+?{} on
+zero-length expression, switching effective %s is not implemented, This
+Perl can't reset CRTL environ elements (%s), This Perl can't set CRTL
+environ elements (%s=%s), Too late to run %s block, Unknown open() mode
+'%s', Unknown process %x sent message to prime_env_iter: %s, Unrecognized
+escape \\%c passed through, Unterminated attribute parameter in attribute
+list, Unterminated attribute list, Unterminated attribute parameter in
+subroutine attribute list, Unterminated subroutine attribute list, Value of
+CLI symbol "%s" too long, Version number must be a constant number
+
+=item New tests
+
+=item Incompatible Changes
+
+=over 4
+
+=item Perl Source Incompatibilities
+
+CHECK is a new keyword, Treatment of list slices of undef has changed,
+Format of $English::PERL_VERSION is different, Literals of the form
+C<1.2.3> parse differently, Possibly changed pseudo-random number
+generator, Hashing function for hash keys has changed, C<undef> fails on
+read only values, Close-on-exec bit may be set on pipe and socket handles,
+Writing C<"$$1"> to mean C<"${$}1"> is unsupported, delete(), each(),
+values() and C<\(%h)>, vec(EXPR,OFFSET,BITS) enforces powers-of-two BITS,
+Text of some diagnostic output has changed, C<%@> has been removed,
+Parenthesized not() behaves like a list operator, Semantics of bareword
+prototype C<(*)> have changed, Semantics of bit operators may have changed
+on 64-bit platforms, More builtins taint their results
+
+=item C Source Incompatibilities
+
+C<PERL_POLLUTE>, C<PERL_IMPLICIT_CONTEXT>, C<PERL_POLLUTE_MALLOC>
+
+=item Compatible C Source API Changes
+
+C<PATCHLEVEL> is now C<PERL_VERSION>
+
+=item Binary Incompatibilities
+
+=back
+
+=item Known Problems
+
+=over 4
+
+=item Localizing a tied hash element may leak memory
+
+=item Known test failures
+
+64-bit builds, Failure of Thread tests, NEXTSTEP 3.3 POSIX test failure,
+Tru64 (aka Digital UNIX, aka DEC OSF/1) lib/sdbm test failure with gcc
+
+=item EBCDIC platforms not fully supported
+
+=item UNICOS/mk CC failures during Configure run
+
+=item Arrow operator and arrays
+
+=item Experimental features
+
+Threads, Unicode, 64-bit support, Lvalue subroutines, Weak references, The
+pseudo-hash data type, The Compiler suite, Internal implementation of file
+globbing, The DB module, The regular expression code constructs:
+
+=back
+
+=item Obsolete Diagnostics
+
+Character class syntax [: :] is reserved for future extensions, Ill-formed
+logical name |%s| in prime_env_iter, In string, @%s now must be written as
+\@%s, Probable precedence problem on %s, regexp too big, Use of "$$<digit>"
+to mean "${$}<digit>" is deprecated
+
+=item Reporting Bugs
+
+=item SEE ALSO
+
+=item HISTORY
+
+=back
+
=head2 perl56delta, perldelta - what's new for perl v5.6.0
=over 4
@@ -6518,50 +6940,6 @@ Source, Compiled Module Source, Perl Modules/Scripts
=back
-=head2 perldos - Perl under DOS, W31, W95.
-
-=over 4
-
-=item SYNOPSIS
-
-=item DESCRIPTION
-
-=over 4
-
-=item Prerequisites for Compiling Perl on DOS
-
-DJGPP, Pthreads
-
-=item Shortcomings of Perl under DOS
-
-=item Building Perl on DOS
-
-=item Testing Perl on DOS
-
-=item Installation of Perl on DOS
-
-=back
-
-=item BUILDING AND INSTALLING MODULES ON DOS
-
-=over 4
-
-=item Building Prerequisites for Perl on DOS
-
-=item Unpacking CPAN Modules on DOS
-
-=item Building Non-XS Modules on DOS
-
-=item Building XS Modules on DOS
-
-=back
-
-=item AUTHOR
-
-=item SEE ALSO
-
-=back
-
=head2 perlepoc, README.epoc - Perl for EPOC
=over 4
@@ -7445,48 +7823,6 @@ LIST, waitpid PID,FLAGS
=back
-=head2 perlwin32 - Perl under Win32
-
-=over 4
-
-=item SYNOPSIS
-
-=item DESCRIPTION
-
-=over 4
-
-=item Setting Up Perl on Win32
-
-Make, Command Shell, Borland C++, Microsoft Visual C++, Mingw32 with GCC
-
-=item Building
-
-=item Testing Perl on Win32
-
-=item Installation of Perl on Win32
-
-=item Usage Hints for Perl on Win32
-
-Environment Variables, File Globbing, Using perl from the command line,
-Building Extensions, Command-line Wildcard Expansion, Win32 Specific
-Extensions, Running Perl Scripts, Miscellaneous Things
-
-=back
-
-=item BUGS AND CAVEATS
-
-=item AUTHORS
-
-Gary Ng E<lt>71564.1743@CompuServe.COME<gt>, Gurusamy Sarathy
-E<lt>gsar@activestate.comE<gt>, Nick Ing-Simmons
-E<lt>nick@ing-simmons.netE<gt>
-
-=item SEE ALSO
-
-=item HISTORY
-
-=back
-
=head1 PRAGMA DOCUMENTATION
=head2 attrs - set/get attributes of a subroutine (deprecated)
@@ -10059,6 +10395,8 @@ Dumper
=back
+=item ppport.h
+
=item AUTHOR
=item SEE ALSO
@@ -13900,19 +14238,24 @@ MSGNUM ), reset (), quit ()
=item DESCRIPTION
-icmp, udp, tcp, stream, external
-
=over 4
=item Functions
Net::Ping->new([$proto [, $def_timeout [, $bytes]]]);, $p->ping($host [,
-$timeout]);, $p->open($host);, $p->close();, pingecho($host [, $timeout]);
+$timeout]);, $p->open($host);, $p->open($host);, $p->close();,
+pingecho($host [, $timeout]);
=back
+=item WARNING
+
=item NOTES
+=item AUTHOR(S)
+
+=item COPYRIGHT
+
=back
=head2 Net::SMTP - Simple Mail Transfer Protocol Client
diff --git a/pp.c b/pp.c
index fd4c52c10a..ff85c372e8 100644
--- a/pp.c
+++ b/pp.c
@@ -815,10 +815,10 @@ PP(pp_undef)
PP(pp_predec)
{
dSP;
- if (SvREADONLY(TOPs) || SvTYPE(TOPs) > SVt_PVLV)
+ if (SvTYPE(TOPs) > SVt_PVLV)
DIE(aTHX_ PL_no_modify);
- if (SvIOK_notUV(TOPs) && !SvNOK(TOPs) && !SvPOK(TOPs) &&
- SvIVX(TOPs) != IV_MIN)
+ if (!SvREADONLY(TOPs) && SvIOK_notUV(TOPs) && !SvNOK(TOPs) && !SvPOK(TOPs)
+ && SvIVX(TOPs) != IV_MIN)
{
--SvIVX(TOPs);
SvFLAGS(TOPs) &= ~(SVp_NOK|SVp_POK);
@@ -832,11 +832,11 @@ PP(pp_predec)
PP(pp_postinc)
{
dSP; dTARGET;
- if (SvREADONLY(TOPs) || SvTYPE(TOPs) > SVt_PVLV)
+ if (SvTYPE(TOPs) > SVt_PVLV)
DIE(aTHX_ PL_no_modify);
sv_setsv(TARG, TOPs);
- if (SvIOK_notUV(TOPs) && !SvNOK(TOPs) && !SvPOK(TOPs) &&
- SvIVX(TOPs) != IV_MAX)
+ if (!SvREADONLY(TOPs) && SvIOK_notUV(TOPs) && !SvNOK(TOPs) && !SvPOK(TOPs)
+ && SvIVX(TOPs) != IV_MAX)
{
++SvIVX(TOPs);
SvFLAGS(TOPs) &= ~(SVp_NOK|SVp_POK);
@@ -853,11 +853,11 @@ PP(pp_postinc)
PP(pp_postdec)
{
dSP; dTARGET;
- if (SvREADONLY(TOPs) || SvTYPE(TOPs) > SVt_PVLV)
+ if (SvTYPE(TOPs) > SVt_PVLV)
DIE(aTHX_ PL_no_modify);
sv_setsv(TARG, TOPs);
- if (SvIOK_notUV(TOPs) && !SvNOK(TOPs) && !SvPOK(TOPs) &&
- SvIVX(TOPs) != IV_MIN)
+ if (!SvREADONLY(TOPs) && SvIOK_notUV(TOPs) && !SvNOK(TOPs) && !SvPOK(TOPs)
+ && SvIVX(TOPs) != IV_MIN)
{
--SvIVX(TOPs);
SvFLAGS(TOPs) &= ~(SVp_NOK|SVp_POK);
@@ -3142,9 +3142,10 @@ PP(pp_chr)
PP(pp_crypt)
{
- dSP; dTARGET; dPOPTOPssrl;
- STRLEN n_a;
+ dSP; dTARGET;
#ifdef HAS_CRYPT
+ dPOPTOPssrl;
+ STRLEN n_a;
STRLEN len;
char *tmps = SvPV(left, len);
char *t = 0;
@@ -3161,11 +3162,11 @@ PP(pp_crypt)
}
tmps = t;
}
-#ifdef FCRYPT
+# ifdef FCRYPT
sv_setpv(TARG, fcrypt(tmps, SvPV(right, n_a)));
-#else
+# else
sv_setpv(TARG, PerlProc_crypt(tmps, SvPV(right, n_a)));
-#endif
+# endif
Safefree(t);
#else
DIE(aTHX_
diff --git a/pp_hot.c b/pp_hot.c
index 8781b6ce7e..29ec96beda 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -302,10 +302,10 @@ PP(pp_eq)
PP(pp_preinc)
{
dSP;
- if (SvREADONLY(TOPs) || SvTYPE(TOPs) > SVt_PVLV)
+ if (SvTYPE(TOPs) > SVt_PVLV)
DIE(aTHX_ PL_no_modify);
- if (SvIOK_notUV(TOPs) && !SvNOK(TOPs) && !SvPOK(TOPs) &&
- SvIVX(TOPs) != IV_MAX)
+ if (!SvREADONLY(TOPs) && SvIOK_notUV(TOPs) && !SvNOK(TOPs) && !SvPOK(TOPs)
+ && SvIVX(TOPs) != IV_MAX)
{
++SvIVX(TOPs);
SvFLAGS(TOPs) &= ~(SVp_NOK|SVp_POK);
diff --git a/pp_sys.c b/pp_sys.c
index a2d57219f8..6c0085f17c 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -3412,6 +3412,7 @@ PP(pp_chdir)
}
else {
PUSHi(0);
+ TAINT_PROPER("chdir");
RETURN;
}
}
diff --git a/proto.h b/proto.h
index 688af73d1a..ebd00fd3db 100644
--- a/proto.h
+++ b/proto.h
@@ -693,7 +693,6 @@ PERL_CALLCONV char* Perl_screaminstr(pTHX_ SV* bigsv, SV* littlesv, I32 start_sh
PERL_CALLCONV I32 Perl_setenv_getix(pTHX_ char* nam);
#endif
PERL_CALLCONV void Perl_setdefout(pTHX_ GV* gv);
-PERL_CALLCONV char* Perl_sharepvn(pTHX_ const char* sv, I32 len, U32 hash);
PERL_CALLCONV HEK* Perl_share_hek(pTHX_ const char* sv, I32 len, U32 hash);
PERL_CALLCONV Signal_t Perl_sighandler(int sig);
PERL_CALLCONV SV** Perl_stack_grow(pTHX_ SV** sp, SV**p, int n);
diff --git a/regexec.c b/regexec.c
index 415bc70415..0d97be3222 100644
--- a/regexec.c
+++ b/regexec.c
@@ -3160,9 +3160,9 @@ S_regmatch(pTHX_ regnode *prog)
c1 = *(PL_bostr + ln);
}
else { c1 = (U8)*STRING(text_node); }
- if (OP(next) == EXACTF)
+ if (OP(text_node) == EXACTF || OP(text_node) == REFF)
c2 = PL_fold[c1];
- else if (OP(text_node) == EXACTFL)
+ else if (OP(text_node) == EXACTFL || OP(text_node) == REFFL)
c2 = PL_fold_locale[c1];
else
c2 = c1;
@@ -3243,9 +3243,9 @@ S_regmatch(pTHX_ regnode *prog)
}
else { c1 = (U8)*STRING(text_node); }
- if (OP(text_node) == EXACTF)
+ if (OP(text_node) == EXACTF || OP(text_node) == REFF)
c2 = PL_fold[c1];
- else if (OP(text_node) == EXACTFL)
+ else if (OP(text_node) == EXACTFL || OP(text_node) == REFFL)
c2 = PL_fold_locale[c1];
else
c2 = c1;
@@ -3354,13 +3354,13 @@ S_regmatch(pTHX_ regnode *prog)
if (!UTF) {
c2 = c1 = *s;
- if (OP(text_node) == EXACTF)
+ if (OP(text_node) == EXACTF || OP(text_node) == REFF)
c2 = PL_fold[c1];
- else if (OP(text_node) == EXACTFL)
+ else if (OP(text_node) == EXACTFL || OP(text_node) == REFFL)
c2 = PL_fold_locale[c1];
}
else { /* UTF */
- if (OP(text_node) == EXACTF) {
+ if (OP(text_node) == EXACTF || OP(text_node) == REFF) {
STRLEN ulen1, ulen2;
U8 tmpbuf1[UTF8_MAXLEN*2+1];
U8 tmpbuf2[UTF8_MAXLEN*2+1];
diff --git a/sv.c b/sv.c
index b1da4a8ee5..fcabd8e5c4 100644
--- a/sv.c
+++ b/sv.c
@@ -5846,6 +5846,8 @@ Perl_sv_inc(pTHX_ register SV *sv)
if (SvGMAGICAL(sv))
mg_get(sv);
if (SvTHINKFIRST(sv)) {
+ if (SvREADONLY(sv) && SvFAKE(sv))
+ sv_force_normal(sv);
if (SvREADONLY(sv)) {
if (PL_curcop != &PL_compiling)
Perl_croak(aTHX_ PL_no_modify);
@@ -6000,6 +6002,8 @@ Perl_sv_dec(pTHX_ register SV *sv)
if (SvGMAGICAL(sv))
mg_get(sv);
if (SvTHINKFIRST(sv)) {
+ if (SvREADONLY(sv) && SvFAKE(sv))
+ sv_force_normal(sv);
if (SvREADONLY(sv)) {
if (PL_curcop != &PL_compiling)
Perl_croak(aTHX_ PL_no_modify);
diff --git a/t/TEST b/t/TEST
index 5ef012547b..481cc79d82 100755
--- a/t/TEST
+++ b/t/TEST
@@ -312,7 +312,7 @@ SHRDLU_1
### in the 't' directory since most (>=80%) of the tests succeeded.
SHRDLU_2
if (eval {require Config; import Config; 1}) {
- if (my $p = $Config{ldlibpthname}) {
+ if ($Config{usedl} && (my $p = $Config{ldlibpthname})) {
warn <<SHRDLU_3;
### You may have to set your dynamic library search path,
### $p, to point to the build directory:
diff --git a/t/base/lex.t b/t/base/lex.t
index 54d6c93c5e..4166c18194 100755
--- a/t/base/lex.t
+++ b/t/base/lex.t
@@ -53,8 +53,8 @@ $foo
EOF
EOE
-print <<`EOS` . <<\EOF;
-echo ok 12
+print <<'EOS' . <<\EOF;
+ok 12 - make sure single quotes are honored \nnot ok
EOS
ok 13
EOF
diff --git a/t/base/term.t b/t/base/term.t
index 000bff1b15..2d3fe5a5e1 100755
--- a/t/base/term.t
+++ b/t/base/term.t
@@ -19,7 +19,7 @@ else {print "not ok 1\n";}
# check `` processing
-$x = `echo hi there`;
+$x = `$^X -le "print 'hi there'"`;
if ($x eq "hi there\n") {print "ok 2\n";} else {print "not ok 2\n";}
# check $#array
diff --git a/t/comp/script.t b/t/comp/script.t
index 4891f5bae7..d70b767478 100755
--- a/t/comp/script.t
+++ b/t/comp/script.t
@@ -1,13 +1,16 @@
#!./perl
-# $RCSfile: script.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:23 $
+BEGIN {
+ chdir 't';
+ @INC = '../lib';
+ require './test.pl';
+}
+
+my $Perl = which_perl;
print "1..3\n";
-$PERL = ($^O eq 'MSWin32') ? '.\perl'
- : (($^O eq 'NetWare') ? 'perl'
- : ($^O eq 'MacOS') ? $^X : './perl');
-$x = `$PERL -le "print 'ok';"`;
+$x = `$Perl -le "print 'ok';"`;
if ($x eq "ok\n") {print "ok 1\n";} else {print "not ok 1\n";}
@@ -15,11 +18,11 @@ open(try,">Comp.script") || (die "Can't open temp file.");
print try 'print "ok\n";'; print try "\n";
close try;
-$x = `$PERL Comp.script`;
+$x = `$Perl Comp.script`;
if ($x eq "ok\n") {print "ok 2\n";} else {print "not ok 2\n";}
-$x = `$PERL <Comp.script`;
+$x = `$Perl <Comp.script`;
if ($x eq "ok\n") {print "ok 3\n";} else {print "not ok 3\n";}
diff --git a/t/io/open.t b/t/io/open.t
index 9b37db390c..cb8aea371f 100755
--- a/t/io/open.t
+++ b/t/io/open.t
@@ -3,304 +3,230 @@
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
+ require './test.pl';
}
-# $RCSfile$
$| = 1;
use warnings;
$Is_VMS = $^O eq 'VMS';
-$Is_Dos = $^O eq 'dos';
-print "1..70\n";
+plan tests => 95;
-my $test = 1;
+my $Perl = which_perl();
-sub ok { print "ok $test\n"; $test++ }
-
-# my $file tests
-
-# 1..9
{
unlink("afile") if -f "afile";
- print "$!\nnot " unless open(my $f,"+>afile");
- ok;
+
+ $! = 0; # the -f above will set $! if 'afile' doesn't exist.
+ ok( open(my $f,"+>afile"), 'open(my $f, "+>...")' );
+
binmode $f;
- print "not " unless -f "afile";
- ok;
- print "not " unless print $f "SomeData\n";
- ok;
- print "not " unless tell($f) == 9;
- ok;
- print "not " unless seek($f,0,0);
- ok;
+ ok( -f "afile", ' its a file');
+ ok( (print $f "SomeData\n"), ' we can print to it');
+ is( tell($f), 9, ' tell()' );
+ ok( seek($f,0,0), ' seek set' );
+
$b = <$f>;
- print "not " unless $b eq "SomeData\n";
- ok;
- print "not " unless -f $f;
- ok;
+ is( $b, "SomeData\n", ' readline' );
+ ok( -f $f, ' still a file' );
+
eval { die "Message" };
- # warn $@;
- print "not " unless $@ =~ /<\$f> line 1/;
- ok;
- print "not " unless close($f);
- ok;
- unlink("afile");
+ like( $@, qr/<\$f> line 1/, ' die message correct' );
+
+ ok( close($f), ' close()' );
+ ok( unlink("afile"), ' unlink()' );
}
-# 10..12
{
- print "# \$!='$!'\nnot " unless open(my $f,'>', 'afile');
- ok;
- print $f "a row\n";
- print "not " unless close($f);
- ok;
- print "not " unless -s 'afile' < 10;
- ok;
+ ok( open(my $f,'>', 'afile'), "open(my \$f, '>', 'afile')" );
+ ok( (print $f "a row\n"), ' print');
+ ok( close($f), ' close' );
+ ok( -s 'afile' < 10, ' -s' );
}
-# 13..15
{
- print "# \$!='$!'\nnot " unless open(my $f,'>>', 'afile');
- ok;
- print $f "a row\n";
- print "not " unless close($f);
- ok;
- print "not " unless -s 'afile' > 10;
- ok;
+ ok( open(my $f,'>>', 'afile'), "open(my \$f, '>>', 'afile')" );
+ ok( (print $f "a row\n"), ' print' );
+ ok( close($f), ' close' );
+ ok( -s 'afile' > 10, ' -s' );
}
-# 16..18
{
- print "# \$!='$!'\nnot " unless open(my $f, '<', 'afile');
- ok;
- @rows = <$f>;
- print "not " unless @rows == 2;
- ok;
- print "not " unless close($f);
- ok;
+ ok( open(my $f, '<', 'afile'), "open(my \$f, '<', 'afile')" );
+ my @rows = <$f>;
+ is( scalar @rows, 2, ' readline, list context' );
+ is( $rows[0], "a row\n", ' first line read' );
+ is( $rows[1], "a row\n", ' second line' );
+ ok( close($f), ' close' );
}
-# 19..23
{
- print "not " unless -s 'afile' < 20;
- ok;
- print "# \$!='$!'\nnot " unless open(my $f, '+<', 'afile');
- ok;
- @rows = <$f>;
- print "not " unless @rows == 2;
- ok;
- seek $f, 0, 1;
- print $f "yet another row\n";
- print "not " unless close($f);
- ok;
- print "not " unless -s 'afile' > 20;
- ok;
+ ok( -s 'afile' < 20, '-s' );
+
+ ok( open(my $f, '+<', 'afile'), 'open +<' );
+ my @rows = <$f>;
+ is( scalar @rows, 2, ' readline, list context' );
+ ok( seek($f, 0, 1), ' seek cur' );
+ ok( (print $f "yet another row\n"), ' print' );
+ ok( close($f), ' close' );
+ ok( -s 'afile' > 20, ' -s' );
unlink("afile");
}
-# 24..26
-if ($Is_VMS) {
- for (24..26) { print "ok $_ # skipped: not Unix fork\n"; $test++;}
-}
-else {
- print "# \$!='$!'\nnot " unless open(my $f, '-|', <<'EOC');
- ./perl -e "print qq(a row\n); print qq(another row\n)"
+SKIP: {
+ skip "open -| busted and noisy on VMS", 3 if $Is_VMS;
+
+ ok( open(my $f, '-|', <<EOC), 'open -|' );
+ $Perl -e "print qq(a row\n); print qq(another row\n)"
EOC
- ok;
- @rows = <$f>;
- print "not " unless @rows == 2;
- ok;
- print "not " unless close($f);
- ok;
-}
-# 27..30
-if ($Is_VMS) {
- for (27..30) { print "ok $_ # skipped: not Unix fork\n"; $test++;}
+ my @rows = <$f>;
+ is( scalar @rows, 2, ' readline, list context' );
+ ok( close($f), ' close' );
}
-else {
- print "# \$!='$!'\nnot " unless open(my $f, '|-', <<'EOC');
- ./perl -pe "s/^not //"
+
+{
+ ok( open(my $f, '|-', <<EOC), 'open |-' );
+ $Perl -pe "s/^not //"
EOC
- ok;
- @rows = <$f>;
- print $f "not ok $test\n"; $test++;
- print $f "not ok $test\n"; $test++;
- print "#\nnot " unless close($f);
+
+ my @rows = <$f>;
+ my $test = curr_test;
+ print $f "not ok $test - piped in\n";
+ next_test;
+
+ $test = curr_test;
+ print $f "not ok $test - piped in\n";
+ next_test;
+ ok( close($f), ' close' );
sleep 1;
- ok;
+ pass('flushing');
}
-# 31..32
-eval <<'EOE' and print "not ";
-open my $f, '<&', 'afile';
-1;
-EOE
-ok;
-$@ =~ /Bad filehandle:\s+afile/ or print "not ";
-ok;
-# local $file tests
+ok( !eval { open my $f, '<&', 'afile'; 1; }, '<& on a non-filehandle' );
+like( $@, qr/Bad filehandle:\s+afile/, ' right error' );
-# 33..41
+
+# local $file tests
{
unlink("afile") if -f "afile";
- print "$!\nnot " unless open(local $f,"+>afile");
- ok;
+
+ ok( open(local $f,"+>afile"), 'open local $f, "+>", ...' );
binmode $f;
- print "not " unless -f "afile";
- ok;
- print "not " unless print $f "SomeData\n";
- ok;
- print "not " unless tell($f) == 9;
- ok;
- print "not " unless seek($f,0,0);
- ok;
+
+ ok( -f "afile", ' -f' );
+ ok( (print $f "SomeData\n"), ' print' );
+ is( tell($f), 9, ' tell' );
+ ok( seek($f,0,0), ' seek set' );
+
$b = <$f>;
- print "not " unless $b eq "SomeData\n";
- ok;
- print "not " unless -f $f;
- ok;
+ is( $b, "SomeData\n", ' readline' );
+ ok( -f $f, ' still a file' );
+
eval { die "Message" };
- # warn $@;
- print "not " unless $@ =~ /<\$f> line 1/;
- ok;
- print "not " unless close($f);
- ok;
+ like( $@, qr/<\$f> line 1/, ' proper die message' );
+ ok( close($f), ' close' );
+
unlink("afile");
}
-# 42..44
{
- print "# \$!='$!'\nnot " unless open(local $f,'>', 'afile');
- ok;
- print $f "a row\n";
- print "not " unless close($f);
- ok;
- print "not " unless -s 'afile' < 10;
- ok;
+ ok( open(local $f,'>', 'afile'), 'open local $f, ">", ...' );
+ ok( (print $f "a row\n"), ' print');
+ ok( close($f), ' close');
+ ok( -s 'afile' < 10, ' -s' );
}
-# 45..47
{
- print "# \$!='$!'\nnot " unless open(local $f,'>>', 'afile');
- ok;
- print $f "a row\n";
- print "not " unless close($f);
- ok;
- print "not " unless -s 'afile' > 10;
- ok;
+ ok( open(local $f,'>>', 'afile'), 'open local $f, ">>", ...' );
+ ok( (print $f "a row\n"), ' print');
+ ok( close($f), ' close');
+ ok( -s 'afile' > 10, ' -s' );
}
-# 48..50
{
- print "# \$!='$!'\nnot " unless open(local $f, '<', 'afile');
- ok;
- @rows = <$f>;
- print "not " unless @rows == 2;
- ok;
- print "not " unless close($f);
- ok;
+ ok( open(local $f, '<', 'afile'), 'open local $f, "<", ...' );
+ my @rows = <$f>;
+ is( scalar @rows, 2, ' readline list context' );
+ ok( close($f), ' close' );
}
-# 51..55
+ok( -s 'afile' < 20, ' -s' );
+
{
- print "not " unless -s 'afile' < 20;
- ok;
- print "# \$!='$!'\nnot " unless open(local $f, '+<', 'afile');
- ok;
- @rows = <$f>;
- print "not " unless @rows == 2;
- ok;
- seek $f, 0, 1;
- print $f "yet another row\n";
- print "not " unless close($f);
- ok;
- print "not " unless -s 'afile' > 20;
- ok;
+ ok( open(local $f, '+<', 'afile'), 'open local $f, "+<", ...' );
+ my @rows = <$f>;
+ is( scalar @rows, 2, ' readline list context' );
+ ok( seek($f, 0, 1), ' seek cur' );
+ ok( (print $f "yet another row\n"), ' print' );
+ ok( close($f), ' close' );
+ ok( -s 'afile' > 20, ' -s' );
unlink("afile");
}
-# 56..58
-if ($Is_VMS) {
- for (56..58) { print "ok $_ # skipped: not Unix fork\n"; $test++;}
-}
-else {
- print "# \$!='$!'\nnot " unless open(local $f, '-|', <<'EOC');
- ./perl -e "print qq(a row\n); print qq(another row\n)"
+SKIP: {
+ skip "open -| busted and noisy on VMS", 3 if $Is_VMS;
+
+ ok( open(local $f, '-|', <<EOC), 'open local $f, "-|", ...' );
+ $Perl -e "print qq(a row\n); print qq(another row\n)"
EOC
- ok;
- @rows = <$f>;
- print "not " unless @rows == 2;
- ok;
- print "not " unless close($f);
- ok;
-}
+ my @rows = <$f>;
-# 59..62
-if ($Is_VMS) {
- for (59..62) { print "ok $_ # skipped: not Unix fork\n"; $test++;}
+ is( scalar @rows, 2, ' readline list context' );
+ ok( close($f), ' close' );
}
-else {
- print "# \$!='$!'\nnot " unless open(local $f, '|-', <<'EOC');
- ./perl -pe "s/^not //"
+
+{
+ ok( open(local $f, '|-', <<EOC), 'open local $f, "|-", ...' );
+ $Perl -pe "s/^not //"
EOC
- ok;
- @rows = <$f>;
- print $f "not ok $test\n"; $test++;
- print $f "not ok $test\n"; $test++;
- print "#\nnot " unless close($f);
+
+ my @rows = <$f>;
+ my $test = curr_test;
+ print $f "not ok $test - piping\n";
+ next_test;
+
+ $test = curr_test;
+ print $f "not ok $test - piping\n";
+ next_test;
+ ok( close($f), ' close' );
sleep 1;
- ok;
+ pass("Flush");
}
-# 63..64
-eval <<'EOE' and print "not ";
-open local $f, '<&', 'afile';
-1;
-EOE
-ok;
-$@ =~ /Bad filehandle:\s+afile/ or print "not ";
-ok;
-# 65..66
+ok( !eval { open local $f, '<&', 'afile'; 1 }, 'local <& on non-filehandle');
+like( $@, qr/Bad filehandle:\s+afile/, ' right error' );
+
+
{
local *F;
for (1..2) {
- if ($Is_Dos) {
- open(F, "echo \\#foo|") or print "not ";
- } else {
- open(F, "echo #foo|") or print "not ";
- }
- print <F>;
- close F;
+ ok( open(F, qq{$Perl -le "print 'ok'"|}), 'open to pipe' );
+ is(scalar <F>, "ok\n", ' readline');
+ ok( close F, ' close' );
}
- ok;
+
for (1..2) {
- if ($Is_Dos) {
- open(F, "-|", "echo \\#foo") or print "not ";
- } else {
- open(F, "-|", "echo #foo") or print "not ";
- }
- print <F>;
- close F;
+ ok( open(F, "-|", qq{$Perl -le "print 'ok'"}), 'open -|');
+ is( scalar <F>, "ok\n", ' readline');
+ ok( close F, ' close' );
}
- ok;
}
-# 67..70 - magic temporary file via 3 arg open with undef
+# magic temporary file via 3 arg open with undef
{
- open(my $x,"+<",undef) or print "not ";
- ok;
- print "not " unless defined(fileno($x));
- ok;
+ ok( open(my $x,"+<",undef), 'magic temp file via 3 arg open with undef');
+ ok( defined fileno($x), ' fileno' );
+
select $x;
- ok; # goes to $x
+ ok( (print "ok\n"), ' print' );
+
select STDOUT;
- seek($x,0,0);
- print <$x>;
- print "not " unless tell($x) > 3;
- ok;
+ ok( seek($x,0,0), ' seek' );
+ is( scalar <$x>, "ok\n", ' readline' );
+ ok( tell($x) >= 3, ' tell' );
}
diff --git a/t/lib/Math/BigFloat/Subclass.pm b/t/lib/Math/BigFloat/Subclass.pm
index 7a1c2790cc..209aa1df9d 100644
--- a/t/lib/Math/BigFloat/Subclass.pm
+++ b/t/lib/Math/BigFloat/Subclass.pm
@@ -24,9 +24,10 @@ sub new
my $proto = shift;
my $class = ref($proto) || $proto;
- my $value = shift || 0; # Set to 0 if not provided
- my $decimal = shift;
- my $radix = 0;
+ my $value = shift;
+ # Set to 0 if not provided, but don't use || (this would trigger for
+ # a passed objects to see if they are zero)
+ $value = 0 if !defined $value;
# Store the floating point value
my $self = bless Math::BigFloat->new($value), $class;
diff --git a/t/lib/Math/BigInt/BareCalc.pm b/t/lib/Math/BigInt/BareCalc.pm
new file mode 100644
index 0000000000..9cc7e94430
--- /dev/null
+++ b/t/lib/Math/BigInt/BareCalc.pm
@@ -0,0 +1,35 @@
+package Math::BigInt::BareCalc;
+
+use 5.005;
+use strict;
+# use warnings; # dont use warnings for older Perls
+
+require Exporter;
+use vars qw/@ISA $VERSION/;
+@ISA = qw(Exporter);
+
+$VERSION = '0.02';
+
+# Package to to test Bigint's simulation of Calc
+
+# uses Calc, but only features the strictly necc. methods.
+
+use Math::BigInt::Calc v0.17;
+
+BEGIN
+ {
+ foreach (qw/ base_len new zero one two copy str num add sub mul div inc dec
+ acmp len digit zeros
+ is_zero is_one is_odd is_even is_one check
+ /)
+ {
+ my $name = "Math::BigInt::Calc::_$_";
+ no strict 'refs';
+ *{"Math::BigInt::BareCalc::_$_"} = \&$name;
+ }
+ }
+
+# catch and throw away
+sub import { }
+
+1;
diff --git a/t/lib/Math/BigInt/Subclass.pm b/t/lib/Math/BigInt/Subclass.pm
index 79a4957d5b..3656b9ff11 100644
--- a/t/lib/Math/BigInt/Subclass.pm
+++ b/t/lib/Math/BigInt/Subclass.pm
@@ -25,9 +25,8 @@ sub new
my $proto = shift;
my $class = ref($proto) || $proto;
- my $value = shift; # no || 0 here!
- my $decimal = shift;
- my $radix = 0;
+ my $value = shift;
+ $value = 0 if !defined $value; # no || 0 here!
# Store the floating point value
my $self = bless Math::BigInt->new($value), $class;
diff --git a/t/lib/strict/subs b/t/lib/strict/subs
index ed4fe7a443..1e8b0588d8 100644
--- a/t/lib/strict/subs
+++ b/t/lib/strict/subs
@@ -317,3 +317,11 @@ Foo A 1
Foo B 2
Foo C 3
Foo D 4
+########
+
+# Check that barewords on the RHS of a regex match are caught
+use strict;
+"" =~ foo;
+EXPECT
+Bareword "foo" not allowed while "strict subs" in use at - line 4.
+Execution of - aborted due to compilation errors.
diff --git a/t/op/exec.t b/t/op/exec.t
index 2defb47db4..1be58fe5cc 100755
--- a/t/op/exec.t
+++ b/t/op/exec.t
@@ -1,54 +1,80 @@
#!./perl
+BEGIN: {
+ chdir 't' if -d 't';
+ @INC = ('../lib');
+ require './test.pl';
+}
+
+# supress VMS whinging about bad execs.
+use vmsish qw(hushed);
+
$| = 1; # flush stdout
$ENV{LC_ALL} = 'C'; # Forge English error messages.
$ENV{LANGUAGE} = 'C'; # Ditto in GNU.
-if ($^O eq 'MSWin32' || $^O eq 'NetWare') {
- # XXX the system tests could be written to use ./perl and so work on Win32
- print "1..0 # Skip: shh, win32\n";
- exit(0);
-}
+plan(tests => 14);
+
+my $Perl = which_perl();
-if ($^O eq 'MacOS') {
- # XXX the system tests could be written to use ./perl and so work on Win32
- print "1..0 # Mostly useless tests for Mac OS\n";
- exit(0);
+my $exit;
+SKIP: {
+ skip("bug/feature of pdksh", 2) if $^O eq 'os2';
+
+ $exit = system qq{$Perl -le "print q{ok 1 - interpreted system(EXPR)"}};
+ next_test();
+ is( $exit, 0, ' exited 0' );
}
-print "1..8\n";
+$exit = system qq{$Perl -le "print q{ok 3 - split & direct call system(EXPR)"}};
+next_test();
+is( $exit, 0, ' exited 0' );
+
+# On VMS you need the quotes around the program or it won't work.
+# On Unix its the opposite.
+my $quote = $^O eq 'VMS' ? '"' : '';
+$exit = system $Perl, '-le',
+ "${quote}print q{ok 5 - system(PROG, LIST)}${quote}";
+next_test();
+is( $exit, 0, ' exited 0' );
+
+
+is( system(qq{$Perl -e "exit 0"}), 0, 'Explicit exit of 0' );
-if ($^O ne 'os2') {
- print "not ok 1\n" if system "echo ok \\1"; # shell interpreted
-}
-else {
- print "ok 1 # skipped: bug/feature of pdksh\n"; # shell interpreted
+my $exit_one = $^O eq 'VMS' ? 4 << 8 : 1 << 8;
+is( system(qq{$Perl "-I../lib" -e "use vmsish qw(hushed); exit 1"}), $exit_one,
+ 'Explicit exit of 1' );
+
+
+$rc = system "lskdfj";
+unless( ok($rc == 255 << 8 or $rc == -1 or $rc == 256) ) {
+ print "# \$rc == $rc\n";
+}
+
+unless ( ok( $! == 2 or $! =~ /\bno\b.*\bfile/i or
+ $! == 13 or $! =~ /permission denied/i or
+ $! == 22 or $! =~ /invalid argument/ ) ) {
+ printf "# \$! eq %d, '%s'\n", $!, $!;
}
-print "not ok 2\n" if system "echo ok 2"; # split and directly called
-print "not ok 3\n" if system "echo", "ok", "3"; # directly called
-# these should probably be rewritten to match the examples in perlfunc.pod
-if (system "true") {print "not ok 4\n";} else {print "ok 4\n";}
-if ($^O eq 'mpeix') {
- print "ok 5 # skipped: status broken on MPE/iX\n";
-} else {
- if ((system "/bin/sh -c 'exit 1'") != 256) { print "not "; }
- print "ok 5\n";
+is( `$Perl -le "print 'ok'"`, "ok\n", 'basic ``' );
+is( <<`END`, "ok\n", '<<`HEREDOC`' );
+$Perl -le "print 'ok'"
+END
+
+
+TODO: {
+ if( $^O =~ /Win32/ ) {
+ print "not ok 11 - exec failure doesn't terminate process # TODO Win32 exec failure waits for user input\n";
+ last TODO;
+ }
+
+ ok( !exec("lskdjfalksdjfdjfkls"),
+ "exec failure doesn't terminate process");
}
-$rc = system "lskdfj";
-if ($rc == 255 << 8 or $rc == -1 and
- (
- $! == 2 or
- $! =~ /\bno\b.*\bfile/i or
- $! == 13 or
- $! =~ /permission denied/i
- )
- )
- {print "ok 6\n";} else {print "not ok 6\n";}
-
-unless (exec "lskdjfalksdjfdjfkls") {print "ok 7\n";} else {print "not ok 7\n";}
-
-exec "echo","ok","8";
+my $test = curr_test();
+exec $Perl, '-le', qq{${quote}print 'ok $test - exec PROG, LIST'${quote}};
+fail("This should never be reached if the exec() worked");
diff --git a/t/op/inc.t b/t/op/inc.t
index f59115e760..f360c031fe 100755
--- a/t/op/inc.t
+++ b/t/op/inc.t
@@ -1,97 +1,153 @@
-#!./perl
+#!./perl -w
-print "1..12\n";
+# use strict;
+
+print "1..24\n";
+
+my $test = 1;
+
+sub ok {
+ my ($pass, $wrong, $err) = @_;
+ if ($pass) {
+ print "ok $test\n";
+ $test = $test + 1; # Would be doubleplusbad to use ++ in the ++ test.
+ return 1;
+ } else {
+ if ($err) {
+ chomp $err;
+ print "not ok $test # $err\n";
+ } else {
+ if (defined $wrong) {
+ $wrong = ", got $wrong";
+ } else {
+ $wrong = '';
+ }
+ printf "not ok $test # line %d$wrong\n", (caller)[2];
+ }
+ }
+ $test = $test + 1;
+ return;
+}
# Verify that addition/subtraction properly upgrade to doubles.
# These tests are only significant on machines with 32 bit longs,
# and two's complement negation, but shouldn't fail anywhere.
-$a = 2147483647;
-$c=$a++;
-if ($a == 2147483648)
- {print "ok 1\n"}
-else
- {print "not ok 1\n";}
+my $a = 2147483647;
+my $c=$a++;
+ok ($a == 2147483648, $a);
$a = 2147483647;
$c=++$a;
-if ($a == 2147483648)
- {print "ok 2\n"}
-else
- {print "not ok 2\n";}
+ok ($a == 2147483648, $a);
$a = 2147483647;
$a=$a+1;
-if ($a == 2147483648)
- {print "ok 3\n"}
-else
- {print "not ok 3\n";}
+ok ($a == 2147483648, $a);
$a = -2147483648;
$c=$a--;
-if ($a == -2147483649)
- {print "ok 4\n"}
-else
- {print "not ok 4\n";}
+ok ($a == -2147483649, $a);
$a = -2147483648;
$c=--$a;
-if ($a == -2147483649)
- {print "ok 5\n"}
-else
- {print "not ok 5\n";}
+ok ($a == -2147483649, $a);
$a = -2147483648;
$a=$a-1;
-if ($a == -2147483649)
- {print "ok 6\n"}
-else
- {print "not ok 6\n";}
+ok ($a == -2147483649, $a);
$a = 2147483648;
$a = -$a;
$c=$a--;
-if ($a == -2147483649)
- {print "ok 7\n"}
-else
- {print "not ok 7\n";}
+ok ($a == -2147483649, $a);
$a = 2147483648;
$a = -$a;
$c=--$a;
-if ($a == -2147483649)
- {print "ok 8\n"}
-else
- {print "not ok 8\n";}
+ok ($a == -2147483649, $a);
$a = 2147483648;
$a = -$a;
$a=$a-1;
-if ($a == -2147483649)
- {print "ok 9\n"}
-else
- {print "not ok 9\n";}
+ok ($a == -2147483649, $a);
$a = 2147483648;
$b = -$a;
$c=$b--;
-if ($b == -$a-1)
- {print "ok 10\n"}
-else
- {print "not ok 10\n";}
+ok ($b == -$a-1, $a);
$a = 2147483648;
$b = -$a;
$c=--$b;
-if ($b == -$a-1)
- {print "ok 11\n"}
-else
- {print "not ok 11\n";}
+ok ($b == -$a-1, $a);
$a = 2147483648;
$b = -$a;
$b=$b-1;
-if ($b == -(++$a))
- {print "ok 12\n"}
-else
- {print "not ok 12\n";}
+ok ($b == -(++$a), $a);
+
+# Verify that shared hash keys become unshared.
+
+sub check_same {
+ my ($orig, $suspect) = @_;
+ my $fail;
+ while (my ($key, $value) = each %$suspect) {
+ if (exists $orig->{$key}) {
+ if ($orig->{$key} ne $value) {
+ print "# key '$key' was '$orig->{$key}' now '$value'\n";
+ $fail = 1;
+ }
+ } else {
+ print "# key '$key' is '$orig->{$key}', unexpect.\n";
+ $fail = 1;
+ }
+ }
+ foreach (keys %$orig) {
+ next if (exists $suspect->{$_});
+ print "# key '$_' was '$orig->{$_}' now missing\n";
+ $fail = 1;
+ }
+ ok (!$fail);
+}
+
+my (%orig) = my (%inc) = my (%dec) = my (%postinc) = my (%postdec)
+ = (1 => 1, ab => "ab");
+my %up = (1=>2, ab => 'ac');
+my %down = (1=>0, ab => -1);
+
+foreach (keys %inc) {
+ my $ans = $up{$_};
+ my $up;
+ eval {$up = ++$_};
+ ok ((defined $up and $up eq $ans), $up, $@);
+}
+
+check_same (\%orig, \%inc);
+
+foreach (keys %dec) {
+ my $ans = $down{$_};
+ my $down;
+ eval {$down = --$_};
+ ok ((defined $down and $down eq $ans), $down, $@);
+}
+
+check_same (\%orig, \%dec);
+
+foreach (keys %postinc) {
+ my $ans = $postinc{$_};
+ my $up;
+ eval {$up = $_++};
+ ok ((defined $up and $up eq $ans), $up, $@);
+}
+
+check_same (\%orig, \%postinc);
+
+foreach (keys %postdec) {
+ my $ans = $postdec{$_};
+ my $down;
+ eval {$down = $_--};
+ ok ((defined $down and $down eq $ans), $down, $@);
+}
+
+check_same (\%orig, \%postdec);
diff --git a/t/op/magic.t b/t/op/magic.t
index 4f386231fc..f9df5bdfe0 100755
--- a/t/op/magic.t
+++ b/t/op/magic.t
@@ -250,10 +250,7 @@ else {
: (`echo \$__NoNeSuCh` eq "foo\n") );
}
-if ($Is_VMS) {
- ok(1,0,"'\$!=undef' does throw a warning");
-}
-else {
+{
local $SIG{'__WARN__'} = sub { print "# @_\nnot " };
$! = undef;
ok 1;
diff --git a/t/op/re_tests b/t/op/re_tests
index c7ab5ad814..3d939a6635 100644
--- a/t/op/re_tests
+++ b/t/op/re_tests
@@ -796,3 +796,4 @@ ab(?i)cd abCd y - -
(A|B)*(?(1)(CD)|(CD)) ABCD y $2-$3 CD-
(A|B)*?(?(1)(CD)|(CD)) CD y $2-$3 -CD # [ID 20010803.016]
(A|B)*?(?(1)(CD)|(CD)) ABCD y $2-$3 CD-
+'^(o)(?!.*\1)'i Oo n - -
diff --git a/t/op/ref.t b/t/op/ref.t
index 613c4504e0..4b1d6e37a7 100755
--- a/t/op/ref.t
+++ b/t/op/ref.t
@@ -2,7 +2,7 @@
BEGIN {
chdir 't' if -d 't';
- @INC = qw(.);
+ @INC = qw(. ../lib);
}
print "1..62\n";
diff --git a/t/op/tr.t b/t/op/tr.t
index 124c08a94e..b37eb7f186 100755
--- a/t/op/tr.t
+++ b/t/op/tr.t
@@ -3,26 +3,26 @@
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
+ require './test.pl';
}
-print "1..70\n";
+plan tests => 97;
+
+my $Is_EBCDIC = (ord('i') == 0x89 & ord('J') == 0xd1);
$_ = "abcdefghijklmnopqrstuvwxyz";
tr/a-z/A-Z/;
-print "not " unless $_ eq "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
-print "ok 1\n";
+is($_, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 'uc');
tr/A-Z/a-z/;
-print "not " unless $_ eq "abcdefghijklmnopqrstuvwxyz";
-print "ok 2\n";
+is($_, "abcdefghijklmnopqrstuvwxyz", 'lc');
tr/b-y/B-Y/;
+is($_, "aBCDEFGHIJKLMNOPQRSTUVWXYz", 'partial uc');
-print "not " unless $_ eq "aBCDEFGHIJKLMNOPQRSTUVWXYz";
-print "ok 3\n";
# In EBCDIC 'I' is \xc9 and 'J' is \0xd1, 'i' is \x89 and 'j' is \x91.
# Yes, discontinuities. Regardless, the \xca in the below should stay
@@ -33,150 +33,154 @@ print "ok 3\n";
tr/I-J/i-j/;
- print "not " unless $_ eq "i\xcaj";
- print "ok 4\n";
+ is($_, "i\xcaj", 'EBCDIC discontinuity');
}
#
-# make sure that tr cancels IOK and NOK
+
($x = 12) =~ tr/1/3/;
(my $y = 12) =~ tr/1/3/;
($f = 1.5) =~ tr/1/3/;
(my $g = 1.5) =~ tr/1/3/;
-print "not " unless $x + $y + $f + $g == 71;
-print "ok 5\n";
+is($x + $y + $f + $g, 71, 'tr cancels IOK and NOK');
+
-# make sure tr is harmless if not updating - see [ID 20000511.005]
+# perlbug [ID 20000511.005]
$_ = 'fred';
/([a-z]{2})/;
$1 =~ tr/A-Z//;
s/^(\s*)f/$1F/;
-print "not " if $_ ne 'Fred';
-print "ok 6\n";
+is($_, 'Fred', 'harmless if explicitly not updating');
+
+
+# A variant of the above, added in 5.7.2
+$_ = 'fred';
+/([a-z]{2})/;
+eval '$1 =~ tr/A-Z/A-Z/;';
+s/^(\s*)f/$1F/;
+is($_, 'Fred', 'harmless if implicitly not updating');
+is($@, '', ' no error');
+
# check tr handles UTF8 correctly
($x = 256.65.258) =~ tr/a/b/;
-print "not " if $x ne 256.65.258 or length $x != 3;
-print "ok 7\n";
+is($x, 256.65.258, 'handles UTF8');
+is(length $x, 3);
+
$x =~ tr/A/B/;
+is(length $x, 3);
if (ord("\t") == 9) { # ASCII
- print "not " if $x ne 256.66.258 or length $x != 3;
+ is($x, 256.66.258);
}
else {
- print "not " if $x ne 256.65.258 or length $x != 3;
+ is($x, 256.65.258);
}
-print "ok 8\n";
+
# EBCDIC variants of the above tests
($x = 256.193.258) =~ tr/a/b/;
-print "not " if $x ne 256.193.258 or length $x != 3;
-print "ok 9\n";
+is(length $x, 3);
+is($x, 256.193.258);
+
$x =~ tr/A/B/;
+is(length $x, 3);
if (ord("\t") == 9) { # ASCII
- print "not " if $x ne 256.193.258 or length $x != 3;
+ is($x, 256.193.258);
}
else {
- print "not " if $x ne 256.194.258 or length $x != 3;
+ is($x, 256.194.258);
}
-print "ok 10\n";
+
{
-# 11 - changing UTF8 characters in a UTF8 string, same length.
-my $l = chr(300); my $r = chr(400);
-$x = 200.300.400;
-$x =~ tr/\x{12c}/\x{190}/;
-printf "not (%vd) ", $x if $x ne 200.400.400 or length $x != 3;
-print "ok 11\n";
-
-# 12 - changing UTF8 characters in UTF8 string, more bytes.
-$x = 200.300.400;
-$x =~ tr/\x{12c}/\x{be8}/;
-printf "not (%vd) ", $x if $x ne 200.3048.400 or length $x != 3;
-print "ok 12\n";
-
-# 13 - introducing UTF8 characters to non-UTF8 string.
-$x = 100.125.60;
-$x =~ tr/\x{64}/\x{190}/;
-printf "not (%vd) ", $x if $x ne 400.125.60 or length $x != 3;
-print "ok 13\n";
-
-# 14 - removing UTF8 characters from UTF8 string
-$x = 400.125.60;
-$x =~ tr/\x{190}/\x{64}/;
-printf "not (%vd) ", $x if $x ne 100.125.60 or length $x != 3;
-print "ok 14\n";
-
-# 15 - counting UTF8 chars in UTF8 string
-$x = 400.125.60.400;
-$y = $x =~ tr/\x{190}/\x{190}/;
-print "not " if $y != 2;
-print "ok 15\n";
-
-# 16 - counting non-UTF8 chars in UTF8 string
-$x = 60.400.125.60.400;
-$y = $x =~ tr/\x{3c}/\x{3c}/;
-print "not " if $y != 2;
-print "ok 16\n";
-
-# 17 - counting UTF8 chars in non-UTF8 string
-$x = 200.125.60;
-$y = $x =~ tr/\x{190}/\x{190}/;
-print "not " if $y != 0;
-print "ok 17\n";
+ my $l = chr(300); my $r = chr(400);
+ $x = 200.300.400;
+ $x =~ tr/\x{12c}/\x{190}/;
+ is($x, 200.400.400,
+ 'changing UTF8 chars in a UTF8 string, same length');
+ is(length $x, 3);
+
+ $x = 200.300.400;
+ $x =~ tr/\x{12c}/\x{be8}/;
+ is($x, 200.3048.400, ' more bytes');
+ is(length $x, 3);
+
+ $x = 100.125.60;
+ $x =~ tr/\x{64}/\x{190}/;
+ is($x, 400.125.60, 'Putting UT8 chars into a non-UTF8 string');
+ is(length $x, 3);
+
+ $x = 400.125.60;
+ $x =~ tr/\x{190}/\x{64}/;
+ is($x, 100.125.60, 'Removing UTF8 chars from UTF8 string');
+ is(length $x, 3);
+
+ $x = 400.125.60.400;
+ $y = $x =~ tr/\x{190}/\x{190}/;
+ is($y, 2, 'Counting UTF8 chars in UTF8 string');
+
+ $x = 60.400.125.60.400;
+ $y = $x =~ tr/\x{3c}/\x{3c}/;
+ is($y, 2, ' non-UTF8 chars in UTF8 string');
+
+ # 17 - counting UTF8 chars in non-UTF8 string
+ $x = 200.125.60;
+ $y = $x =~ tr/\x{190}/\x{190}/;
+ is($y, 0, ' UTF8 chars in non-UTFs string');
}
-# 18: test brokenness with tr/a-z-9//;
$_ = "abcdefghijklmnopqrstuvwxyz";
-eval "tr/a-z-9/ /";
-print (($@ =~ /^Ambiguous range in transliteration operator/)
- ? '' : 'not ', "ok 18\n");
+eval 'tr/a-z-9/ /';
+like($@, qr/^Ambiguous range in transliteration operator/, 'tr/a-z-9//');
# 19-21: Make sure leading and trailing hyphens still work
$_ = "car-rot9";
tr/-a-m/./;
-print (($_ eq '..r.rot9') ? '' : 'not ', "ok 19\n");
+is($_, '..r.rot9', 'hyphens, leading');
$_ = "car-rot9";
tr/a-m-/./;
-print (($_ eq '..r.rot9') ? '' : 'not ', "ok 20\n");
+is($_, '..r.rot9', ' trailing');
$_ = "car-rot9";
tr/-a-m-/./;
-print (($_ eq '..r.rot9') ? '' : 'not ', "ok 21\n");
+is($_, '..r.rot9', ' both');
$_ = "abcdefghijklmnop";
tr/ae-hn/./;
-print (($_ eq '.bcd....ijklm.op') ? '' : 'not ', "ok 22\n");
+is($_, '.bcd....ijklm.op');
$_ = "abcdefghijklmnop";
tr/a-cf-kn-p/./;
-print (($_ eq '...de......lm...') ? '' : 'not ', "ok 23\n");
+is($_, '...de......lm...');
$_ = "abcdefghijklmnop";
tr/a-ceg-ikm-o/./;
-print (($_ eq '...d.f...j.l...p') ? '' : 'not ', "ok 24\n");
+is($_, '...d.f...j.l...p');
+
-# 25: Test reversed range check
# 20000705 MJD
eval "tr/m-d/ /";
-print (($@ =~ /^Invalid \[\] range "m-d" in transliteration operator/)
- ? '' : 'not ', "ok 25\n");
+like($@, qr/^Invalid \[\] range "m-d" in transliteration operator/,
+ 'reversed range check');
-# 26: test cannot update if read-only
eval '$1 =~ tr/x/y/';
-print (($@ =~ /^Modification of a read-only value attempted/) ? '' : 'not ',
- "ok 26\n");
+like($@, qr/^Modification of a read-only value attempted/,
+ 'cannot update read-only var');
-# 27: test can count read-only
'abcdef' =~ /(bcd)/;
-print (( eval '$1 =~ tr/abcd//' == 3) ? '' : 'not ', "ok 27\n");
+is(eval '$1 =~ tr/abcd//', 3, 'explicit read-only count');
+is($@, '', ' no error');
-# 28: test lhs OK if not updating
-print ((eval '"123" =~ tr/12//' == 2) ? '' : 'not ', "ok 28\n");
+'abcdef' =~ /(bcd)/;
+is(eval '$1 =~ tr/abcd/abcd/', 3, 'implicit read-only count');
+is($@, '', ' no error');
+
+is(eval '"123" =~ tr/12//', 2, 'LHS of non-updating tr');
+
+eval '"123" =~ tr/1/2/';
+like($@, qr|^Can't modify constant item in transliteration \(tr///\)|,
+ 'LHS bad on updating tr');
-# 29: test lhs bad if updating
-eval '"123" =~ tr/1/1/';
-print (($@ =~ m|^Can't modify constant item in transliteration \(tr///\)|)
- ? '' : 'not ', "ok 29\n");
# v300 (0x12c) is UTF-8-encoded as 196 172 (0xc4 0xac)
# v400 (0x190) is UTF-8-encoded as 198 144 (0xc6 0x90)
@@ -184,144 +188,108 @@ print (($@ =~ m|^Can't modify constant item in transliteration \(tr///\)|)
# Transliterate a byte to a byte, all four ways.
($a = v300.196.172.300.196.172) =~ tr/\xc4/\xc5/;
-print "not " unless $a eq v300.197.172.300.197.172;
-print "ok 30\n";
+is($a, v300.197.172.300.197.172, 'byte2byte transliteration');
($a = v300.196.172.300.196.172) =~ tr/\xc4/\x{c5}/;
-print "not " unless $a eq v300.197.172.300.197.172;
-print "ok 31\n";
+is($a, v300.197.172.300.197.172);
($a = v300.196.172.300.196.172) =~ tr/\x{c4}/\xc5/;
-print "not " unless $a eq v300.197.172.300.197.172;
-print "ok 32\n";
+is($a, v300.197.172.300.197.172);
($a = v300.196.172.300.196.172) =~ tr/\x{c4}/\x{c5}/;
-print "not " unless $a eq v300.197.172.300.197.172;
-print "ok 33\n";
+is($a, v300.197.172.300.197.172);
-# Transliterate a byte to a wide character.
($a = v300.196.172.300.196.172) =~ tr/\xc4/\x{12d}/;
-print "not " unless $a eq v300.301.172.300.301.172;
-print "ok 34\n";
-
-# Transliterate a wide character to a byte.
+is($a, v300.301.172.300.301.172, 'byte2wide transliteration');
($a = v300.196.172.300.196.172) =~ tr/\x{12c}/\xc3/;
-print "not " unless $a eq v195.196.172.195.196.172;
-print "ok 35\n";
-
-# Transliterate a wide character to a wide character.
+is($a, v195.196.172.195.196.172, ' wide2byte');
($a = v300.196.172.300.196.172) =~ tr/\x{12c}/\x{12d}/;
-print "not " unless $a eq v301.196.172.301.196.172;
-print "ok 36\n";
+is($a, v301.196.172.301.196.172, ' wide2wide');
-# Transliterate both ways.
($a = v300.196.172.300.196.172) =~ tr/\xc4\x{12c}/\x{12d}\xc3/;
-print "not " unless $a eq v195.301.172.195.301.172;
-print "ok 37\n";
+is($a, v195.301.172.195.301.172, 'byte2wide & wide2byte');
-# Transliterate all (four) ways.
($a = v300.196.172.300.196.172.400.198.144) =~
tr/\xac\xc4\x{12c}\x{190}/\xad\x{12d}\xc5\x{191}/;
-print "not " unless $a eq v197.301.173.197.301.173.401.198.144;
-print "ok 38\n";
+is($a, v197.301.173.197.301.173.401.198.144, 'all together now!');
-# Transliterate and count.
-print "not "
- unless (($a = v300.196.172.300.196.172) =~ tr/\xc4/\xc5/) == 2;
-print "ok 39\n";
+is((($a = v300.196.172.300.196.172) =~ tr/\xc4/\xc5/), 2,
+ 'transliterate and count');
-print "not "
- unless (($a = v300.196.172.300.196.172) =~ tr/\x{12c}/\x{12d}/) == 2;
-print "ok 40\n";
+is((($a = v300.196.172.300.196.172) =~ tr/\x{12c}/\x{12d}/), 2);
-# Transliterate with complement.
($a = v300.196.172.300.196.172) =~ tr/\xc4/\x{12d}/c;
-print "not " unless $a eq v301.196.301.301.196.301;
-print "ok 41\n";
+is($a, v301.196.301.301.196.301, 'translit w/complement');
($a = v300.196.172.300.196.172) =~ tr/\x{12c}/\xc5/c;
-print "not " unless $a eq v300.197.197.300.197.197;
-print "ok 42\n";
+is($a, v300.197.197.300.197.197);
-# Transliterate with deletion.
($a = v300.196.172.300.196.172) =~ tr/\xc4//d;
-print "not " unless $a eq v300.172.300.172;
-print "ok 43\n";
+is($a, v300.172.300.172, 'translit w/deletion');
($a = v300.196.172.300.196.172) =~ tr/\x{12c}//d;
-print "not " unless $a eq v196.172.196.172;
-print "ok 44\n";
+is($a, v196.172.196.172);
-# Transliterate with squeeze.
($a = v196.196.172.300.300.196.172) =~ tr/\xc4/\xc5/s;
-print "not " unless $a eq v197.172.300.300.197.172;
-print "ok 45\n";
+is($a, v197.172.300.300.197.172, 'translit w/squeeze');
($a = v196.172.300.300.196.172.172) =~ tr/\x{12c}/\x{12d}/s;
-print "not " unless $a eq v196.172.301.196.172.172;
-print "ok 46\n";
+is($a, v196.172.301.196.172.172);
-# Tricky cases by Simon Cozens.
+# Tricky cases (When Simon Cozens Attacks)
($a = v196.172.200) =~ tr/\x{12c}/a/;
-print "not " unless sprintf("%vd", $a) eq '196.172.200';
-print "ok 47\n";
+is(sprintf("%vd", $a), '196.172.200');
($a = v196.172.200) =~ tr/\x{12c}/\x{12c}/;
-print "not " unless sprintf("%vd", $a) eq '196.172.200';
-print "ok 48\n";
+is(sprintf("%vd", $a), '196.172.200');
($a = v196.172.200) =~ tr/\x{12c}//d;
-print "not " unless sprintf("%vd", $a) eq '196.172.200';
-print "ok 49\n";
+is(sprintf("%vd", $a), '196.172.200');
+
# UTF8 range tests from Inaba Hiroto
# Not working in EBCDIC as of 12674.
($a = v300.196.172.302.197.172) =~ tr/\x{12c}-\x{130}/\xc0-\xc4/;
-print "not " unless $a eq v192.196.172.194.197.172;
-print "ok 50\n";
+is($a, v192.196.172.194.197.172, 'UTF range');
($a = v300.196.172.302.197.172) =~ tr/\xc4-\xc8/\x{12c}-\x{130}/;
-print "not " unless $a eq v300.300.172.302.301.172;
-print "ok 51\n";
+is($a, v300.300.172.302.301.172);
+
# UTF8 range tests from Karsten Sperling (patch #9008 required)
($a = "\x{0100}") =~ tr/\x00-\x{100}/X/;
-print "not " unless $a eq "X";
-print "ok 52\n";
+is($a, "X");
($a = "\x{0100}") =~ tr/\x{0000}-\x{00ff}/X/c;
-print "not " unless $a eq "X";
-print "ok 53\n";
+is($a, "X");
($a = "\x{0100}") =~ tr/\x{0000}-\x{00ff}\x{0101}/X/c;
-print "not " unless $a eq "X";
-print "ok 54\n";
+is($a, "X");
($a = v256) =~ tr/\x{0000}-\x{00ff}\x{0101}/X/c;
-print "not " unless $a eq "X";
-print "ok 55\n";
+is($a, "X");
+
# UTF8 range tests from Inaba Hiroto
($a = "\x{200}") =~ tr/\x00-\x{100}/X/c;
-print "not " unless $a eq "X";
-print "ok 56\n";
+is($a, "X");
($a = "\x{200}") =~ tr/\x00-\x{100}/X/cs;
-print "not " unless $a eq "X";
-print "ok 57\n";
+is($a, "X");
+
# Tricky on EBCDIC: while [a-z] [A-Z] must not match the gap characters,
# (i-j, r-s, I-J, R-S), [\x89-\x91] [\xc9-\xd1] has to match them,
@@ -329,65 +297,85 @@ print "ok 57\n";
# Not working in EBCDIC as of 12674.
$c = ($a = "\x89\x8a\x8b\x8c\x8d\x8f\x90\x91") =~ tr/\x89-\x91/X/;
-print "not " unless $c == 8 and $a eq "XXXXXXXX";
-print "ok 58\n";
+is($c, 8);
+is($a, "XXXXXXXX");
# Not working in EBCDIC as of 12674.
$c = ($a = "\xc9\xca\xcb\xcc\xcd\xcf\xd0\xd1") =~ tr/\xc9-\xd1/X/;
-print "not " unless $c == 8 and $a eq "XXXXXXXX";
-print "ok 59\n";
-
-if (ord('i') == 0x89 & ord('J') == 0xd1) {
+is($c, 8);
+is($a, "XXXXXXXX");
-$c = ($a = "\x89\x8a\x8b\x8c\x8d\x8f\x90\x91") =~ tr/i-j/X/;
-print "not " unless $c == 2 and $a eq "X\x8a\x8b\x8c\x8d\x8f\x90X";
-print "ok 60\n";
-
-$c = ($a = "\xc9\xca\xcb\xcc\xcd\xcf\xd0\xd1") =~ tr/I-J/X/;
-print "not " unless $c == 2 and $a eq "X\xca\xcb\xcc\xcd\xcf\xd0X";
-print "ok 61\n";
-} else {
- for (60..61) { print "ok $_ # Skip: not EBCDIC\n" }
+SKIP: {
+ skip "not EBCDIC", 4 unless $Is_EBCDIC;
+
+ $c = ($a = "\x89\x8a\x8b\x8c\x8d\x8f\x90\x91") =~ tr/i-j/X/;
+ is($c, 2);
+ is($a, "X\x8a\x8b\x8c\x8d\x8f\x90X");
+
+ $c = ($a = "\xc9\xca\xcb\xcc\xcd\xcf\xd0\xd1") =~ tr/I-J/X/;
+ is($c, 2);
+ is($a, "X\xca\xcb\xcc\xcd\xcf\xd0X");
}
($a = "\x{100}") =~ tr/\x00-\xff/X/c;
-print "not " unless ord($a) == ord("X");
-print "ok 62\n";
+is(ord($a), ord("X"));
($a = "\x{100}") =~ tr/\x00-\xff/X/cs;
-print "not " unless ord($a) == ord("X");
-print "ok 63\n";
+is(ord($a), ord("X"));
($a = "\x{100}\x{100}") =~ tr/\x{101}-\x{200}//c;
-print "not " unless $a eq "\x{100}\x{100}";
-print "ok 64\n";
+is($a, "\x{100}\x{100}");
($a = "\x{100}\x{100}") =~ tr/\x{101}-\x{200}//cs;
-print "not " unless $a eq "\x{100}";
-print "ok 65\n";
+is($a, "\x{100}");
$a = "\xfe\xff"; $a =~ tr/\xfe\xff/\x{1ff}\x{1fe}/;
-print "not " unless $a eq "\x{1ff}\x{1fe}";
-print "ok 66\n";
+is($a, "\x{1ff}\x{1fe}");
+
# From David Dyck
($a = "R0_001") =~ tr/R_//d;
-print "not " if hex($a) != 1;
-print "ok 67\n";
+is(hex($a), 1);
# From Inaba Hiroto
@a = (1,2); map { y/1/./ for $_ } @a;
-print "not " if "@a" ne ". 2";
-print "ok 68\n";
+is("@a", ". 2");
@a = (1,2); map { y/1/./ for $_.'' } @a;
-print "not " if "@a" ne "1 2";
-print "ok 69\n";
+is("@a", "1 2");
+
# 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";
+is($a, "XZY");
+
+
+# Used to fail with "Modification of a read-only value attempted"
+%a = (N=>1);
+foreach (keys %a) {
+ eval 'tr/N/n/';
+ is($_, 'n', 'pp_trans needs to unshare shared hash keys');
+ is($@, '', ' no error');
+}
+
+
+$x = eval '"1213" =~ tr/1/1/';
+is($x, 2, 'implicit count on constant');
+is($@, '', ' no error');
+
+
+my @foo = ();
+eval '$foo[-1] =~ tr/N/N/';
+is( $@, '', 'implicit count outside array bounds, index negative' );
+is( scalar @foo, 0, " doesn't extend the array");
+
+eval '$foo[1] =~ tr/N/N/';
+is( $@, '', 'implicit count outside array bounds, index positive' );
+is( scalar @foo, 0, " doesn't extend the array");
+my %foo = ();
+eval '$foo{bar} =~ tr/N/N/';
+is( $@, '', 'implicit count outside hash bounds' );
+is( scalar keys %foo, 0, " doesn't extend the hash");
diff --git a/t/run/kill_perl.t b/t/run/kill_perl.t
index 6345a793a4..e568afe1ed 100644
--- a/t/run/kill_perl.t
+++ b/t/run/kill_perl.t
@@ -22,10 +22,13 @@
BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
+ require './test.pl';
}
use strict;
+my $Perl = which_perl;
+
$|=1;
my @prgs = ();
@@ -69,17 +72,11 @@ foreach my $prog (@prgs) {
close TEST or die "Cannot close $tmpfile: $!";
my $results;
- if ($^O eq 'MSWin32') {
- $results = `.\\perl -I../lib $switch $tmpfile 2>&1`;
- }
- elsif ($^O eq 'NetWare') {
- $results = `perl -I../lib $switch $tmpfile 2>&1`;
- }
- elsif ($^O eq 'MacOS') {
- $results = `$^X -I::lib -MMac::err=unix $switch $tmpfile`;
+ if ($^O eq 'MacOS') {
+ $results = `$Perl -I::lib -MMac::err=unix $switch $tmpfile`;
}
else {
- $results = `./perl "-I../lib" $switch $tmpfile 2>&1`;
+ $results = `$Perl "-I../lib" $switch $tmpfile 2>&1`;
}
my $status = $?;
diff --git a/t/test.pl b/t/test.pl
index e4411af078..ca4af688dc 100644
--- a/t/test.pl
+++ b/t/test.pl
@@ -15,22 +15,22 @@ sub plan {
my %plan = @_;
$n = $plan{tests};
}
- print "1..$n\n";
+ print STDOUT "1..$n\n";
$planned = $n;
}
END {
my $ran = $test - 1;
if (defined $planned && $planned != $ran) {
- print "# Looks like you planned $planned tests but ran $ran.\n";
+ print STDOUT "# Looks like you planned $planned tests but ran $ran.\n";
}
}
sub skip_all {
if (@_) {
- print "1..0 - @_\n";
+ print STDOUT "1..0 - @_\n";
} else {
- print "1..0\n";
+ print STDOUT "1..0\n";
}
exit(0);
}
@@ -47,15 +47,15 @@ sub _ok {
}
$out .= " # TODO $TODO" if $TODO;
- print "$out\n";
+ print STDOUT "$out\n";
unless ($pass) {
- print "# Failed $where\n";
+ print STDOUT "# Failed $where\n";
}
# Ensure that the message is properly escaped.
- print map { /^#/ ? "$_\n" : "# $_\n" }
- map { split /\n/ } @mess if @mess;
+ print STDOUT map { /^#/ ? "$_\n" : "# $_\n" }
+ map { split /\n/ } @mess if @mess;
$test++;
@@ -127,6 +127,10 @@ sub fail {
_ok(0, _where(), @_);
}
+sub curr_test {
+ return $test;
+}
+
sub next_test {
$test++
}
@@ -137,7 +141,7 @@ sub skip {
my $why = shift;
my $n = @_ ? shift : 1;
for (1..$n) {
- print "ok $test # skip: $why\n";
+ print STDOUT "ok $test # skip: $why\n";
$test++;
}
local $^W = 0;
@@ -245,11 +249,42 @@ sub runperl {
if ($args{verbose}) {
my $runperldisplay = $runperl;
$runperldisplay =~ s/\n/\n\#/g;
- print "# $runperldisplay\n";
+ print STDOUT "# $runperldisplay\n";
}
my $result = `$runperl`;
$result =~ s/\n\n/\n/ if $is_vms; # XXX pipes sometimes double these
return $result;
}
+
+sub BAILOUT {
+ print STDOUT "Bail out! @_\n";
+ exit;
+}
+
+
+# A somewhat safer version of the sometimes wrong $^X.
+BEGIN: {
+ eval {
+ require File::Spec;
+ require Config;
+ Config->import;
+ };
+ warn "test.pl had problems loading other modules: $@" if $@;
+}
+
+# We do this at compile time before the test might have chdir'd around
+# and make sure its absolute in case they do later.
+my $Perl = $^X;
+$Perl = File::Spec->rel2abs(File::Spec->catfile(File::Spec->curdir(), $Perl))
+ if $^X eq "perl$Config{_exe}";
+warn "Can't generate which_perl from $^X" unless -f $Perl;
+
+# For subcommands to use.
+$ENV{PERLEXE} = $Perl;
+
+sub which_perl {
+ return $Perl;
+}
+
1;
diff --git a/utf8.c b/utf8.c
index 8711137feb..3a5c1ec854 100644
--- a/utf8.c
+++ b/utf8.c
@@ -50,7 +50,7 @@ Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv)
*d++ = UTF_TO_NATIVE(uv);
return d;
}
-#if defined(EBCDIC) || 1 /* always for testing */
+#if defined(EBCDIC)
else {
STRLEN len = UNISKIP(uv);
U8 *p = d+len-1;
@@ -1228,8 +1228,6 @@ Perl_to_utf8_case(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp, SV **swashp,char *normal
HE *he;
uv = utf8_to_uvchr(p, 0);
- if (uv <= 0xff)
- uv = NATIVE_TO_UTF(uv);
if ((hv = get_hv(special, FALSE)) &&
(keysv = sv_2mortal(Perl_newSVpvf(aTHX_ "%04"UVXf, uv))) &&
@@ -1240,7 +1238,6 @@ Perl_to_utf8_case(pTHX_ U8 *p, U8* ustrp, STRLEN *lenp, SV **swashp,char *normal
if (*lenp > 1 || UNI_IS_INVARIANT(c))
Copy(s, ustrp, *lenp, U8);
else {
- c = UTF_TO_NATIVE(c);
/* something in the 0x80..0xFF range */
ustrp[0] = UTF8_EIGHT_BIT_HI(c);
ustrp[1] = UTF8_EIGHT_BIT_LO(c);
@@ -1590,7 +1587,7 @@ Perl_ibcmp_utf8(pTHX_ const char *s1, bool u1, const char *s2, bool u2, register
ulen2 = 1;
if (ulen1 != ulen2
|| (ulen1 == 1 && PL_fold[ca] != PL_fold[cb])
- || memNE(tmpbuf1, tmpbuf2, ulen1))
+ || memNE((char *)tmpbuf1, (char *)tmpbuf2, ulen1))
return 1;
}
a += la;
diff --git a/util.c b/util.c
index de84200a3e..cf1dee0a0a 100644
--- a/util.c
+++ b/util.c
@@ -2591,7 +2591,7 @@ Perl_find_script(pTHX_ char *scriptname, bool dosearch, char **search_ext, I32 f
char *xfailed = Nullch;
char tmpbuf[MAXPATHLEN];
register char *s;
- I32 len;
+ I32 len = 0;
int retval;
#if defined(DOSISH) && !defined(OS2) && !defined(atarist)
# define SEARCH_EXTS ".bat", ".cmd", NULL
diff --git a/vms/descrip_mms.template b/vms/descrip_mms.template
index 96cf27b9fd..3441fa0cfd 100644
--- a/vms/descrip_mms.template
+++ b/vms/descrip_mms.template
@@ -327,8 +327,9 @@ CRTLOPTS =,$(CRTL)/Options
# Modules which must be installed before we can build extensions
LIBPREREQ = $(ARCHDIR)Config.pm [.lib.VMS]Filespec.pm [.lib]DynaLoader.pm [.lib]XSLoader.pm [.lib]lib.pm [.lib.ExtUtils]XSSymSet.pm $(ARCHDIR)vmspipe.com [.lib]re.pm
-utils1 = [.lib.pod]perldoc.com [.lib.ExtUtils]Miniperl.pm [.utils]c2ph.com [.utils]h2ph.com [.utils]h2xs.com [.lib]perlbug.com [.lib]perlcc.com [.utils]dprofpp.com
-utils2 = [.utils]perlivp.com [.lib]splain.com [.utils]pl2pm.com
+utils1 = [.lib.pod]perldoc.com [.lib.ExtUtils]Miniperl.pm [.utils]c2ph.com [.utils]h2ph.com
+utils2 = [.utils]h2xs.com [.utils]libnetcfg.com [.lib]perlbug.com [.lib]perlcc.com [.utils]dprofpp.com
+utils3 = [.utils]perlivp.com [.lib]splain.com [.utils]pl2pm.com [.lib.ExtUtils]xsubpp.com
.ifdef NOX2P
all : base extras archcorefiles preplibrary perlpods
@@ -345,7 +346,7 @@ extras : dynext libmods utils podxform extra.pods
@ $(NOOP)
libmods : $(LIBPREREQ)
@ $(NOOP)
-utils : $(utils1) $(utils2)
+utils : $(utils1) $(utils2) $(utils3)
@ $(NOOP)
podxform : [.lib.pod]pod2text.com [.lib.pod]pod2html.com [.lib.pod]pod2latex.com [.lib.pod]pod2man.com [.lib.pod]podchecker.com [.lib.pod]pod2usage.com [.lib.pod]podselect.com
@ $(NOOP)
@@ -523,6 +524,9 @@ dynext : $(LIBPREREQ) $(DBG)perlshr$(E) preplibrary
[.utils]h2xs.com : [.utils]h2xs.PL $(ARCHDIR)Config.pm
$(MINIPERL) $(MMS$SOURCE)
+[.utils]libnetcfg.com : [.utils]libnetcfg.PL $(ARCHDIR)Config.pm
+ $(MINIPERL) $(MMS$SOURCE)
+
[.lib]perlbug.com : [.utils]perlbug.PL $(ARCHDIR)Config.pm
$(MINIPERL) $(MMS$SOURCE)
Copy/Log [.utils]perlbug.com $(MMS$TARGET)
@@ -544,6 +548,9 @@ dynext : $(LIBPREREQ) $(DBG)perlshr$(E) preplibrary
[.x2p]s2p.com : [.x2p]s2p.PL $(ARCHDIR)Config.pm
$(MINIPERL) $(MMS$SOURCE)
+[.lib.ExtUtils]xsubpp.com : [.lib.ExtUtils]xsubpp
+ Copy/Log $(MMS$SOURCE) $(MMS$TARGET)
+
# Rename catches problem with some DECC versions in which object file is
# placed in current default dir, not same one as source file.
[.x2p]$(DBG)a2p$(E) : [.x2p]a2p$(O), [.x2p]hash$(O), [.x2p]str$(O), [.x2p]util$(O), [.x2p]walk$(O)
diff --git a/vms/ext/filespec.t b/vms/ext/filespec.t
index bab728840e..7a68f59845 100644
--- a/vms/ext/filespec.t
+++ b/vms/ext/filespec.t
@@ -3,6 +3,7 @@
BEGIN { unshift(@INC,'../lib') if -d '../lib'; }
use VMS::Filespec;
+use File::Spec;
foreach (<DATA>) {
chomp;
@@ -44,31 +45,33 @@ ok(rmdir('testdir/'), ' rmdir()');
__DATA__
+# lots of underscores used to minimize collision with existing logical names
+
# Basic VMS to Unix filespecs
-some_logical_name_not_likely:[where.over]the.rainbow unixify /some_logical_name_not_likely/where/over/the.rainbow
-[.some_logical_name_not_likely.where.over]the.rainbow unixify some_logical_name_not_likely/where/over/the.rainbow
-[-.some_logical_name_not_likely.where.over]the.rainbow unixify ../some_logical_name_not_likely/where/over/the.rainbow
-[.some_logical_name_not_likely.--.where.over]the.rainbow unixify some_logical_name_not_likely/../../where/over/the.rainbow
-[.some_logical_name_not_likely...where.over]the.rainbow unixify some_logical_name_not_likely/.../where/over/the.rainbow
-[...some_logical_name_not_likely.where.over]the.rainbow unixify .../some_logical_name_not_likely/where/over/the.rainbow
-[.some_logical_name_not_likely.where.over...]the.rainbow unixify some_logical_name_not_likely/where/over/.../the.rainbow
-[.some_logical_name_not_likely.where.over...] unixify some_logical_name_not_likely/where/over/.../
-[.some_logical_name_not_likely.where.over.-] unixify some_logical_name_not_likely/where/over/../
+__some_:[__where_.__over_]__the_.__rainbow_ unixify /__some_/__where_/__over_/__the_.__rainbow_
+[.__some_.__where_.__over_]__the_.__rainbow_ unixify __some_/__where_/__over_/__the_.__rainbow_
+[-.__some_.__where_.__over_]__the_.__rainbow_ unixify ../__some_/__where_/__over_/__the_.__rainbow_
+[.__some_.--.__where_.__over_]__the_.__rainbow_ unixify __some_/../../__where_/__over_/__the_.__rainbow_
+[.__some_...__where_.__over_]__the_.__rainbow_ unixify __some_/.../__where_/__over_/__the_.__rainbow_
+[...__some_.__where_.__over_]__the_.__rainbow_ unixify .../__some_/__where_/__over_/__the_.__rainbow_
+[.__some_.__where_.__over_...]__the_.__rainbow_ unixify __some_/__where_/__over_/.../__the_.__rainbow_
+[.__some_.__where_.__over_...] unixify __some_/__where_/__over_/.../
+[.__some_.__where_.__over_.-] unixify __some_/__where_/__over_/../
[] unixify ./
[-] unixify ../
[--] unixify ../../
[...] unixify .../
# and back again
-/some_logical_name_not_likely/where/over/the.rainbow vmsify some_logical_name_not_likely:[where.over]the.rainbow
-some_logical_name_not_likely/where/over/the.rainbow vmsify [.some_logical_name_not_likely.where.over]the.rainbow
-../some_logical_name_not_likely/where/over/the.rainbow vmsify [-.some_logical_name_not_likely.where.over]the.rainbow
-some_logical_name_not_likely/../../where/over/the.rainbow vmsify [-.where.over]the.rainbow
-.../some_logical_name_not_likely/where/over/the.rainbow vmsify [...some_logical_name_not_likely.where.over]the.rainbow
-some_logical_name_not_likely/.../where/over/the.rainbow vmsify [.some_logical_name_not_likely...where.over]the.rainbow
-/some_logical_name_not_likely/.../where/over/the.rainbow vmsify some_logical_name_not_likely:[...where.over]the.rainbow
-some_logical_name_not_likely/where/... vmsify [.some_logical_name_not_likely.where...]
-/where/... vmsify where:[...]
+/__some_/__where_/__over_/__the_.__rainbow_ vmsify __some_:[__where_.__over_]__the_.__rainbow_
+__some_/__where_/__over_/__the_.__rainbow_ vmsify [.__some_.__where_.__over_]__the_.__rainbow_
+../__some_/__where_/__over_/__the_.__rainbow_ vmsify [-.__some_.__where_.__over_]__the_.__rainbow_
+__some_/../../__where_/__over_/__the_.__rainbow_ vmsify [-.__where_.__over_]__the_.__rainbow_
+.../__some_/__where_/__over_/__the_.__rainbow_ vmsify [...__some_.__where_.__over_]__the_.__rainbow_
+__some_/.../__where_/__over_/__the_.__rainbow_ vmsify [.__some_...__where_.__over_]__the_.__rainbow_
+/__some_/.../__where_/__over_/__the_.__rainbow_ vmsify __some_:[...__where_.__over_]__the_.__rainbow_
+__some_/__where_/... vmsify [.__some_.__where_...]
+/__where_/... vmsify __where_:[...]
. vmsify []
.. vmsify [-]
../.. vmsify [--]
@@ -76,48 +79,52 @@ some_logical_name_not_likely/where/... vmsify [.some_logical_name_not_likely.whe
/ vmsify sys$disk:[000000]
# Fileifying directory specs
-down_logical_name_not_likely:[the.garden.path] fileify down_logical_name_not_likely:[the.garden]path.dir;1
-[.down_logical_name_not_likely.the.garden.path] fileify [.down_logical_name_not_likely.the.garden]path.dir;1
-/down_logical_name_not_likely/the/garden/path fileify /down_logical_name_not_likely/the/garden/path.dir;1
-/down_logical_name_not_likely/the/garden/path/ fileify /down_logical_name_not_likely/the/garden/path.dir;1
-down_logical_name_not_likely/the/garden/path fileify down_logical_name_not_likely/the/garden/path.dir;1
-down_logical_name_not_likely:[the.garden]path fileify down_logical_name_not_likely:[the.garden]path.dir;1
-down_logical_name_not_likely:[the.garden]path. fileify # N.B. trailing . ==> null type
-down_logical_name_not_likely:[the]garden.path fileify
-/down_logical_name_not_likely/the/garden/path. fileify # N.B. trailing . ==> null type
-/down_logical_name_not_likely/the/garden.path fileify
+__down_:[__the_.__garden_.__path_] fileify __down_:[__the_.__garden_]__path_.dir;1
+[.__down_.__the_.__garden_.__path_] fileify [.__down_.__the_.__garden_]__path_.dir;1
+/__down_/__the_/__garden_/__path_ fileify /__down_/__the_/__garden_/__path_.dir;1
+/__down_/__the_/__garden_/__path_/ fileify /__down_/__the_/__garden_/__path_.dir;1
+__down_/__the_/__garden_/__path_ fileify __down_/__the_/__garden_/__path_.dir;1
+__down_:[__the_.__garden_]__path_ fileify __down_:[__the_.__garden_]__path_.dir;1
+__down_:[__the_.__garden_]__path_. fileify # N.B. trailing . ==> null type
+__down_:[__the_]__garden_.__path_ fileify
+/__down_/__the_/__garden_/__path_. fileify # N.B. trailing . ==> null type
+/__down_/__the_/__garden_.__path_ fileify
# and pathifying them
-down_logical_name_not_likely:[the.garden]path.dir;1 pathify down_logical_name_not_likely:[the.garden.path]
-[.down_logical_name_not_likely.the.garden]path.dir pathify [.down_logical_name_not_likely.the.garden.path]
-/down_logical_name_not_likely/the/garden/path.dir pathify /down_logical_name_not_likely/the/garden/path/
-down_logical_name_not_likely/the/garden/path.dir pathify down_logical_name_not_likely/the/garden/path/
-down_logical_name_not_likely:[the.garden]path pathify down_logical_name_not_likely:[the.garden.path]
-down_logical_name_not_likely:[the.garden]path. pathify # N.B. trailing . ==> null type
-down_logical_name_not_likely:[the]garden.path pathify
-/down_logical_name_not_likely/the/garden/path. pathify # N.B. trailing . ==> null type
-/down_logical_name_not_likely/the/garden.path pathify
-down_logical_name_not_likely:[the.garden]path.dir;2 pathify #N.B. ;2
-__path pathify __path/
-/down_logical_name_not_likely/the/garden/. pathify /down_logical_name_not_likely/the/garden/./
-/down_logical_name_not_likely/the/garden/.. pathify /down_logical_name_not_likely/the/garden/../
-/down_logical_name_not_likely/the/garden/... pathify /down_logical_name_not_likely/the/garden/.../
-path.notdir pathify
+__down_:[__the_.__garden_]__path_.dir;1 pathify __down_:[__the_.__garden_.__path_]
+[.__down_.__the_.__garden_]__path_.dir pathify [.__down_.__the_.__garden_.__path_]
+/__down_/__the_/__garden_/__path_.dir pathify /__down_/__the_/__garden_/__path_/
+__down_/__the_/__garden_/__path_.dir pathify __down_/__the_/__garden_/__path_/
+__down_:[__the_.__garden_]__path_ pathify __down_:[__the_.__garden_.__path_]
+__down_:[__the_.__garden_]__path_. pathify # N.B. trailing . ==> null type
+__down_:[__the_]__garden_.__path_ pathify
+/__down_/__the_/__garden_/__path_. pathify # N.B. trailing . ==> null type
+/__down_/__the_/__garden_.__path_ pathify
+__down_:[__the_.__garden_]__path_.dir;2 pathify #N.B. ;2
+__path_ pathify __path_/
+/__down_/__the_/__garden_/. pathify /__down_/__the_/__garden_/./
+/__down_/__the_/__garden_/.. pathify /__down_/__the_/__garden_/../
+/__down_/__the_/__garden_/... pathify /__down_/__the_/__garden_/.../
+__path_.notdir pathify
# Both VMS/Unix and file/path conversions
-down_logical_name_not_likely:[the.garden]path.dir;1 unixpath /down_logical_name_not_likely/the/garden/path/
-/down_logical_name_not_likely/the/garden/path vmspath down_logical_name_not_likely:[the.garden.path]
-down_logical_name_not_likely:[the.garden.path] unixpath /down_logical_name_not_likely/the/garden/path/
-down_logical_name_not_likely:[the.garden.path...] unixpath /down_logical_name_not_likely/the/garden/path/.../
-/down_logical_name_not_likely/the/garden/path.dir vmspath down_logical_name_not_likely:[the.garden.path]
-[.down_logical_name_not_likely.the.garden]path.dir unixpath down_logical_name_not_likely/the/garden/path/
-down_logical_name_not_likely/the/garden/path vmspath [.down_logical_name_not_likely.the.garden.path]
-__path vmspath [.__path]
+__down_:[__the_.__garden_]__path_.dir;1 unixpath /__down_/__the_/__garden_/__path_/
+/__down_/__the_/__garden_/__path_ vmspath __down_:[__the_.__garden_.__path_]
+__down_:[__the_.__garden_.__path_] unixpath /__down_/__the_/__garden_/__path_/
+__down_:[__the_.__garden_.__path_...] unixpath /__down_/__the_/__garden_/__path_/.../
+/__down_/__the_/__garden_/__path_.dir vmspath __down_:[__the_.__garden_.__path_]
+[.__down_.__the_.__garden_]__path_.dir unixpath __down_/__the_/__garden_/__path_/
+__down_/__the_/__garden_/__path_ vmspath [.__down_.__the_.__garden_.__path_]
+__path_ vmspath [.__path_]
/ vmspath sys$disk:[000000]
# Redundant characters in Unix paths
-//some_logical_name_not_likely/where//over/../the.rainbow vmsify some_logical_name_not_likely:[where]the.rainbow
-/some_logical_name_not_likely/where//over/./the.rainbow vmsify some_logical_name_not_likely:[where.over]the.rainbow
+//__some_/__where_//__over_/../__the_.__rainbow_ vmsify __some_:[__where_]__the_.__rainbow_
+/__some_/__where_//__over_/./__the_.__rainbow_ vmsify __some_:[__where_.__over_]__the_.__rainbow_
..//../ vmspath [--]
./././ vmspath []
./../. vmsify [-]
+
+# Our override of File::Spec->canonpath can do some strange things
+__dev:[__dir.000000]__foo File::Spec->canonpath __dev:[__dir]__foo
+__dev:[__dir.][000000]__foo File::Spec->canonpath __dev:[__dir]__foo
diff --git a/vms/test.com b/vms/test.com
index 11f6a30afd..7c2174feae 100644
--- a/vms/test.com
+++ b/vms/test.com
@@ -102,7 +102,7 @@ $ PerlShr_filespec = f$parse("Sys$Disk:[-]''dbg'PerlShr''exe'")
$ Define 'dbg'Perlshr 'PerlShr_filespec'
$ MCR Sys$Disk:[]Perl. "-I[-.lib]" - "''p3'" "''p4'" "''p5'" "''p6'"
$ Deck/Dollar=$$END-OF-TEST$$
-# $RCSfile: test.com,v $$Revision: 1.1 $$Date: 2001/11/13 00:26:19 $
+# $RCSfile: test.com,v $$Revision: 1.1 $$Date: 2001/12/05 06:53:37 $
# Modified for VMS 30-Sep-1994 Charles Bailey bailey@newman.upenn.edu
#
# This is written in a peculiar style, since we're trying to avoid
@@ -114,9 +114,6 @@ $ Deck/Dollar=$$END-OF-TEST$$
use Config;
use File::Spec;
-@exclist=('exec.t','stat.t');
-foreach $file (@exclist) { $skip{$file}++; }
-
$| = 1;
# Let tests know they're running in the perl core. Useful for modules
@@ -137,17 +134,10 @@ if ($ARGV[0] eq '') {
$_ = File::Spec->abs2rel($_);
s/\[([a-z]+)/[.$1/; # hmm, abs2rel doesn't do subdirs of the cwd
($fname = $_) =~ s/.*\]//;
- if ($skip{"\L$fname"}) { push(@skipped,$_); }
- else { push(@ARGV,$_); }
+ push(@ARGV,$_);
}
}
-if (@skipped) {
- print "The following tests were skipped because they rely extensively on\n";
- print " Unixisms not compatible with the current version of perl for VMS:\n";
- print "\t",join("\n\t",@skipped),"\n\n";
-}
-
$bad = 0;
$good = 0;
$extra_skip = 0;
diff --git a/vms/vms.c b/vms/vms.c
index fc2ae303f1..445b183bcc 100644
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -1172,6 +1172,7 @@ Perl_sig_to_vmscondition(int sig)
int
Perl_my_kill(int pid, int sig)
{
+ dTHX;
int iss;
unsigned int code;
int sys$sigprc(unsigned int *pidadr,
@@ -1522,8 +1523,8 @@ popen_completion_ast(pInfo info)
}
-static unsigned long int setup_cmddsc(pTHX_ char *cmd, int check_img, int *suggest_quote);
-static void vms_execfree(pTHX);
+static unsigned long int setup_cmddsc(pTHX_ char *cmd, int check_img, int *suggest_quote, struct dsc$descriptor_s **pvmscmd);
+static void vms_execfree(struct dsc$descriptor_s *vmscmd);
/*
we actually differ from vmstrnenv since we use this to
@@ -1995,7 +1996,7 @@ store_pipelocs(pTHX)
STRLEN n_a;
if (head_PLOC)
- free_pipelocs(&head_PLOC);
+ free_pipelocs(aTHX_ &head_PLOC);
/* the . directory from @INC comes last */
@@ -2006,7 +2007,11 @@ store_pipelocs(pTHX)
/* get the directory from $^X */
+#ifdef PERL_IMPLICIT_CONTEXT
+ if (aTHX && PL_origargv && PL_origargv[0]) { /* maybe nul if embedded Perl */
+#else
if (PL_origargv && PL_origargv[0]) { /* maybe nul if embedded Perl */
+#endif
strcpy(temp, PL_origargv[0]);
x = strrchr(temp,']');
if (x) x[1] = '\0';
@@ -2022,6 +2027,9 @@ store_pipelocs(pTHX)
/* reverse order of @INC entries, skip "." since entered above */
+#ifdef PERL_IMPLICIT_CONTEXT
+ if (aTHX)
+#endif
if (PL_incgv) av = GvAVn(PL_incgv);
for (i = 0; av && i <= AvFILL(av); i++) {
@@ -2051,7 +2059,6 @@ store_pipelocs(pTHX)
p->dir[NAM$C_MAXRSS] = '\0';
}
#endif
- Perl_call_atexit(aTHX_ &free_pipelocs, &head_PLOC);
}
@@ -2203,6 +2210,7 @@ safe_popen(pTHX_ char *cmd, char *in_mode, int *psts)
DSC$K_CLASS_S, 0};
struct dsc$descriptor_s d_sym_cmd = {0, DSC$K_DTYPE_T,
DSC$K_CLASS_S, cmd_sym_name};
+ struct dsc$descriptor_s *vmscmd;
$DESCRIPTOR(d_sym_in ,"PERL_POPEN_IN");
$DESCRIPTOR(d_sym_out,"PERL_POPEN_OUT");
$DESCRIPTOR(d_sym_err,"PERL_POPEN_ERR");
@@ -2254,7 +2262,7 @@ safe_popen(pTHX_ char *cmd, char *in_mode, int *psts)
vmspipedsc.dsc$a_pointer = tfilebuf;
vmspipedsc.dsc$w_length = strlen(tfilebuf);
- sts = setup_cmddsc(aTHX_ cmd,0,0);
+ sts = setup_cmddsc(aTHX_ cmd,0,0,&vmscmd);
if (!(sts & 1)) {
switch (sts) {
case RMS$_FNF: case RMS$_DNF:
@@ -2432,10 +2440,10 @@ safe_popen(pTHX_ char *cmd, char *in_mode, int *psts)
d_symbol.dsc$w_length = strlen(symbol);
_ckvmssts(lib$set_symbol(&d_sym_out, &d_symbol, &table));
- p = VMSCMD.dsc$a_pointer;
+ p = vmscmd->dsc$a_pointer;
while (*p && *p != '\n') p++;
*p = '\0'; /* truncate on \n */
- p = VMSCMD.dsc$a_pointer;
+ p = vmscmd->dsc$a_pointer;
while (*p == ' ' || *p == '\t') p++; /* remove leading whitespace */
if (*p == '$') p++; /* remove leading $ */
while (*p == ' ' || *p == '\t') p++;
@@ -2477,9 +2485,13 @@ safe_popen(pTHX_ char *cmd, char *in_mode, int *psts)
_ckvmssts(lib$delete_symbol(&d_sym_in, &table));
_ckvmssts(lib$delete_symbol(&d_sym_err, &table));
_ckvmssts(lib$delete_symbol(&d_sym_out, &table));
- vms_execfree(aTHX);
+ vms_execfree(vmscmd);
+#ifdef PERL_IMPLICIT_CONTEXT
+ if (aTHX)
+#endif
PL_forkprocess = info->pid;
+
if (wait) {
int done = 0;
while (!done) {
@@ -4285,10 +4297,12 @@ static void
pipe_and_fork(pTHX_ char **cmargv)
{
PerlIO *fp;
+ struct dsc$descriptor_s *vmscmd;
char subcmd[2*MAX_DCL_LINE_LENGTH], *p, *q;
int sts, j, l, ismcr, quote, tquote = 0;
- sts = setup_cmddsc(cmargv[0],0,&quote);
+ sts = setup_cmddsc(aTHX_ cmargv[0],0,&quote,&vmscmd);
+ vms_execfree(vmscmd);
j = l = 0;
p = subcmd;
@@ -4324,7 +4338,7 @@ pipe_and_fork(pTHX_ char **cmargv)
}
*p = '\0';
- fp = safe_popen(subcmd,"wbF",&sts);
+ fp = safe_popen(aTHX_ subcmd,"wbF",&sts);
if (fp == Nullfp) {
PerlIO_printf(Perl_debug_log,"Can't open output pipe (status %d)",sts);
}
@@ -4933,15 +4947,13 @@ my_vfork()
static void
-vms_execfree(pTHX) {
- if (PL_Cmd) {
- if (PL_Cmd != VMSCMD.dsc$a_pointer) Safefree(PL_Cmd);
- PL_Cmd = Nullch;
- }
- if (VMSCMD.dsc$a_pointer) {
- Safefree(VMSCMD.dsc$a_pointer);
- VMSCMD.dsc$w_length = 0;
- VMSCMD.dsc$a_pointer = Nullch;
+vms_execfree(struct dsc$descriptor_s *vmscmd)
+{
+ if (vmscmd) {
+ if (vmscmd->dsc$a_pointer) {
+ Safefree(vmscmd->dsc$a_pointer);
+ }
+ Safefree(vmscmd);
}
}
@@ -4990,17 +5002,26 @@ setup_argstr(pTHX_ SV *really, SV **mark, SV **sp)
static unsigned long int
-setup_cmddsc(pTHX_ char *cmd, int check_img, int *suggest_quote)
+setup_cmddsc(pTHX_ char *cmd, int check_img, int *suggest_quote,
+ struct dsc$descriptor_s **pvmscmd)
{
char vmsspec[NAM$C_MAXRSS+1], resspec[NAM$C_MAXRSS+1];
$DESCRIPTOR(defdsc,".EXE");
$DESCRIPTOR(defdsc2,".");
$DESCRIPTOR(resdsc,resspec);
+ struct dsc$descriptor_s *vmscmd;
struct dsc$descriptor_s imgdsc = {0, DSC$K_DTYPE_T, DSC$K_CLASS_S, 0};
unsigned long int cxt = 0, flags = 1, retsts = SS$_NORMAL;
register char *s, *rest, *cp, *wordbreak;
register int isdcl;
+ New(402,vmscmd,sizeof(struct dsc$descriptor_s),struct dsc$descriptor_s);
+ vmscmd->dsc$a_pointer = NULL;
+ vmscmd->dsc$b_dtype = DSC$K_DTYPE_T;
+ vmscmd->dsc$b_class = DSC$K_CLASS_S;
+ vmscmd->dsc$w_length = 0;
+ if (pvmscmd) *pvmscmd = vmscmd;
+
if (suggest_quote) *suggest_quote = 0;
if (strlen(cmd) > MAX_DCL_LINE_LENGTH)
@@ -5084,29 +5105,30 @@ setup_cmddsc(pTHX_ char *cmd, int check_img, int *suggest_quote)
if (check_img && isdcl) return RMS$_FNF;
if (cando_by_name(S_IXUSR,0,resspec)) {
- New(402,VMSCMD.dsc$a_pointer,7 + s - resspec + (rest ? strlen(rest) : 0),char);
+ New(402,vmscmd->dsc$a_pointer,7 + s - resspec + (rest ? strlen(rest) : 0),char);
if (!isdcl) {
- strcpy(VMSCMD.dsc$a_pointer,"$ MCR ");
+ strcpy(vmscmd->dsc$a_pointer,"$ MCR ");
if (suggest_quote) *suggest_quote = 1;
} else {
- strcpy(VMSCMD.dsc$a_pointer,"@");
+ strcpy(vmscmd->dsc$a_pointer,"@");
if (suggest_quote) *suggest_quote = 1;
}
- strcat(VMSCMD.dsc$a_pointer,resspec);
- if (rest) strcat(VMSCMD.dsc$a_pointer,rest);
- VMSCMD.dsc$w_length = strlen(VMSCMD.dsc$a_pointer);
- return (VMSCMD.dsc$w_length > MAX_DCL_LINE_LENGTH ? CLI$_BUFOVF : retsts);
+ strcat(vmscmd->dsc$a_pointer,resspec);
+ if (rest) strcat(vmscmd->dsc$a_pointer,rest);
+ vmscmd->dsc$w_length = strlen(vmscmd->dsc$a_pointer);
+ return (vmscmd->dsc$w_length > MAX_DCL_LINE_LENGTH ? CLI$_BUFOVF : retsts);
}
else retsts = RMS$_PRV;
}
}
/* It's either a DCL command or we couldn't find a suitable image */
- VMSCMD.dsc$w_length = strlen(cmd);
- if (cmd == PL_Cmd) {
- VMSCMD.dsc$a_pointer = PL_Cmd;
+ vmscmd->dsc$w_length = strlen(cmd);
+/* if (cmd == PL_Cmd) {
+ vmscmd->dsc$a_pointer = PL_Cmd;
if (suggest_quote) *suggest_quote = 1;
}
- else VMSCMD.dsc$a_pointer = savepvn(cmd,VMSCMD.dsc$w_length);
+ else */
+ vmscmd->dsc$a_pointer = savepvn(cmd,vmscmd->dsc$w_length);
/* check if it's a symbol (for quoting purposes) */
if (suggest_quote && !*suggest_quote) {
@@ -5115,7 +5137,7 @@ setup_cmddsc(pTHX_ char *cmd, int check_img, int *suggest_quote)
struct dsc$descriptor_s eqvdsc = {sizeof(equiv), DSC$K_DTYPE_T, DSC$K_CLASS_S, 0};
eqvdsc.dsc$a_pointer = equiv;
- iss = lib$get_symbol(&VMSCMD,&eqvdsc);
+ iss = lib$get_symbol(vmscmd,&eqvdsc);
if (iss&1 && (*equiv == '$' || *equiv == '@')) *suggest_quote = 1;
}
if (!(retsts & 1)) {
@@ -5126,7 +5148,7 @@ setup_cmddsc(pTHX_ char *cmd, int check_img, int *suggest_quote)
else { _ckvmssts(retsts); }
}
- return (VMSCMD.dsc$w_length > MAX_DCL_LINE_LENGTH ? CLI$_BUFOVF : retsts);
+ return (vmscmd->dsc$w_length > MAX_DCL_LINE_LENGTH ? CLI$_BUFOVF : retsts);
} /* end of setup_cmddsc() */
@@ -5157,6 +5179,7 @@ Perl_vms_do_aexec(pTHX_ SV *really,SV **mark,SV **sp)
bool
Perl_vms_do_exec(pTHX_ char *cmd)
{
+ struct dsc$descriptor_s *vmscmd;
if (vfork_called) { /* this follows a vfork - act Unixish */
vfork_called--;
@@ -5172,8 +5195,8 @@ Perl_vms_do_exec(pTHX_ char *cmd)
TAINT_ENV();
TAINT_PROPER("exec");
- if ((retsts = setup_cmddsc(aTHX_ cmd,1,0)) & 1)
- retsts = lib$do_command(&VMSCMD);
+ if ((retsts = setup_cmddsc(aTHX_ cmd,1,0,&vmscmd)) & 1)
+ retsts = lib$do_command(vmscmd);
switch (retsts) {
case RMS$_FNF: case RMS$_DNF:
@@ -5196,9 +5219,9 @@ Perl_vms_do_exec(pTHX_ char *cmd)
set_vaxc_errno(retsts);
if (ckWARN(WARN_EXEC)) {
Perl_warner(aTHX_ WARN_EXEC,"Can't exec \"%*s\": %s",
- VMSCMD.dsc$w_length, VMSCMD.dsc$a_pointer, Strerror(errno));
+ vmscmd->dsc$w_length, vmscmd->dsc$a_pointer, Strerror(errno));
}
- vms_execfree(aTHX);
+ vms_execfree(vmscmd);
}
return FALSE;
@@ -5256,7 +5279,7 @@ Perl_do_spawn(pTHX_ char *cmd)
sts = substs;
}
else {
- (void) safe_popen(cmd, "nW", (int *)&sts);
+ (void) safe_popen(aTHX_ cmd, "nW", (int *)&sts);
}
return sts;
} /* end of do_spawn() */
@@ -7228,18 +7251,13 @@ Perl_sys_intern_clear(pTHX)
void
Perl_sys_intern_init(pTHX)
{
- int ix = RAND_MAX;
- float x;
+ unsigned int ix = RAND_MAX;
+ double x;
VMSISH_HUSHED = 0;
x = (float)ix;
MY_INV_RAND_MAX = 1./x;
-
- VMSCMD.dsc$a_pointer = NULL;
- VMSCMD.dsc$w_length = 0;
- VMSCMD.dsc$b_dtype = DSC$K_DTYPE_T;
- VMSCMD.dsc$b_class = DSC$K_CLASS_S;
}
void
diff --git a/vms/vmsish.h b/vms/vmsish.h
index 573f254cb8..ddc8b96749 100644
--- a/vms/vmsish.h
+++ b/vms/vmsish.h
@@ -298,12 +298,10 @@
#define HAVE_INTERP_INTERN
struct interp_intern {
int hushed;
- float inv_rand_max;
- struct dsc$descriptor_s VMScmd;
+ double inv_rand_max;
};
#define VMSISH_HUSHED (PL_sys_intern.hushed)
#define MY_INV_RAND_MAX (PL_sys_intern.inv_rand_max)
-#define VMSCMD (PL_sys_intern.VMScmd)
/* Flags for vmstrnenv() */
#define PERL__TRNENV_SECURE 0x01
diff --git a/win32/perlhost.h b/win32/perlhost.h
index cd433fde89..9493a73187 100644
--- a/win32/perlhost.h
+++ b/win32/perlhost.h
@@ -210,6 +210,7 @@ protected:
DWORD m_dwEnvCount;
LPSTR* m_lppEnvList;
+ BOOL m_bTopLevel; // is this a toplevel host?
static long num_hosts;
public:
inline int LastHost(void) { return num_hosts == 1L; };
@@ -1932,6 +1933,7 @@ CPerlHost::CPerlHost(void)
m_dwEnvCount = 0;
m_lppEnvList = NULL;
+ m_bTopLevel = TRUE;
CopyMemory(&m_hostperlMem, &perlMem, sizeof(perlMem));
CopyMemory(&m_hostperlMemShared, &perlMemShared, sizeof(perlMemShared));
@@ -1981,6 +1983,7 @@ CPerlHost::CPerlHost(struct IPerlMem** ppMem, struct IPerlMem** ppMemShared,
m_dwEnvCount = 0;
m_lppEnvList = NULL;
+ m_bTopLevel = FALSE;
CopyMemory(&m_hostperlMem, &perlMem, sizeof(perlMem));
CopyMemory(&m_hostperlMemShared, &perlMemShared, sizeof(perlMemShared));
@@ -2037,6 +2040,7 @@ CPerlHost::CPerlHost(CPerlHost& host)
m_dwEnvCount = 0;
m_lppEnvList = NULL;
+ m_bTopLevel = FALSE;
/* duplicate environment info */
LPSTR lpPtr;
@@ -2351,7 +2355,7 @@ CPerlHost::Clearenv(void)
ch = *++lpPtr;
*lpPtr = 0;
Add(lpStr);
- if (!w32_pseudo_id)
+ if (m_bTopLevel)
(void)win32_putenv(lpStr);
*lpPtr = ch;
}
@@ -2366,7 +2370,7 @@ char*
CPerlHost::Getenv(const char *varname)
{
dTHX;
- if (w32_pseudo_id) {
+ if (!m_bTopLevel) {
char *pEnv = Find(varname);
if (pEnv && *pEnv)
return pEnv;
@@ -2379,7 +2383,7 @@ CPerlHost::Putenv(const char *envstring)
{
dTHX;
Add(envstring);
- if (!w32_pseudo_id)
+ if (m_bTopLevel)
return win32_putenv(envstring);
return 0;