This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[inseparable changes from match from perl-5.003_93 to perl-5.003_94]
authorPerl 5 Porters <perl5-porters@africa.nicoh.com>
Sat, 8 Mar 1997 23:57:19 +0000 (11:57 +1200)
committerChip Salzenberg <chip@atlantic.net>
Sat, 8 Mar 1997 23:57:19 +0000 (11:57 +1200)
 BUILD PROCESS

Subject: Don't use db 2.x, we're not yet ready for it
From: Paul Marquess <pmarquess@bfsec.bt.co.uk>
Files: Configure

Subject: Warn if #! command is longer than 32 chars
From: Chip Salzenberg <chip@perl.com>
Files: Configure

Subject: patches re perl -wc install{perl,man}
Date: Tue, 11 Mar 97 13:13:16 GMT
From: Robin Barker <rmb1@cise.npl.co.uk>
Files: installman installperl

    I got the new installhtml from CPAN
    (TOMC/scripts/pod2html-v2.0beta.shar.gz)

    I had problems getting the system call to splitpod at line 376 to work.

    1. splitroot was not being found
    2. splitroot was not finding its library
    3. I changed htmlroot to podroot at line 175 to match the documentation.

    p5p-msgid: 3180.9703270906@tempest.cise.npl.co.uk
    private-msgid: 21544.9703111313@tempest.cise.npl.co.uk

Subject: 3_93 doesn't install pods
Date: Sun, 16 Mar 1997 02:21:35 -0500
From: Spider Boardman <spider@orb.nashua.nh.us>
Files: installperl
Msg-ID: 199703160721.CAA08339@Orb.Nashua.NH.US

    (applied based on p5p patch as commit 43506a616735d616e03d277d64fbae1e864024bf)

Subject: When installing, use File::Copy instead of `cp`
From: Chip Salzenberg <chip@perl.com>
Files: installperl

Subject: Make hint files' warnings more visible
Date: Thu, 20 Mar 1997 23:18:03 +0100 (MET)
From: Hallvard B Furuseth <h.b.furuseth@usit.uio.no>
Files: hints/3b1.sh hints/apollo.sh hints/cxux.sh hints/dcosx.sh hints/dgux.sh hints/esix4.sh hints/freebsd.sh hints/hpux.sh hints/irix_4.sh hints/mips.sh hints/next_3_0.sh hints/os2.sh hints/qnx.sh hints/sco_2_3_3.sh hints/sco_2_3_4.sh hints/solaris_2.sh hints/ultrix_4.sh hints/utekv.sh

    private-msgid: 199703202218.XAA09041@bombur2.uio.no

 CORE LANGUAGE CHANGES

Subject: Defer creation of array and hash elements as parameters
From: Chip Salzenberg <chip@perl.com>
Files: dump.c global.sym mg.c op.c op.h perl.h pp.c pp_hot.c proto.h sv.c

Subject: New special literal: __PACKAGE__
From: Chip Salzenberg <chip@perl.com>
Files: keywords.pl pod/perldata.pod toke.c

Subject: Abort compilation at C<BEGIN{}> or C<use> after errors
From: Chip Salzenberg <chip@perl.com>
Files: op.c pod/perldiag.pod t/pragma/subs.t

Subject: allow C<substr 'hello', -10>
Date: Mon, 10 Mar 1997 15:55:44 -0800
From: David Dyck <dcd@tc.fluke.com>
Files: pp.c
Msg-ID: 97Mar10.155517pst.35716-2@gateway.fluke.com

    (applied based on p5p patch as commit 77f720bf92f3d0100352416caeedd57936807ff2)

Subject: Regularize C<x % y>, esp. when y is negative
From: Chip Salzenberg <chip@perl.com>
Files: pp.c

Subject: Flush before C<flock(FOO, LOCK_UN)>
From: Chip Salzenberg <chip@perl.com>
Files: pod/perldelta.pod pod/perlfunc.pod pp_sys.c

Subject: Close loopholes in prototype mismatch warning
From: Chip Salzenberg <chip@perl.com>
Files: op.c sv.c toke.c

Subject: Warn on C<while ($x = each %y) {}>
From: Chip Salzenberg <chip@perl.com>
Files: op.c pod/perldiag.pod

Subject: Don't warn on C<print $fh func()>
From: Chip Salzenberg <chip@perl.com>
Files: toke.c

 CORE PORTABILITY

Subject: Don't say 'static var = 1'
Date: Sun, 9 Mar 1997 15:19:57 +0200 (EET)
From: Jarkko Hietaniemi <jhi@iki.fi>
Files: malloc.c

    private-msgid: 199703091319.PAA24714@alpha.hut.fi

Subject: HP/UX hint comments
Date: Fri, 21 Mar 1997 15:43:07 -0500 (EST)
From: Andy Dougherty <doughera@fractal.phys.lafayette.edu>
Files: hints/hpux.sh

    private-msgid: Pine.SOL.3.95q.970321153918.28770B-100000@fractal.lafayette.

Subject: VMS update
Date: Tue, 11 Mar 1997 22:00:55 -0500 (EST)
From: Charles Bailey <bailey@hmivax.humgen.upenn.edu>
Files: lib/ExtUtils/MM_VMS.pm lib/Test/Harness.pm t/op/taint.t utils/perlbug.PL vms/descrip.mms
Msg-ID: 1997Mar11.220056.1873182@hmivax.humgen.upenn.edu

    (applied based on p5p patch as commit 2b5725676da60b49978f38b85bb7f8ee20b4cb55)

Subject: vmsish.t and related patches
Date: Fri, 21 Mar 1997 01:32:47 -0500 (EST)
From: Charles Bailey <bailey@HMIVAX.HUMGEN.UPENN.EDU>
Files: MANIFEST perl.h vms/descrip.mms vms/ext/vmsish.t vms/vms.c

    private-msgid: 01IGQW3IP1KK005VFB@hmivax.humgen.upenn.edu

Subject: Win32 update (four patches)
From: Gurusamy Sarathy <gsar@engin.umich.edu>
Files: MANIFEST README.win32 lib/AutoSplit.pm lib/Cwd.pm lib/ExtUtils/Command.pm lib/ExtUtils/Install.pm lib/ExtUtils/MM_OS2.pm lib/ExtUtils/MM_Unix.pm lib/ExtUtils/MM_Win32.pm lib/ExtUtils/MakeMaker.pm lib/ExtUtils/Mksymlists.pm lib/File/Basename.pm lib/File/Path.pm mg.c t/comp/cpp.t t/comp/script.t t/harness t/io/argv.t t/io/dup.t t/io/fs.t t/io/inplace.t t/lib/filehand.t t/lib/io_dup.t t/lib/io_sel.t t/lib/io_taint.t t/op/closure.t t/op/exec.t t/op/glob.t t/op/goto.t t/op/magic.t t/op/misc.t t/op/rand.t t/op/split.t t/op/stat.t t/op/sysio.t t/op/taint.t t/pragma/strict.t t/pragma/subs.t t/pragma/warning.t util.c win32/*

 DOCUMENTATION

Subject: perlfaq.pod
Date: Mon, 17 Mar 1997 16:01:40 -0700
From: Tom Christiansen <tchrist@jhereg.perl.com>
Files: MANIFEST pod/Makefile pod/buildtoc pod/perl.pod pod/perlfaq*.pod pod/roffitall

    private-msgid: 199703172301.QAA12566@jhereg.perl.com

Subject: *.pod changes based on the FAQ
Date: Mon, 17 Mar 1997 09:50:14 -0700 (MST)
From: Nat Torkington <gnat@frii.com>
Files: pod/perldata.pod pod/perlfunc.pod pod/perlipc.pod pod/perlop.pod pod/perlre.pod pod/perlrun.pod pod/perlsec.pod pod/perlvar.pod
Msg-ID: 199703171650.JAA02655@elara.frii.com

    (applied based on p5p patch as commit 3c10ad8e31f7d77e71c048b1746912f41cb540f0)

Subject: Document that $. is not reset on implicit open
From: Chip Salzenberg <chip@perl.com>
Files: pod/perldelta.pod

Subject: Re: Embedding success with _93
Date: Tue, 11 Mar 1997 17:55:05 -0500
From: Doug MacEachern <dougm@opengroup.org>
Files: pod/perldelta.pod
Msg-ID: 199703112255.RAA22775@postman.osf.org

    (applied based on p5p patch as commit 63a6ff3a1dc8d86edb4d8a7ec1548205e32a7114)

Subject: Patch to document illegal characters
Date: Fri, 14 Mar 1997 09:08:10 -0800 (PST)
From: Tom Phoenix <rootbeer@teleport.com>
Files: pod/perldiag.pod pod/perltrap.pod

    private-msgid: Pine.GSO.3.96.970314090558.15346J-100000@kelly.teleport.com

Subject: Document trap with //o and closures
Date: Mon, 10 Mar 1997 18:08:08 -0500 (EST)
From: Charles Bailey <bailey@HMIVAX.HUMGEN.UPENN.EDU>
Files: pod/perltrap.pod
Msg-ID: 01IGCHWRNSEU00661G@hmivax.humgen.upenn.edu

    (applied based on p5p patch as commit a54cb1465fdb400848f23705a6f130bb5c34ab70)

Subject: Illegal character in input
Date: Mon, 10 Mar 1997 15:21:21 -0800 (PST)
From: Tom Phoenix <rootbeer@teleport.com>
Files: pod/perldiag.pod

    private-msgid: Pine.GSO.3.95q.970310151512.22489a-100000@kelly.teleport.com

Subject: Patch for docs Re: Lost backslash
Date: Wed, 19 Mar 1997 07:28:57 -0800 (PST)
From: Tom Phoenix <rootbeer@teleport.com>
Files: pod/perlop.pod

    private-msgid: Pine.GSO.3.96.970319071438.24834G-100000@kelly.teleport.com

Subject: XSUB's doc fix
Date: Mon, 10 Mar 1997 11:42:06 -0500
From: Roderick Schertler <roderick@argon.org>
Files: pod/perlcall.pod pod/perlguts.pod pod/perlxstut.pod
Msg-ID: 28804.858012126@eeyore.ibcinc.com

    (applied based on p5p patch as commit 5f43237038ea7a4151d3bf65aeeecd56ceb78a6a)

Subject: Document return from do FILE
Date: Tue, 18 Mar 1997 14:50:10 +0000
From: "M.J.T. Guy" <mjtg@cus.cam.ac.uk>
Files: pod/perlfunc.pod
Msg-ID: E0w70DK-0001yJ-00@ursa.cus.cam.ac.uk

    (applied based on p5p patch as commit ba8d5fb439878113de8abc9b52d2af237d30fb3c)

Subject: Document $^M in perlvar
Date: Thu, 20 Mar 97 21:08:33 GMT
From: Robin Barker <rmb1@cise.npl.co.uk>
Files: pod/perlvar.pod

    private-msgid: 6153.9703202108@tempest.cise.npl.co.uk

Subject: typos in pods of 5.003_93
Date: 19 Mar 1997 10:39:38 -0600
From: Jim Meyering <meyering@asic.sc.ti.com>
Files: pod/perlfunc.pod pod/perlguts.pod pod/perlre.pod pod/perltoot.pod pod/perlxs.pod
Msg-ID: wpgendbzvhx.fsf@asic.sc.ti.com

    (applied based on p5p patch as commit 76a9873e006cf8f48f57062b2a0dd40b5ed45a95)

Subject: Re: Updates to pod punctuations
Date: Fri, 14 Mar 1997 17:00:12 -0500
From: Larry W. Virden <lvirden@cas.org>
Files: pod/*.pod

    private-msgid: 9703141700.AA22911@cas.org

Subject: clarify example in perlfunc
Date: Thu, 20 Mar 1997 19:46:01 +0200 (EET)
From: Jarkko Hietaniemi <jhi@iki.fi>
Files: pod/perlfunc.pod

    private-msgid: 199703201746.TAA25195@alpha.hut.fi

Subject: Regularize headings in DB_File documentation
From: Chip Salzenberg <chip@perl.com>
Files: ext/DB_File/DB_File.pm

 LIBRARY AND EXTENSIONS

Subject: New module: autouse.pm
Date: Thu, 20 Mar 1997 19:34:30 -0500 (EST)
From: Ilya Zakharevich <ilya@math.ohio-state.edu>
Files: MANIFEST lib/autouse.pm
Msg-ID: 199703210034.TAA13469@monk.mps.ohio-state.edu

    (applied based on p5p patch as commit 6757905eccb6dd0440ef65e8128a277a20f7d943)

Subject: Refresh DB_File to 1.12
Date: Wed, 12 Mar 97 15:51:14 GMT
From: Paul Marquess <pmarquess@bfsec.bt.co.uk>
Files: ext/DB_File/DB_File.pm ext/DB_File/DB_File.xs
Msg-ID: 9703121551.AA07435@claudius.bfsec.bt.co.uk

    (applied based on p5p patch as commit b3deed9189f963e9994815307931f9084f60d1d9)

Subject: In File::Path, some systems can't remove read-only files
From: Chip Salzenberg <chip@perl.com>
Files: lib/File/Path.pm

Subject: Fix bugs revealed by prototype warnings
From: Chip Salzenberg <chip@perl.com>
Files: ext/Opcode/Opcode.pm lib/ExtUtils/MakeMaker.pm lib/Getopt/Long.pm

Subject: Problems with SKIP in makemaker
Date: Thu, 20 Mar 1997 23:13:31 -0500 (EST)
From: Ilya Zakharevich <ilya@math.ohio-state.edu>
Files: lib/ExtUtils/MM_Unix.pm
Msg-ID: 199703210413.XAA21601@monk.mps.ohio-state.edu

    (applied based on p5p patch as commit 970322a2e8024294ada6e8d1a027cb98f1f48ee3)

Subject: In Exporter, don't C<require Carp> at file scope
From: Chip Salzenberg <chip@perl.com>
Files: lib/Exporter.pm

Subject: fix for Exporter's $SIG{__WARN__} handler
Date: Thu, 13 Mar 1997 18:40:51 -0500
From: Roderick Schertler <roderick@argon.org>
Files: lib/Exporter.pm
Msg-ID: 2282.858296451@eeyore.ibcinc.com

    (applied based on p5p patch as commit 2768ea1aeef34f42d096f198fbe629c8374ca429)

Subject: Don't try to substr() refs in Carp
From: Chip Salzenberg <chip@perl.com>
Files: lib/Carp.pm

Subject: Re: NUL in die and other messages
Date: Fri, 21 Mar 1997 09:58:17 +0000
From: "M.J.T. Guy" <mjtg@cus.cam.ac.uk>
Files: lib/Carp.pm
Msg-ID: E0w815V-0005xs-00@ursa.cus.cam.ac.uk

    (applied based on p5p patch as commit 52a267c574cb66c4bc35601dcf148a1d7a3bc557)

 OTHER CORE CHANGES

Subject: Guard against buffer overflow in yyerror() and related funcs
From: Chip Salzenberg <chip@perl.com>
Files: toke.c

Subject: For bin compat, rename calllist() and he_{,delay}free
From: Chip Salzenberg <chip@perl.com>
Files: global.sym hv.c op.c perl.c pod/perlguts.pod proto.h

Subject: Fix C<print> on tied default handle
From: Chip Salzenberg <chip@perl.com>
Files: pp_hot.c

Subject: Fix C<local($a, undef, $b) = (1,2,3)>
From: Chip Salzenberg <chip@perl.com>
Files: op.c

Subject: Improve diagnostic on C<@a++>, C<--%a>, @a =~ s/a/b/
From: Chip Salzenberg <chip@perl.com>
Files: pp.c pp_hot.c

Subject: Don't warn on C<$x{y} .= "z"> when %x is tied
From: Chip Salzenberg <chip@perl.com>
Files: pp_hot.c

Subject: Eliminate 'unreachable code' warnings
From: Chip Salzenberg <chip@perl.com>
Files: ext/POSIX/POSIX.xs mg.c pp_ctl.c toke.c

Subject: printf format corrections for -DDEBUGGING
Date: Wed, 19 Mar 1997 12:42:50 -0500
From: Roderick Schertler <roderick@argon.org>
Files: doop.c malloc.c op.c pp_ctl.c regexec.c sv.c x2p/str.c x2p/util.c
Msg-ID: 26592.858793370@eeyore.ibcinc.com

    (applied based on p5p patch as commit e125f273e351a19a92b69d6244af55abbbf0a26d)

Subject: Warn about missing -DMULTIPLICITY if likely a problem
Date: Wed, 19 Mar 1997 18:45:53 -0500
From: Doug MacEachern <dougm@opengroup.org>
Files: perl.c
Msg-ID: 199703192345.SAA15070@postman.osf.org

    (applied based on p5p patch as commit 71aeea1753924e6e19c2461e241e3f7d8a570e90)

173 files changed:
Changes
Configure
MANIFEST
README.win32 [new file with mode: 0644]
doop.c
dump.c
embed.h
ext/DB_File/DB_File.pm
ext/DB_File/DB_File.xs
ext/Opcode/Opcode.pm
ext/POSIX/POSIX.xs
global.sym
hints/3b1.sh
hints/apollo.sh
hints/cxux.sh
hints/dcosx.sh
hints/dgux.sh
hints/esix4.sh
hints/freebsd.sh
hints/hpux.sh
hints/irix_4.sh
hints/mips.sh
hints/next_3_0.sh
hints/os2.sh
hints/qnx.sh
hints/sco_2_3_3.sh
hints/sco_2_3_4.sh
hints/solaris_2.sh
hints/ultrix_4.sh
hints/utekv.sh
hv.c
installman
installperl
keywords.h
keywords.pl
lib/AutoSplit.pm
lib/Carp.pm
lib/Cwd.pm
lib/Exporter.pm
lib/ExtUtils/Command.pm [new file with mode: 0644]
lib/ExtUtils/Install.pm
lib/ExtUtils/MM_OS2.pm
lib/ExtUtils/MM_Unix.pm
lib/ExtUtils/MM_VMS.pm
lib/ExtUtils/MM_Win32.pm [new file with mode: 0644]
lib/ExtUtils/MakeMaker.pm
lib/ExtUtils/Mksymlists.pm
lib/File/Basename.pm
lib/File/Path.pm
lib/Getopt/Long.pm
lib/Test/Harness.pm
lib/autouse.pm [new file with mode: 0644]
malloc.c
mg.c
op.c
op.h
patchlevel.h
perl.c
perl.h
plan9/buildinfo
pod/Makefile
pod/buildtoc
pod/perl.pod
pod/perlcall.pod
pod/perldata.pod
pod/perldebug.pod
pod/perldelta.pod
pod/perldiag.pod
pod/perldsc.pod
pod/perlfaq.pod [new file with mode: 0644]
pod/perlfaq1.pod [new file with mode: 0644]
pod/perlfaq2.pod [new file with mode: 0644]
pod/perlfaq3.pod [new file with mode: 0644]
pod/perlfaq4.pod [new file with mode: 0644]
pod/perlfaq5.pod [new file with mode: 0644]
pod/perlfaq6.pod [new file with mode: 0644]
pod/perlfaq7.pod [new file with mode: 0644]
pod/perlfaq8.pod [new file with mode: 0644]
pod/perlfaq9.pod [new file with mode: 0644]
pod/perlform.pod
pod/perlfunc.pod
pod/perlguts.pod
pod/perlipc.pod
pod/perllocale.pod
pod/perlobj.pod
pod/perlop.pod
pod/perlre.pod
pod/perlrun.pod
pod/perlsec.pod
pod/perltoc.pod
pod/perltoot.pod
pod/perltrap.pod
pod/perlvar.pod
pod/perlxs.pod
pod/perlxstut.pod
pod/roffitall
pp.c
pp_ctl.c
pp_hot.c
pp_sys.c
proto.h
regexec.c
sv.c
t/comp/cpp.t
t/comp/script.t
t/harness
t/io/argv.t
t/io/dup.t
t/io/fs.t
t/io/inplace.t
t/lib/filehand.t
t/lib/io_dup.t
t/lib/io_sel.t
t/lib/io_taint.t
t/op/closure.t
t/op/exec.t
t/op/glob.t
t/op/goto.t
t/op/magic.t
t/op/misc.t
t/op/rand.t
t/op/split.t
t/op/stat.t
t/op/sysio.t
t/op/taint.t
t/pragma/strict.t
t/pragma/subs.t
t/pragma/warning.t
toke.c
util.c
utils/perlbug.PL
vms/config.vms
vms/descrip.mms
vms/ext/vmsish.t [new file with mode: 0644]
vms/vms.c
win32/Fcntl.mak
win32/IO.mak
win32/Makefile
win32/Opcode.mak
win32/SDBM_File.mak
win32/Socket.mak
win32/TEST
win32/VC-2.0/SDBM_File.mak [new file with mode: 0644]
win32/VC-2.0/Socket.mak [new file with mode: 0644]
win32/VC-2.0/libperl.mak [new file with mode: 0644]
win32/VC-2.0/miniperl.mak [new file with mode: 0644]
win32/VC-2.0/modules.mak [new file with mode: 0644]
win32/VC-2.0/perl.mak [new file with mode: 0644]
win32/VC-2.0/perldll.mak [new file with mode: 0644]
win32/VC-2.0/vc2.patch [new file with mode: 0644]
win32/config.H
win32/config.w32
win32/dl_win32.xs
win32/dosish.h
win32/libperl.mak
win32/makedef.pl
win32/miniperl.mak
win32/modules.mak
win32/perl.mak
win32/perldll.mak
win32/perlglob.c
win32/perlglob.mak
win32/perllib.c
win32/splittree.pl
win32/win32.c
win32/win32.h
win32/win32aux.c [new file with mode: 0644]
win32/win32io.c [new file with mode: 0644]
win32/win32io.h
win32/win32iop.h
win32/win32sck.c
x2p/str.c
x2p/util.c

diff --git a/Changes b/Changes
index 701c871..b7f1ad5 100644 (file)
--- a/Changes
+++ b/Changes
@@ -9,6 +9,396 @@ releases.)
 
 
 ----------------
+Version 5.003_94
+----------------
+
+ CORE LANGUAGE CHANGES
+
+  Title:  "Defer creation of array and hash elements as parameters"
+   From:  Chip Salzenberg
+  Files:  dump.c global.sym mg.c op.c op.h perl.h pp.c pp_hot.c proto.h
+          sv.c
+
+  Title:  "New special literal: __PACKAGE__"
+   From:  Chip Salzenberg
+  Files:  keywords.pl pod/perldata.pod toke.c
+
+  Title:  "Ignore whitespace before +*? in //x"
+   From:  Chip Salzenberg
+  Files:  regcomp.c
+
+  Title:  "Abort compilation at C<BEGIN{}> or C<use> after errors"
+   From:  Chip Salzenberg
+  Files:  op.c pod/perldiag.pod t/pragma/subs.t
+
+  Title:  "allow C<substr 'hello', -10>"
+   From:  David Dyck <dcd@tc.fluke.com>
+ Msg-ID:  <97Mar10.155517pst.35716-2@gateway.fluke.com>
+   Date:  Mon, 10 Mar 1997 15:55:44 -0800
+  Files:  pp.c
+
+  Title:  "Regularize C<x % y>, esp. when y is negative"
+   From:  Chip Salzenberg
+  Files:  pp.c
+
+  Title:  "Flush before C<flock(FOO, LOCK_UN)>"
+   From:  Chip Salzenberg
+  Files:  pod/perldelta.pod pod/perlfunc.pod pp_sys.c
+
+  Title:  "Close loopholes in prototype mismatch warning"
+   From:  Chip Salzenberg
+  Files:  op.c sv.c toke.c
+
+  Title:  "Warn on C<while ($x = each %y) {}>"
+   From:  Chip Salzenberg
+  Files:  op.c pod/perldiag.pod
+
+  Title:  "Don't warn on C<print $fh func()>"
+   From:  Chip Salzenberg
+  Files:  toke.c
+
+ CORE PORTABILITY
+
+  Title:  "Don't say 'static var = 1'"
+   From:  Jarkko Hietaniemi <jhi@iki.fi>
+ Msg-ID:  <199703091319.PAA24714@alpha.hut.fi>
+   Date:  Sun, 9 Mar 1997 15:19:57 +0200 (EET)
+  Files:  malloc.c
+
+  Title:  "BSD/OS 3.0 hints"
+   From:  Christopher Davis <ckd@loiosh.kei.com>
+ Msg-ID:  <w47mjakw5t.fsf@loiosh.kei.com>
+   Date:  14 Mar 1997 16:20:46 -0500
+  Files:  hints/bsdos.sh
+
+  Title:  "More MachTen hints"
+   From:  Tom Phoenix <rootbeer@teleport.com>
+ Msg-ID:  <Pine.GSO.3.95q.970316133852.27997A-100000@kelly.teleport.com
+   Date:  Sun, 16 Mar 1997 13:40:35 -0800 (PST)
+  Files:  hints/machten_2.sh
+
+  Title:  "HP/UX hint comments"
+   From:  Andy Dougherty <doughera@fractal.phys.lafayette.edu>
+ Msg-ID:  <Pine.SOL.3.95q.970321153918.28770B-100000@fractal.lafayette.
+   Date:  Fri, 21 Mar 1997 15:43:07 -0500 (EST)
+  Files:  hints/hpux.sh
+
+  Title:  "VMS update"
+   From:  bailey@hmivax.humgen.upenn.edu (Charles Bailey)
+ Msg-ID:  <1997Mar11.220056.1873182@hmivax.humgen.upenn.edu>
+   Date:  Tue, 11 Mar 1997 22:00:55 -0500 (EST)
+  Files:  lib/ExtUtils/MM_VMS.pm lib/Test/Harness.pm t/op/taint.t
+          utils/perlbug.PL vms/descrip.mms
+
+  Title:  "vmsish.t and related patches"
+   From:  Charles Bailey <bailey@HMIVAX.HUMGEN.UPENN.EDU>
+ Msg-ID:  <01IGQW3IP1KK005VFB@hmivax.humgen.upenn.edu>
+   Date:  Fri, 21 Mar 1997 01:32:47 -0500 (EST)
+  Files:  MANIFEST perl.h vms/descrip.mms vms/ext/vmsish.t vms/vms.c
+  Title:  "Win32 update (four patches)"
+   From:  Gurusamy Sarathy <gsar@engin.umich.edu> and
+         Nick Ing-Simmons <nik@tiuk.ti.com>
+  Files:  MANIFEST README.win32 lib/AutoSplit.pm lib/Cwd.pm
+          lib/ExtUtils/Command.pm lib/ExtUtils/Install.pm
+          lib/ExtUtils/MM_OS2.pm lib/ExtUtils/MM_Unix.pm
+          lib/ExtUtils/MM_Win32.pm lib/ExtUtils/MakeMaker.pm
+          lib/ExtUtils/Mksymlists.pm lib/File/Basename.pm
+          lib/File/Path.pm mg.c t/comp/cpp.t t/comp/script.t t/harness
+          t/io/argv.t t/io/dup.t t/io/fs.t t/io/inplace.t
+          t/lib/filehand.t t/lib/io_dup.t t/lib/io_sel.t
+          t/lib/io_taint.t t/op/closure.t t/op/exec.t t/op/glob.t
+          t/op/goto.t t/op/magic.t t/op/misc.t t/op/rand.t
+          t/op/split.t t/op/stat.t t/op/sysio.t t/op/taint.t
+          t/pragma/strict.t t/pragma/subs.t t/pragma/warning.t util.c
+          win32/*
+
+ OTHER CORE CHANGES
+
+  Title:  "Guard against buffer overflow in yyerror() and related funcs"
+   From:  Chip Salzenberg
+  Files:  toke.c
+
+  Title:  "For bin compat, rename calllist() and he_{,delay}free"
+   From:  Chip Salzenberg
+  Files:  global.sym hv.c op.c perl.c pod/perlguts.pod proto.h
+
+  Title:  "Fix C<print> on tied default handle"
+   From:  Chip Salzenberg
+  Files:  pp_hot.c
+
+  Title:  "Fix C<local($a, undef, $b) = (1,2,3)>"
+   From:  Chip Salzenberg
+  Files:  op.c
+
+  Title:  "Improve diagnostic on C<@a++>, C<--%a>, @a =~ s/a/b/"
+   From:  Chip Salzenberg
+  Files:  pp.c pp_hot.c
+
+  Title:  "Don't warn on C<$x{y} .= "z"> when %x is tied"
+   From:  Chip Salzenberg
+  Files:  pp_hot.c
+
+  Title:  "Eliminate 'unreachable code' warnings"
+   From:  Chip Salzenberg
+  Files:  ext/POSIX/POSIX.xs mg.c pp_ctl.c toke.c
+
+  Title:  "printf format corrections for -DDEBUGGING"
+   From:  Roderick Schertler <roderick@argon.org>
+ Msg-ID:  <26592.858793370@eeyore.ibcinc.com>
+   Date:  Wed, 19 Mar 1997 12:42:50 -0500
+  Files:  doop.c malloc.c op.c pp_ctl.c regexec.c sv.c x2p/str.c
+          x2p/util.c
+
+  Title:  "Warn about missing -DMULTIPLICITY if likely a problem"
+   From:  Doug MacEachern <dougm@opengroup.org>
+ Msg-ID:  <199703192345.SAA15070@postman.osf.org>
+   Date:  Wed, 19 Mar 1997 18:45:53 -0500
+  Files:  perl.c
+
+ BUILD PROCESS
+
+  Title:  "Don't use $(LIBS) when creating shared libperl"
+   From:  Chip Salzenberg
+  Files:  Makefile.SH
+
+  Title:  "Don't use db 2.x, we're not yet ready for it"
+   From:  Paul Marquess and Andy Dougherty
+  Files:  Configure
+
+  Title:  "Warn if #! command is longer than 32 chars"
+   From:  Chip Salzenberg
+  Files:  Configure
+
+  Title:  "patches re perl -wc install{perl,man}"
+   From:  Robin Barker <rmb1@cise.npl.co.uk>
+ Msg-ID:  <21544.9703111313@tempest.cise.npl.co.uk>
+   Date:  Tue, 11 Mar 97 13:13:16 GMT
+  Files:  installman installperl
+
+  Title:  "3_93 doesn't install pods"
+   From:  Spider Boardman <spider@orb.nashua.nh.us>
+ Msg-ID:  <199703160721.CAA08339@Orb.Nashua.NH.US>
+   Date:  Sun, 16 Mar 1997 02:21:35 -0500
+  Files:  installperl
+
+  Title:  "When installing, use File::Copy instead of `cp`"
+   From:  Chip Salzenberg
+  Files:  installperl
+
+  Title:  "Make hint files' warnings more visible"
+   From:  Hallvard B Furuseth <h.b.furuseth@usit.uio.no>
+ Msg-ID:  <199703202218.XAA09041@bombur2.uio.no>
+   Date:  Thu, 20 Mar 1997 23:18:03 +0100 (MET)
+  Files:  hints/3b1.sh hints/apollo.sh hints/cxux.sh hints/dcosx.sh
+          hints/dgux.sh hints/esix4.sh hints/freebsd.sh hints/hpux.sh
+          hints/irix_4.sh hints/mips.sh hints/next_3_0.sh hints/os2.sh
+          hints/qnx.sh hints/sco_2_3_3.sh hints/sco_2_3_4.sh
+          hints/solaris_2.sh hints/ultrix_4.sh hints/utekv.sh
+
+ LIBRARY AND EXTENSIONS
+
+  Title:  "New module: autouse.pm"
+   From:  Ilya Zakharevich <ilya@math.ohio-state.edu>
+ Msg-ID:  <199703210034.TAA13469@monk.mps.ohio-state.edu>
+   Date:  Thu, 20 Mar 1997 19:34:30 -0500 (EST)
+  Files:  MANIFEST lib/autouse.pm
+
+  Title:  "Math::Complex update"
+   From:  Jarkko Hietaniemi
+  Files:  lib/Math/Complex.pm t/lib/complex.t
+
+  Title:  "Refresh DB_File to 1.12"
+   From:  pmarquess@bfsec.bt.co.uk (Paul Marquess)
+ Msg-ID:  <9703121551.AA07435@claudius.bfsec.bt.co.uk>
+   Date:  Wed, 12 Mar 97 15:51:14 GMT
+  Files:  ext/DB_File/DB_File.pm ext/DB_File/DB_File.xs
+
+  Title:  "New subroutine Symbol::qualify_to_ref()"
+   From:  Roderick Schertler <roderick@argon.org>
+ Msg-ID:  <pzlo7ut03b.fsf@eeyore.ibcinc.com>
+   Date:  11 Mar 1997 19:39:36 -0500
+  Files:  lib/Symbol.pm
+
+  Title:  "In debugger, don't reference %{$f{$g}} if $f{$g} doesn't exist"
+   From:  Chip Salzenberg
+  Files:  lib/perl5db.pl
+
+  Title:  "In File::Path, some systems can't remove read-only files"
+   From:  Chip Salzenberg
+  Files:  lib/File/Path.pm
+
+  Title:  "Fix typo in -l*perl* pattern"
+   From:  Doug MacEachern <dougm@opengroup.org>
+ Msg-ID:  <199703110414.XAA12884@berlin.atlantic.net>
+   Date:  Mon, 10 Mar 1997 22:58:38 -0500
+  Files:  lib/ExtUtils/Embed.pm
+
+  Title:  "Fix bugs revealed by prototype warnings"
+   From:  Chip Salzenberg
+  Files:  ext/Opcode/Opcode.pm lib/ExtUtils/MakeMaker.pm
+          lib/Getopt/Long.pm
+
+  Title:  "Problems with SKIP in makemaker"
+   From:  Ilya Zakharevich <ilya@math.ohio-state.edu>
+ Msg-ID:  <199703210413.XAA21601@monk.mps.ohio-state.edu>
+   Date:  Thu, 20 Mar 1997 23:13:31 -0500 (EST)
+  Files:  lib/ExtUtils/MM_Unix.pm
+
+  Title:  "In Exporter, don't C<require Carp> at file scope"
+   From:  Chip Salzenberg
+  Files:  lib/Exporter.pm
+
+  Title:  "fix for Exporter's $SIG{__WARN__} handler"
+   From:  Roderick Schertler <roderick@argon.org>
+ Msg-ID:  <2282.858296451@eeyore.ibcinc.com>
+   Date:  Thu, 13 Mar 1997 18:40:51 -0500
+  Files:  lib/Exporter.pm
+
+  Title:  "Don't try to substr() refs in Carp"
+   From:  Chip Salzenberg
+  Files:  lib/Carp.pm
+
+  Title:  "Re: NUL in die and other messages"
+   From:  "M.J.T. Guy" <mjtg@cus.cam.ac.uk>
+ Msg-ID:  <E0w815V-0005xs-00@ursa.cus.cam.ac.uk>
+   Date:  Fri, 21 Mar 1997 09:58:17 +0000
+  Files:  lib/Carp.pm
+
+  Title:  "Add entry for prototype() in Pod::Functions"
+   From:  Chip Salzenberg
+  Files:  lib/Pod/Functions.pm
+
+  Title:  "Fix typos in IO::Socket documentation"
+   From:  "M.J.T. Guy" <mjtg@cus.cam.ac.uk>
+ Msg-ID:  <E0w75po-0003yh-00@taurus.cus.cam.ac.uk>
+   Date:  Tue, 18 Mar 1997 20:50:16 +0000
+  Files:  ext/IO/lib/IO/Socket.pm
+
+ TESTS
+
+   (no changes)
+
+ UTILITIES
+
+  Title:  "Re: bug in pod2man (5.00326): section=3 for .pm modules"
+   From:  Roderick Schertler <roderick@argon.org>
+ Msg-ID:  <pzn2sat1hg.fsf@eeyore.ibcinc.com>
+   Date:  11 Mar 1997 19:09:31 -0500
+  Files:  pod/pod2man.PL
+
+ DOCUMENTATION
+
+  Title:  "perlfaq.pod"
+   From:  Tom Christiansen <tchrist@jhereg.perl.com>
+ Msg-ID:  <199703172301.QAA12566@jhereg.perl.com>
+   Date:  Mon, 17 Mar 1997 16:01:40 -0700
+  Files:  MANIFEST pod/Makefile pod/buildtoc pod/perl.pod
+          pod/perlfaq*.pod pod/roffitall
+
+  Title:  "*.pod changes based on the FAQ"
+   From:  gnat@frii.com
+ Msg-ID:  <199703171650.JAA02655@elara.frii.com>
+   Date:  Mon, 17 Mar 1997 09:50:14 -0700 (MST)
+  Files:  pod/perldata.pod pod/perlfunc.pod pod/perlipc.pod
+          pod/perlop.pod pod/perlre.pod pod/perlrun.pod
+          pod/perlsec.pod pod/perlvar.pod
+
+  Title:  "INSTALL:  How to enable debugging"
+   From:  Andy Dougherty <doughera@fractal.phys.lafayette.edu>
+ Msg-ID:  <Pine.SOL.3.95q.970321112326.1414A-100000@fractal.lafayette.e
+   Date:  Fri, 21 Mar 1997 11:25:32 -0500 (EST)
+  Files:  INSTALL
+
+  Title:  "Document that $. is not reset on implicit open"
+   From:  Chip Salzenberg
+  Files:  pod/perldelta.pod
+
+  Title:  "Re: Embedding success with _93 "
+   From:  Doug MacEachern <dougm@opengroup.org>
+ Msg-ID:  <199703112255.RAA22775@postman.osf.org>
+   Date:  Tue, 11 Mar 1997 17:55:05 -0500
+  Files:  pod/perldelta.pod
+
+  Title:  "Update site list"
+   From:  lvirden@cas.org (Larry W. Virden, x2487)
+ Msg-ID:  <9703111053.AA20051@cas.org>
+   Date:  Tue, 11 Mar 1997 10:53:49 -0500
+  Files:  pod/perlmod.pod
+
+  Title:  "Patch to document illegal characters"
+   From:  Tom Phoenix <rootbeer@teleport.com>
+ Msg-ID:  <Pine.GSO.3.96.970314090558.15346J-100000@kelly.teleport.com>
+   Date:  Fri, 14 Mar 1997 09:08:10 -0800 (PST)
+  Files:  pod/perldiag.pod pod/perltrap.pod
+
+  Title:  "Document trap with //o and closures"
+   From:  Charles Bailey <bailey@HMIVAX.HUMGEN.UPENN.EDU>
+ Msg-ID:  <01IGCHWRNSEU00661G@hmivax.humgen.upenn.edu>
+   Date:  Mon, 10 Mar 1997 18:08:08 -0500 (EST)
+  Files:  pod/perltrap.pod
+
+  Title:  "Re: Inline PI function"
+   From:  Tom Phoenix <rootbeer@teleport.com>
+ Msg-ID:  <Pine.GSO.3.95q.970310143125.22489V-100000@kelly.teleport.com
+   Date:  Mon, 10 Mar 1997 14:33:20 -0800 (PST)
+  Files:  pod/perlsub.pod
+
+  Title:  "Illegal character in input"
+   From:  Tom Phoenix <rootbeer@teleport.com>
+ Msg-ID:  <Pine.GSO.3.95q.970310151512.22489a-100000@kelly.teleport.com
+   Date:  Mon, 10 Mar 1997 15:21:21 -0800 (PST)
+  Files:  pod/perldiag.pod
+
+  Title:  "Patch for docs Re: Lost backslash"
+   From:  Tom Phoenix <rootbeer@teleport.com>
+ Msg-ID:  <Pine.GSO.3.96.970319071438.24834G-100000@kelly.teleport.com>
+   Date:  Wed, 19 Mar 1997 07:28:57 -0800 (PST)
+  Files:  pod/perlop.pod
+
+  Title:  "XSUB's doc fix"
+   From:  Roderick Schertler <roderick@argon.org>
+ Msg-ID:  <28804.858012126@eeyore.ibcinc.com>
+   Date:  Mon, 10 Mar 1997 11:42:06 -0500
+  Files:  pod/perlcall.pod pod/perlguts.pod pod/perlxstut.pod
+
+  Title:  "Document return from do FILE"
+   From:  "M.J.T. Guy" <mjtg@cus.cam.ac.uk>
+ Msg-ID:  <E0w70DK-0001yJ-00@ursa.cus.cam.ac.uk>
+   Date:  Tue, 18 Mar 1997 14:50:10 +0000
+  Files:  pod/perlfunc.pod
+
+  Title:  "Document $^M in perlvar"
+   From:  Robin Barker <rmb1@cise.npl.co.uk>
+ Msg-ID:  <6153.9703202108@tempest.cise.npl.co.uk>
+   Date:  Thu, 20 Mar 97 21:08:33 GMT
+  Files:  pod/perlvar.pod
+
+  Title:  "typos in pods of 5.003_93"
+   From:  Jim Meyering <meyering@asic.sc.ti.com>
+ Msg-ID:  <wpgendbzvhx.fsf@asic.sc.ti.com>
+   Date:  19 Mar 1997 10:39:38 -0600
+  Files:  pod/perlfunc.pod pod/perlguts.pod pod/perlre.pod
+          pod/perltoot.pod pod/perlxs.pod
+
+  Title:  "Re: Updates to pod punctuations"
+   From:  lvirden@cas.org (Larry W. Virden, x2487)
+ Msg-ID:  <9703141700.AA22911@cas.org>
+   Date:  Fri, 14 Mar 1997 17:00:12 -0500
+  Files:  pod/*.pod
+
+  Title:  "clarify example in perlfunc"
+   From:  Jarkko Hietaniemi <jhi@iki.fi>
+ Msg-ID:  <199703201746.TAA25195@alpha.hut.fi>
+   Date:  Thu, 20 Mar 1997 19:46:01 +0200 (EET)
+  Files:  pod/perlfunc.pod
+
+  Title:  "Regularize headings in DB_File documentation"
+   From:  Chip Salzenberg
+  Files:  ext/DB_File/DB_File.pm
+
+
+----------------
 Version 5.003_93
 ----------------
 
index 5eacc6c..43fb081 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -5324,8 +5324,17 @@ EOH
                rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
                . ./myread
                case "$ans" in
-               none) startperl=": # use perl";;
-               *) startperl="#!$ans";;
+               none)   startperl=": # use perl";;
+               *)      startperl="#!$ans"
+                       if $test 33 -lt `echo "$ans" | wc -c`; then
+                               $cat >&4 <<EOM
+
+WARNING:  Some systems limit the #! command to 32 characters.
+If you experience difficulty running Perl scripts with #!, try
+installing Perl in a directory with a shorter pathname.
+
+EOM
+                       fi ;;
                esac
                ;;
        *) startperl=": # use perl"
@@ -8222,6 +8231,51 @@ set db.h i_db
 eval $inhdr
 
 case "$i_db" in
+$define)
+       : Check db version.  We can not use version 2.
+       echo " "
+       echo "Checking Berkeley DB version ..." >&4
+       $cat >try.c <<EOCP
+#$d_const HASCONST
+#ifndef HASCONST
+#define const
+#endif
+#include <sys/types.h>
+#include <stdio.h>
+#include <db.h>
+main()
+{
+#ifdef DB_VERSION_MAJOR
+    printf("You have Berkeley DB Version %d.%d\n",
+               DB_VERSION_MAJOR, DB_VERSION_MINOR);
+    printf("Perl currently only supports up to version 1.86.\n");
+    exit(1);
+#else
+    exit(0);
+#endif
+}
+EOCP
+       if $cc $optimize $ccflags $ldflags -o try try.c $libs && ./try; then
+               echo 'Looks OK.  (Perl supports up to version 1.86).' >&4
+       else
+               echo "I can't use your Berkeley DB.  I'll disable it." >&4
+               i_db=$undef
+               case " $libs " in
+               *"-ldb "*)
+                       : Remove db from list of libraries to use
+                       echo "Removing unusable -ldb from library list" >&4
+                       set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
+                       shift
+                       libs="$*"
+                       echo "libs = $libs" >&4
+                       ;;
+               esac
+       fi
+       $rm -f try.*
+       ;;
+esac
+
+case "$i_db" in
 define)
        : Check the return type needed for hash 
        echo " "
@@ -8251,13 +8305,15 @@ EOCP
                        db_hashtype='u_int32_t'
                fi
        else
-               echo "I can't seem to compile the test program." >&4
-               db_hashtype=int
+               : XXX Maybe we should just give up here.
+               db_hashtype=u_int32_t
+               echo "Help:  I can't seem to compile the db test program." >&4
+               echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
        fi
        $rm -f try.*
        echo "Your version of Berkeley DB uses $db_hashtype for hash."
        ;;
-*)     db_hashtype=int
+*)     db_hashtype=u_int32_t
        ;;
 esac
 
@@ -8291,13 +8347,15 @@ EOCP
                        db_prefixtype='size_t'
                fi
        else
-               echo "I can't seem to compile the test program." >&4
-               db_prefixtype='int'
+               db_prefixtype='size_t'
+               : XXX Maybe we should just give up here.
+               echo "Help:  I can't seem to compile the db test program." >&4
+               echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
        fi
        $rm -f try.*
        echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
        ;;
-*)     db_prefixtype='int'
+*)     db_prefixtype='size_t'
        ;;
 esac
 
index 8b0b497..987d22c 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -21,6 +21,7 @@ README.os2            Notes about OS/2 port
 README.plan9           Notes about Plan9 port
 README.qnx             Notes about QNX port
 README.vms             Notes about VMS port
+README.win32           Notes about Win32 port
 Todo                   The Wishlist
 XSUB.h                 Include file for extension subroutines
 av.c                   Array value code
@@ -292,12 +293,14 @@ lib/DirHandle.pm  like FileHandle only for directories
 lib/English.pm         Readable aliases for short variables
 lib/Env.pm             Map environment into ordinary variables
 lib/Exporter.pm                Exporter base class
+lib/ExtUtils/Command.pm        Utilities for Make on non-UNIX platforms
 lib/ExtUtils/Embed.pm  Utilities for embedding Perl in C programs
 lib/ExtUtils/Install.pm        Handles 'make install' on extensions
 lib/ExtUtils/Liblist.pm        Locates libraries
 lib/ExtUtils/MM_OS2.pm         MakeMaker methods for OS/2
 lib/ExtUtils/MM_Unix.pm                MakeMaker base class for Unix
 lib/ExtUtils/MM_VMS.pm         MakeMaker methods for VMS
+lib/ExtUtils/MM_Win32.pm       MakeMaker methods for Win32
 lib/ExtUtils/MakeMaker.pm      Write Makefiles for extensions
 lib/ExtUtils/Manifest.pm       Utilities to write MANIFEST files
 lib/ExtUtils/Mkbootstrap.pm    Writes a bootstrap file (see MakeMaker)
@@ -359,6 +362,7 @@ lib/User/grent.pm   By-name interface to Perl's built-in getgr*
 lib/User/pwent.pm      By-name interface to Perl's built-in getpw*
 lib/abbrev.pl          An abbreviation table builder
 lib/assert.pl          assertion and panic with stack trace
+lib/autouse.pm         Load and call a function only when it's used
 lib/bigfloat.pl                An arbitrary precision floating point package
 lib/bigint.pl          An arbitrary precision integer arithmetic package
 lib/bigrat.pl          An arbitrary precision rational arithmetic package
@@ -504,6 +508,16 @@ pod/perldelta.pod  Changes since last version
 pod/perldiag.pod       Diagnostic info
 pod/perldsc.pod                Data Structures Cookbook
 pod/perlembed.pod      Embedding info
+pod/perlfaq.pod                Frequently Asked Questions, Top Level
+pod/perlfaq1.pod       Frequently Asked Questions, Part 1
+pod/perlfaq2.pod       Frequently Asked Questions, Part 2
+pod/perlfaq3.pod       Frequently Asked Questions, Part 3
+pod/perlfaq4.pod       Frequently Asked Questions, Part 4
+pod/perlfaq5.pod       Frequently Asked Questions, Part 5
+pod/perlfaq6.pod       Frequently Asked Questions, Part 6
+pod/perlfaq7.pod       Frequently Asked Questions, Part 7
+pod/perlfaq8.pod       Frequently Asked Questions, Part 8
+pod/perlfaq9.pod       Frequently Asked Questions, Part 9
 pod/perlform.pod       Format info
 pod/perlfunc.pod       Function info
 pod/perlguts.pod       Internals info
@@ -741,6 +755,7 @@ vms/ext/Stdio/test.pl       regression tests for VMS::Stdio
 vms/ext/XSSymSet.pm    manage linker symbols when building extensions
 vms/ext/filespec.t     See if VMS::Filespec funtions work
 vms/ext/vmsish.pm      Control VMS-specific behavior of Perl core
+vms/ext/vmsish.t       Tests for vmsish.pm
 vms/fndvers.com                parse Perl version from patchlevel.h
 vms/gen_shrfls.pl      generate options files and glue for shareable image
 vms/genconfig.pl       retcon config.sh from config.h
@@ -763,10 +778,17 @@ win32/Fcntl.mak           Win32 port
 win32/IO.mak           Win32 port
 win32/Makefile         Win32 port
 win32/Opcode.mak       Win32 port
-win32/README           Win32 port
 win32/SDBM_File.mak    Win32 port
 win32/Socket.mak       Win32 port
 win32/TEST             Win32 port
+win32/VC-2.0/SDBM_File.mak     Win32 port
+win32/VC-2.0/Socket.mak                Win32 port
+win32/VC-2.0/libperl.mak       Win32 port
+win32/VC-2.0/miniperl.mak      Win32 port
+win32/VC-2.0/modules.mak       Win32 port
+win32/VC-2.0/perl.mak          Win32 port
+win32/VC-2.0/perldll.mak       Win32 port
+win32/VC-2.0/vc2.patch         Win32 port
 win32/autosplit.pl     Win32 port
 win32/bin/PL2BAT.BAT   Win32 port
 win32/bin/network.pl   Win32 port
@@ -800,8 +822,8 @@ win32/runperl.c             Win32 port
 win32/splittree.pl     Win32 port
 win32/win32.c          Win32 port
 win32/win32.h          Win32 port
-win32/win32aux.cpp     Win32 port
-win32/win32io.cpp      Win32 port
+win32/win32aux.c       Win32 port
+win32/win32io.c                Win32 port
 win32/win32io.h                Win32 port
 win32/win32iop.h       Win32 port
 win32/win32sck.c       Win32 port
diff --git a/README.win32 b/README.win32
new file mode 100644 (file)
index 0000000..36953ec
--- /dev/null
@@ -0,0 +1,275 @@
+If you read this file _as_is_, just ignore the funny characters you
+see. It is written in the POD format (see pod/perlpod.pod) which is
+specially designed to be readable as is.
+
+=head1 NAME
+
+perlwin32 - Perl under WindowsNT [XXX and perhaps under Windows95]
+
+=head1 SYNOPSIS
+
+These are instructions for building Perl under WindowsNT (versions
+3.51 or 4.0), using Visual C++.
+
+=head1 DESCRIPTION
+
+Before you start, you should glance through the README file found
+found in the top-level directory where the Perl distribution
+was extracted.  Make sure you read and understand the terms under
+which this software is being distributed.
+
+Make sure you read the L<BUGS AND CAVEATS> section below for the
+known limitations of this port.
+
+The INSTALL file in the perl top-level has much information that is
+only relevant to people building Perl on Unix-like systems.  In
+particular, you can safely ignore any information that talks about
+"Configure".
+
+You should probably also read the README.os2 file, which gives a
+different set of rules to build a Perl that will work on Win32
+platforms.  That method will probably enable you to build a more
+Unix-compatible perl, but you will also need to download and use
+various other support software described in that file.
+
+This set of instructions is meant to describe a so-called "native"
+port of Perl to Win32 platforms.  The resulting Perl requires no
+additional software to run (other than what came with your operating
+system).  Currently, this port is only capable of using Microsoft's
+Visual C++ compiler.  The ultimate goal is to support the other major
+compilers that can be used on the platforms.
+
+=head2 Setting Up
+
+=over 4
+
+=item *
+
+Use the default "cmd" shell that comes with NT.  In particular, do
+*not* use the 4DOS/NT shell.  The Makefile has commands that are not
+compatible with that shell.
+
+=item *
+
+Run the VCVARS32.BAT file usually found somewhere like C:\MSDEV4.2\BIN.
+This will set your build environment.
+
+=item *
+
+Depending on how you extracted the distribution, you have to make sure
+all the files are writable by you.  The easiest way to make sure of
+this is to execute:
+
+       attrib -R *.* /S
+
+from the perl toplevel directory.  You don't I<have> to do this if you
+used the right tools to extract the files in the standard distribution,
+but it doesn't hurt to do so.
+
+=back
+
+=head2 Building and Installation
+
+=over 4
+
+=item *
+
+The "win32" directory contains *.mak files for use with the NMAKE that
+comes with Visual C++ ver. 4.0 and above.  If you wish to build perl
+using Visual C++ versions between 2.0 and 4.0, do the following three
+additional steps (these three steps are not required if you are
+using Visual C++ versions 4.0 and above):
+
+=over 8
+
+=item 1.
+
+Overwrite the *.mak files in the win32 subdirectory with the versions
+in the win32\VC-2.0 directory.  (The only difference in those makefiles
+is in how the $(INCLUDE) variable is handled--VC 2.0 NMAKE does not
+grok a path list in $(INCLUDE)).
+
+=item 2.
+
+Reset your INCLUDE environment variable to the MSVC include directory.
+For example:
+
+       set INCLUDE=E:\MSVC20\INCLUDE
+
+This must have only one directory (a list of directories will not work).
+VCVARS32.BAT may put multiple locations in there, which is why this step
+is required.
+
+=item 3.
+
+Apply the patch found in win32\VC-2.0\vc2.patch, like so:
+
+       cd win32
+       patch -p2 -N < VC-2.0\vc2.patch
+
+You may have to edit win32\win32.c manually if you don't have GNU patch.
+
+=back
+
+=item * 
+
+Make sure you are in the "win32" subdirectory under the perl toplevel.
+
+=item *
+
+Type "nmake" while in the "win32" subdirectory.  This should build
+everything.  Specifically, it will create perl.exe, perl.dll, and
+perlglob.exe at the perl toplevel, and various other extension dll's
+under the lib\auto directory.  If the make fails for any reason, make
+sure you have done the previous steps correctly.
+
+=item *
+
+Type "nmake install".  This will put the newly built perl and the
+libraries under C:\PERL.  If you want to alter this location, to say,
+D:\FOO\PERL, you will have to say:
+
+       nmake install INST_TOP=D:\FOO\PERL
+
+instead.  To use the Perl you just installed, make sure you set your
+PATH environment variable to C:\PERL\BIN (or D:\FOO\PERL\BIN).
+
+=back
+
+=head2 Testing
+
+Type "nmake test".  This will run most of the tests from the
+testsuite (many tests will be skipped, and some tests will fail).
+Most failures are due to UNIXisms in the standard perl testsuite.
+
+To get a more detailed breakdown of the tests that failed, say:
+
+       cd ..\t
+       .\perl harness
+
+This should produce a summary very similar to the following:
+
+    Failed Test  Status Wstat Total Fail  Failed  List of failed
+    ------------------------------------------------------------------------------
+    io/fs.t                      26   16  61.54%  1-5, 7-11, 16-18, 23-25
+    io/tell.t                    13    1   7.69%  10
+    lib/anydbm.t                 12    1   8.33%  2
+    lib/findbin.t                 1    1 100.00%  1
+    lib/sdbm.t                   12    1   8.33%  2
+    op/mkdir.t                    7    2  28.57%  3, 7
+    op/runlevel.t                 8    1  12.50%  4
+    op/stat.t                    56    3   5.36%  3-4, 20
+    op/taint.t                   98   20  20.41%  1-6, 14, 16, 19-21, 24, 26, 35-3
+    pragma/locale.t              98   40  40.82%  1, 13-14, 21-27, 33, 39, 45-53,
+    Failed 10/149 test scripts, 93.29% okay. 86/3506 subtests failed, 97.55% okay.
+
+Check if any additional tests other than the ones shown here
+failed.  The standard testsuite will ultimately be modified so
+that the testsuite avoids running irrelevant tests on Win32.
+
+=head1 BUGS AND CAVEATS
+
+This is still very much an experimental port, and should be considered
+alpha quality software.  You can expect changes in virtually all of
+these areas: build process, installation structure, supported
+utilities/modules, and supported perl functionality.  Specifically,
+functionality that supports the Win32 environment may be ultimately
+be supported as either core modules or extensions.
+
+Many tests from the standard testsuite either fail or produce different
+results under this port.  Most of the problems fall under one of these
+categories
+
+=over 8
+
+=item *
+
+C<stat()> and C<lstat()> functions may not behave as documented.  They
+may return values that bear no resemblance to those reported on Unix
+platforms, and some fields may be completely bogus.
+
+=item *
+
+The following functions are currently unavailable: C<fork()>, C<exec()>,
+C<dump()>, C<kill()>, C<chown()>, C<link()>, C<symlink()>, C<chroot()>,
+C<setpgrp()>, C<getpgrp()>, C<setpriority()>, C<getpriority()>,
+C<syscall()>, C<fcntl()>, C<flock()>.  This list is possibly incomplete.
+
+=item *
+
+Various C<socket()> related calls are supported, but they may not
+behave as on Unix platforms.
+
+=item *
+
+The four-argument C<select()> call is only supported on sockets.
+
+=item *
+
+The behavior of C<system()> or the C<qx[]> operator (a.k.a. "backticks"),
+when used to call interactive commands, is ill-defined.
+
+=item *
+
+C<$!> doesn't work reliably yet.
+
+=item *
+
+Building modules available on CPAN is mostly supported, but this
+hasn't been tested much yet.  Expect strange problems, and be
+prepared to deal with the consequences.
+
+=item *
+
+C<utime()>, C<times()> and process-related functions may not
+behave as described in the documentation, and some of the
+returned values or effects may be bogus.
+
+=item *
+
+Signal handling may not behave as on Unix platforms.
+
+=item *
+
+File globbing may not behave as on Unix platforms.
+
+=item *
+
+Not all of the utilities that come with the Perl distribution
+are supported yet.
+
+=back
+
+Please send detailed descriptions of any problems and solutions that 
+you may find to <F<perlbug@perl.com>>, along with the output produced
+by C<perl -V>.
+
+=head1 AUTHORS
+
+=over 4
+
+=item Gary Ng <F<71564.1743@CompuServe.COM>>
+
+=item Gurusamy Sarathy <F<gsar@umich.edu>>
+
+=item Nick Ing-Simmons <F<nick@ni-s.u-net.com>>
+
+=back
+
+=head1 SEE ALSO
+
+L<perl>
+
+=head1 HISTORY
+
+This port was originally contributed by Gary Ng around 5.003_24,
+and borrowed from the Hip Communications port that was available
+at the time.
+
+Nick Ing-Simmons and Gurusamy Sarathy have made numerous and
+sundry hacks since then.
+
+Last updated: 19 March 1997
+
+=cut
+
diff --git a/doop.c b/doop.c
index 7086a7b..a87f7ef 100644 (file)
--- a/doop.c
+++ b/doop.c
@@ -712,8 +712,10 @@ dARGS
            sv_setsv(tmpstr,hv_iterval(hv,entry));
            SPAGAIN;
            DEBUG_H( {
-                       sprintf(buf,"%d%%%d=%d\n", HeHASH(entry),
-                               HvMAX(hv)+1, HeHASH(entry) & HvMAX(hv));
+                       sprintf(buf,"%lu%%%d=%lu\n",
+                               (unsigned long)HeHASH(entry),
+                               HvMAX(hv)+1,
+                               (unsigned long)(HeHASH(entry) & HvMAX(hv)));
                        sv_setpv(tmpstr,buf);
            } )
            XPUSHs(sv_2mortal(tmpstr));
diff --git a/dump.c b/dump.c
index 0b2084e..af75cf7 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -185,10 +185,12 @@ register OP *op;
                 op->op_type == OP_AELEM ||
                 op->op_type == OP_HELEM )
        {
-           if (op->op_private & OPpENTERSUB_AMPER)
-               (void)strcat(buf,"AMPER,");
-           if (op->op_private & OPpENTERSUB_DB)
-               (void)strcat(buf,"DB,");
+           if (op->op_type == OP_ENTERSUB) {
+               if (op->op_private & OPpENTERSUB_AMPER)
+                   (void)strcat(buf,"AMPER,");
+               if (op->op_private & OPpENTERSUB_DB)
+                   (void)strcat(buf,"DB,");
+           }
            switch (op->op_private & OPpDEREF) {
            case OPpDEREF_SV:
                (void)strcat(buf, "SV,");
@@ -200,8 +202,14 @@ register OP *op;
                (void)strcat(buf, "HV,");
                break;
            }
-           if (op->op_private & HINT_STRICT_REFS)
-               (void)strcat(buf,"STRICT_REFS,");
+           if (op->op_type == OP_AELEM || op->op_type == OP_HELEM) {
+               if (op->op_private & OPpLVAL_DEFER)
+                   (void)strcat(buf,"LVAL_DEFER,");
+           }
+           else {
+               if (op->op_private & HINT_STRICT_REFS)
+                   (void)strcat(buf,"STRICT_REFS,");
+           }
        }
        else if (op->op_type == OP_CONST) {
            if (op->op_private & OPpCONST_BARE)
diff --git a/embed.h b/embed.h
index faa9225..3beabb6 100644 (file)
--- a/embed.h
+++ b/embed.h
@@ -60,7 +60,7 @@
 #define bufend                 Perl_bufend
 #define bufptr                 Perl_bufptr
 #define bxor_amg               Perl_bxor_amg
-#define calllist               Perl_calllist
+#define call_list              Perl_call_list
 #define cando                  Perl_cando
 #define cast_ulong             Perl_cast_ulong
 #define check                  Perl_check
 #define gv_stashpv             Perl_gv_stashpv
 #define gv_stashpvn            Perl_gv_stashpvn
 #define gv_stashsv             Perl_gv_stashsv
-#define he_delayfree           Perl_he_delayfree
-#define he_free                        Perl_he_free
 #define he_root                        Perl_he_root
 #define hexdigit               Perl_hexdigit
 #define hints                  Perl_hints
 #define hoistmust              Perl_hoistmust
 #define hv_clear               Perl_hv_clear
+#define hv_delayfree_ent       Perl_hv_delayfree_ent
 #define hv_delete              Perl_hv_delete
 #define hv_delete_ent          Perl_hv_delete_ent
 #define hv_exists              Perl_hv_exists
 #define hv_exists_ent          Perl_hv_exists_ent
 #define hv_fetch               Perl_hv_fetch
 #define hv_fetch_ent           Perl_hv_fetch_ent
+#define hv_free_ent            Perl_hv_free_ent
 #define hv_iterinit            Perl_hv_iterinit
 #define hv_iterkey             Perl_hv_iterkey
 #define hv_iterkeysv           Perl_hv_iterkeysv
 #define magic_clearpack                Perl_magic_clearpack
 #define magic_clearsig         Perl_magic_clearsig
 #define magic_existspack       Perl_magic_existspack
-#define magic_freeitervar      Perl_magic_freeitervar
+#define magic_freedefelem      Perl_magic_freedefelem
 #define magic_get              Perl_magic_get
 #define magic_getarylen                Perl_magic_getarylen
+#define magic_getdefelem       Perl_magic_getdefelem
 #define magic_getglob          Perl_magic_getglob
-#define magic_getitervar       Perl_magic_getitervar
 #define magic_getpack          Perl_magic_getpack
 #define magic_getpos           Perl_magic_getpos
 #define magic_getsig           Perl_magic_getsig
 #define magic_setbm            Perl_magic_setbm
 #define magic_setcollxfrm      Perl_magic_setcollxfrm
 #define magic_setdbline                Perl_magic_setdbline
+#define magic_setdefelem       Perl_magic_setdefelem
 #define magic_setenv           Perl_magic_setenv
 #define magic_setfm            Perl_magic_setfm
 #define magic_setglob          Perl_magic_setglob
 #define magic_setisa           Perl_magic_setisa
-#define magic_setitervar       Perl_magic_setitervar
 #define magic_setmglob         Perl_magic_setmglob
 #define magic_setnkeys         Perl_magic_setnkeys
 #define magic_setpack          Perl_magic_setpack
 #define pregfree               Perl_pregfree
 #define prepend_elem           Perl_prepend_elem
 #define profiledata            Perl_profiledata
-#define provide_ref            Perl_provide_ref
 #define psig_name              Perl_psig_name
 #define psig_ptr               Perl_psig_ptr
 #define push_return            Perl_push_return
 #define utilize                        Perl_utilize
 #define varies                 Perl_varies
 #define vert                   Perl_vert
-#define vivify_itervar         Perl_vivify_itervar
+#define vivify_defelem         Perl_vivify_defelem
+#define vivify_ref             Perl_vivify_ref
 #define vtbl_amagic            Perl_vtbl_amagic
 #define vtbl_amagicelem                Perl_vtbl_amagicelem
 #define vtbl_arylen            Perl_vtbl_arylen
 #define vtbl_bm                        Perl_vtbl_bm
 #define vtbl_collxfrm          Perl_vtbl_collxfrm
 #define vtbl_dbline            Perl_vtbl_dbline
+#define vtbl_defelem           Perl_vtbl_defelem
 #define vtbl_env               Perl_vtbl_env
 #define vtbl_envelem           Perl_vtbl_envelem
 #define vtbl_fm                        Perl_vtbl_fm
 #define vtbl_glob              Perl_vtbl_glob
 #define vtbl_isa               Perl_vtbl_isa
 #define vtbl_isaelem           Perl_vtbl_isaelem
-#define vtbl_itervar           Perl_vtbl_itervar
 #define vtbl_mglob             Perl_vtbl_mglob
 #define vtbl_nkeys             Perl_vtbl_nkeys
 #define vtbl_pack              Perl_vtbl_pack
index d962b88..c2609a0 100644 (file)
@@ -1,8 +1,8 @@
 # DB_File.pm -- Perl 5 interface to Berkeley DB 
 #
 # written by Paul Marquess (pmarquess@bfsec.bt.co.uk)
-# last modified 6th Feb 1997
-# version 1.11
+# last modified 12th Mar 1997
+# version 1.12
 #
 #     Copyright (c) 1995, 1996, 1997 Paul Marquess. All rights reserved.
 #     This program is free software; you can redistribute it and/or
@@ -146,7 +146,7 @@ use vars qw($VERSION @ISA @EXPORT $AUTOLOAD $DB_BTREE $DB_HASH $DB_RECNO) ;
 use Carp;
 
 
-$VERSION = "1.11" ;
+$VERSION = "1.12" ;
 
 #typedef enum { DB_BTREE, DB_HASH, DB_RECNO } DBTYPE;
 $DB_BTREE = new DB_File::BTREEINFO ;
@@ -326,6 +326,10 @@ module you should really have a copy of the Berkeley DB manual pages at
 hand. The interface defined here mirrors the Berkeley DB interface
 closely.
 
+Please note that this module will only work with version 1.x of
+Berkeley DB. Once Berkeley DB version 2 is released, B<DB_File> will be
+upgraded to work with it.
+
 Berkeley DB is a C library which provides a consistent interface to a
 number of database formats.  B<DB_File> provides an interface to all
 three of the database types currently supported by Berkeley DB.
@@ -365,7 +369,7 @@ number.
 
 =back
 
-=head2 How does DB_File interface to Berkeley DB?
+=head2 Interface to Berkeley DB
 
 B<DB_File> allows access to Berkeley DB files using the tie() mechanism
 in Perl 5 (for full details, see L<perlfunc/tie()>). This facility
@@ -533,7 +537,7 @@ The DB_HASH file format is probably the most commonly used of the three
 file formats that B<DB_File> supports. It is also very straightforward
 to use.
 
-=head2 A Simple Example.
+=head2 A Simple Example
 
 This example shows how to create a database, add key/value pairs to the
 database, delete keys/value pairs and finally how to enumerate the
@@ -645,7 +649,7 @@ database.
 
 =back 
 
-=head2 Handling duplicate keys 
+=head2 Handling Duplicate Keys 
 
 The BTREE file type optionally allows a single key to be associated
 with an arbitrary number of values. This option is enabled by setting
@@ -752,7 +756,7 @@ that prints:
 This time we have got all the key/value pairs, including the multiple
 values associated with the key C<Wall>.
 
-=head2 The get_dup method.
+=head2 The get_dup() Method
 
 B<DB_File> comes with a utility method, called C<get_dup>, to assist in
 reading duplicate values from BTREE databases. The method can take the
@@ -893,7 +897,7 @@ negative indexes. The index -1 refers to the last element of the array,
 -2 the second last, and so on. Attempting to access an element before
 the start of the array will raise a fatal run-time error.
 
-=head2 The bval option
+=head2 The 'bval' Option
 
 The operation of the bval option warrants some discussion. Here is the
 definition of bval from the Berkeley DB 1.85 recno manual page:
@@ -1144,7 +1148,7 @@ destroyed.
     undef $db ;
     untie %hash ;
 
-See L<The untie Gotcha> for more details.
+See L<The untie gotcha> for more details.
 
 All the functions defined in L<dbopen> are available except for
 close() and dbopen() itself. The B<DB_File> method interface to the
@@ -1333,7 +1337,7 @@ in the background to watch the locks granted in proper order.
     close(DB_FH);
     print "$$: Updated db to $key=$value\n";
 
-=head2 Sharing databases with C applications
+=head2 Sharing Databases With C Applications
 
 There is no technical reason why a Berkeley DB database cannot be
 shared by both a Perl and a C application.
@@ -1391,10 +1395,10 @@ F<authors/id/TOMC/scripts/nshist.gz>).
 
     untie %hist_db ;
 
-=head2 The untie gotcha
+=head2 The untie() Gotcha
 
 If you make use of the Berkeley DB API, it is is I<very> strongly
-recommended that you read L<perltie/The untie gotcha>. 
+recommended that you read L<perltie/The untie Gotcha>. 
 
 Even if you don't currently make use of the API interface, it is still
 worth reading it.
@@ -1642,6 +1646,10 @@ Fixed fd method so that it still returns -1 for in-memory files when db
 
 Documented the untie gotcha.
 
+=item 1.12
+
+Documented the incompatibility with version 2 of Berkeley DB.
+
 =back
 
 =head1 BUGS
@@ -1658,7 +1666,10 @@ suggest any enhancements, I would welcome your comments.
 B<DB_File> comes with the standard Perl source distribution. Look in
 the directory F<ext/DB_File>.
 
-Berkeley DB is available at your nearest CPAN archive (see
+This version of B<DB_File> will only work with version 1.x of Berkeley
+DB. It is I<not> yet compatible with version 2.
+
+Version 1 of Berkeley DB is available at your nearest CPAN archive (see
 L<perlmod/"CPAN"> for a list) in F<src/misc/db.1.85.tar.gz>, or via the
 host F<ftp.cs.berkeley.edu> in F</ucb/4bsd/db.tar.gz>.  Alternatively,
 check out the Berkeley DB home page at F<http://www.bostic.com/db>. It
index 796c5c6..93cf44a 100644 (file)
@@ -3,8 +3,8 @@
  DB_File.xs -- Perl 5 interface to Berkeley DB 
 
  written by Paul Marquess (pmarquess@bfsec.bt.co.uk)
- last modified 6th Feb 1997
- version 1.11
+ last modified 12th Mar 1997
+ version 1.12
 
  All comments/suggestions/problems are welcome
 
@@ -38,6 +38,7 @@
        1.10 -  Fixed fd method so that it still returns -1 for
                in-memory files when db 1.86 is used.
        1.11 -  No change to DB_File.xs
+       1.12 -  No change to DB_File.xs
 
 */
 
index 1675d46..5db658d 100644 (file)
@@ -22,15 +22,16 @@ BEGIN {
     );
 }
 
+sub opset (;@);
+sub opset_to_hex ($);
+sub opdump (;$);
 use subs @EXPORT_OK;
 
 bootstrap Opcode $VERSION;
 
 _init_optags();
 
-
-*ops_to_opset = \&opset;       # alias for old name
-
+sub ops_to_opset { opset @_ }  # alias for old name
 
 sub opset_to_hex ($) {
     return "(invalid opset)" unless verify_opset($_[0]);
index 2575ca1..f723db7 100644 (file)
@@ -1731,13 +1731,13 @@ int arg;
                    goto not_there;
 #endif
 #ifdef SIG_DFL
-               if (strEQ(name, "SIG_DFL")) return (int)SIG_DFL;
+               if (strEQ(name, "SIG_DFL")) return (IV)SIG_DFL;
 #endif
 #ifdef SIG_ERR
-               if (strEQ(name, "SIG_ERR")) return (int)SIG_ERR;
+               if (strEQ(name, "SIG_ERR")) return (IV)SIG_ERR;
 #endif
 #ifdef SIG_IGN
-               if (strEQ(name, "SIG_IGN")) return (int)SIG_IGN;
+               if (strEQ(name, "SIG_IGN")) return (IV)SIG_IGN;
 #endif
                if (strEQ(name, "SIG_SETMASK"))
 #ifdef SIG_SETMASK
index f1d0573..ddfe931 100644 (file)
@@ -163,7 +163,6 @@ pow_amg
 pow_ass_amg
 ppaddr
 profiledata
-provide_ref
 psig_name
 psig_ptr
 rcsid
@@ -241,20 +240,21 @@ tokenbuf
 uid
 varies
 vert
-vivify_itervar
+vivify_defelem
+vivify_ref
 vtbl_amagic
 vtbl_amagicelem
 vtbl_arylen
 vtbl_bm
 vtbl_collxfrm
 vtbl_dbline
+vtbl_defelem
 vtbl_env
 vtbl_envelem
 vtbl_fm
 vtbl_glob
 vtbl_isa
 vtbl_isaelem
-vtbl_itervar
 vtbl_mglob
 vtbl_nkeys
 vtbl_pack
@@ -320,7 +320,7 @@ bind_match
 block_end
 block_start
 boot_core_UNIVERSAL
-calllist
+call_list
 cando
 cast_ulong
 check_uni
@@ -449,17 +449,17 @@ gv_init
 gv_stashpv
 gv_stashpvn
 gv_stashsv
-he_delayfree
-he_free
 he_root
 hoistmust
 hv_clear
+hv_delayfree_ent
 hv_delete
 hv_delete_ent
 hv_exists
 hv_exists_ent
 hv_fetch
 hv_fetch_ent
+hv_free_ent
 hv_iterinit
 hv_iterkey
 hv_iterkeysv
@@ -493,11 +493,11 @@ magic_clearenv
 magic_clearpack
 magic_clearsig
 magic_existspack
-magic_freeitervar
+magic_freedefelem
 magic_get
 magic_getarylen
+magic_getdefelem
 magic_getglob
-magic_getitervar
 magic_getpack
 magic_getpos
 magic_getsig
@@ -511,11 +511,11 @@ magic_setarylen
 magic_setbm
 magic_setcollxfrm
 magic_setdbline
+magic_setdefelem
 magic_setenv
 magic_setfm
 magic_setglob
 magic_setisa
-magic_setitervar
 magic_setmglob
 magic_setnkeys
 magic_setpack
index 2ed65c5..991348a 100644 (file)
@@ -10,6 +10,6 @@ do
       rm -f $i/3b1cc
       ln ../hints/3b1cc $i
 done
-echo "\nIf you want to use the 3b1 shared libraries, complete this script then"
-echo "read the header in 3b1cc.           [Type carriage return to continue]\c"
+echo "\nIf you want to use the 3b1 shared libraries, complete this script then" >&4
+echo "read the header in 3b1cc.           [Type carriage return to continue]\c" >&4
 read vch
index 2618039..8c361aa 100644 (file)
@@ -15,7 +15,7 @@ i_malloc='undef'
 malloctype='void *'
 
 # This info is left over from perl4.  
-cat <<'EOF'
+cat <<'EOF' >&4
 Some tests may fail unless you use 'chacl -B'.  Also, op/stat
 test 2 may fail occasionally because Apollo doesn't guarantee
 that mtime will be equal to ctime on a newly created unmodified
index f2e8c17..42bfe5d 100644 (file)
@@ -1,3 +1,4 @@
+#! /local/gnu/bin/bash
 # Hints for the CX/UX 7.1 operating system running on Concurrent (formerly
 # Harris) NightHawk machines.  written by Tom.Horsley@mail.ccur.com
 #
@@ -7,27 +8,27 @@
 #
 case ${SDE_TARGET:-ELF} in
    [Cc][Oo][Ff][Ff]|[Oo][Cc][Ss]) echo ''
-      echo ''
-      echo WARNING: Do not build perl 5 with the SDE_TARGET set to
-      echo generate coff object - perl 5 must be built in the ELF
-      echo environment.
-      echo ''
+      echo ''                                                          >&2
+      echo WARNING: Do not build perl 5 with the SDE_TARGET set to     >&2
+      echo generate coff object - perl 5 must be built in the ELF      >&2
+      echo environment.                                                        >&2
+      echo ''                                                          >&2
       echo '';;
    [Ee][Ll][Ff]) : ;;
-   *) echo ''
-      echo 'Unknown SDE_TARGET value: '$SDE_TARGET
-      echo '';;
+   *) echo ''                                                          >&2
+      echo 'Unknown SDE_TARGET value: '$SDE_TARGET                     >&2
+      echo ''                                                          >&2 ;;
 esac
 
 case `uname -r` in
    [789]*) : ;;
    *) echo ''
-      echo ''
-      echo WARNING: Perl 5 requires shared library support, it cannot
-      echo be built on releases of CX/UX prior to 7.0 with this hints
-      echo file. You\'ll have to do a separate port for the statically
-      echo linked COFF environment.
-      echo ''
+      echo ''                                                          >&2
+      echo WARNING: Perl 5 requires shared library support, it cannot  >&2
+      echo be built on releases of CX/UX prior to 7.0 with this hints  >&2
+      echo file. You\'ll have to do a separate port for the statically >&2
+      echo linked COFF environment.                                    >&2
+      echo ''                                                          >&2
       echo '';;
 esac
 
@@ -91,7 +92,7 @@ i_ndbm='undef'
 d_mymalloc='undef'
 usemymalloc='n'
 
-cat <<'EOM'
+cat <<'EOM' >&4
 
 WARNING: If you are using ksh to run the Configure script, you may find it
 failing in mysterious ways (such as failing to find library routines which
index 36afd3b..c1b0d0a 100644 (file)
@@ -21,7 +21,7 @@ libswanted="$*"
 # Here's another draft of the perl5/solaris/gcc sanity-checker. 
 
 case $PATH in
-*/usr/ucb*:/usr/bin:*|*/usr/ucb*:/usr/bin) cat <<END
+*/usr/ucb*:/usr/bin:*|*/usr/ucb*:/usr/bin) cat <<END >&2
 
 NOTE:  /usr/ucb/cc does not function properly.
 Remove /usr/ucb from your PATH.
@@ -37,7 +37,7 @@ esac
 case $? in
 0) ;;
 *)
-      cat <<END
+      cat <<END >&4
 
 NOTE: Your system does not have /dev/fd mounted.  If you want to
 be able to use set-uid scripts you must ask your system administrator
@@ -53,7 +53,7 @@ esac
 /usr/bin/ls /usr/lib/libucb* >/dev/null 2>&1
 case $? in
 0)
-      cat <<END
+      cat <<END >&4
 
 NOTE: libucb has been found in /usr/lib.  libucb should reside in
 /usr/ucblib.  You may have trouble while building Perl extensions.
@@ -70,7 +70,7 @@ if grep GNU make.vers > /dev/null 2>&1; then
     tmp=`/usr/bin/ksh -c "whence make"`
     case "`/usr/bin/ls -l $tmp`" in
     ??????s*)
-          cat <<END
+          cat <<END >&2
       
 NOTE: Your PATH points to GNU make, and your GNU make has the set-group-id
 bit set.  You must either rearrange your PATH to put /usr/ccs/bin before the
@@ -112,7 +112,7 @@ case "`${cc:-cc} -v 2>&1`" in
       case $verbose in
       */usr/ccs/bin/as*) ;;
       *)
-          cat <<END
+          cat <<END >&2
 
 NOTE: You are using GNU as(1).  GNU as(1) will not build Perl.
 You must arrange to use /usr/ccs/bin/as, perhaps by setting
@@ -126,7 +126,7 @@ END
       case $verbose in
       */usr/ccs/bin/ld*) ;;
       *)
-          cat <<END
+          cat <<END >&2
 
 NOTE: You are using GNU ld(1).  GNU ld(1) will not build Perl.
 You must arrange to use /usr/ccs/bin/ld, perhaps by setting
@@ -147,7 +147,7 @@ END
       # See if as(1) is GNU as(1).  GNU as(1) won't work for this job.
       case `as --version < /dev/null 2>&1` in
       *GNU*)
-              cat <<END
+              cat <<END >&2
 
 NOTE: You are using GNU as(1).  GNU as(1) will not build Perl.
 You must arrange to use /usr/ccs/bin, perhaps by adding it to the
@@ -160,7 +160,7 @@ END
       # See if ld(1) is GNU ld(1).  GNU ld(1) won't work for this job.
       case `ld --version < /dev/null 2>&1` in
       *GNU*)
-              cat <<END
+              cat <<END >&2
 
 NOTE: You are using GNU ld(1).  GNU ld(1) will not build Perl.
 You must arrange to use /usr/ccs/bin, perhaps by adding it to the
index 0b9dd11..d751e63 100644 (file)
@@ -104,7 +104,7 @@ do
     do
        [ -d "$sde_path/$sde" ] && break 2
     done
-    cat <<END
+    cat <<END >&2
 
 NOTE:  I can't figure out what SDE is used by default on this machine (I
 didn't find a likely directory under $sde_path).  This is bad news.  If
index c8dec8a..3d3145d 100644 (file)
@@ -19,7 +19,7 @@ if test "$osvers" = "3.0"; then
        d_gconvert='undef'
        grep 'define[   ]*AF_OSI[       ]' /usr/include/sys/socket.h | grep '/\*[^*]*$' >/tmp/esix$$
        if test -s /tmp/esix$$; then
-               cat <<EOM
+               cat <<EOM >&2
 
 WARNING: You are likely to have problems compiling the Socket extension
 unless you fix the unterminated comment for AF_OSI in the file
@@ -30,7 +30,7 @@ EOM
        rm -f /tmp/esix$$
 fi
 
-cat <<'EOM'
+cat <<'EOM' >&4
 
 If you wish to use dynamic linking, you must use 
        LD_LIBRARY_PATH=`pwd`; export LD_LIBRARY_PATH
index 4d2ba22..4b7653a 100644 (file)
@@ -97,7 +97,7 @@ esac
 # Configure should test for this.  Volunteers?
 pp_sys_cflags='ccflags="$ccflags -DHAS_TELLDIR_PROTOTYPE"'
 
-cat <<'EOM'
+cat <<'EOM' >&4
 
 Some users have reported that Configure halts when testing for
 the O_NONBLOCK symbol with a syntax error.  This is apparently a
index 695ae6e..2e8b16c 100644 (file)
@@ -1,3 +1,4 @@
+#! /local/gnu/bin/bash
 # hints/hpux.sh
 # Perl Configure hints file for Hewlett Packard HP-UX 9.x and 10.x
 # This file is based on 
@@ -8,14 +9,19 @@
 # hints/hpux_10.sh, Perl Configure hints file for Hewlett Packard HP-UX 10.x
 # From: Giles Lean <giles@nemeton.com.au>
 
-# This version: December 27, 1996
+# This version: March 21, 1997
 # Current maintainer: Jeff Okamoto <okamoto@corp.hp.com>
 
+#--------------------------------------------------------------------
 # Use Configure -Dcc=gcc to use gcc.
 # Use Configure -Dprefix=/usr/local to install in /usr/local.
-
+#
 # Some users have reported problems with dynamic loading if the 
 # environment variable LDOPTS='-a archive' .
+#
+# If you get a message about "too much defining", you might have to
+# add the following to your ccflags: '-Wp,-H256000'
+#--------------------------------------------------------------------
 
 # Turn on the _HPUX_SOURCE flag to get many of the HP add-ons
 ccflags="$ccflags -D_HPUX_SOURCE"
@@ -32,7 +38,7 @@ case "$cc" in
     then
        case "$usedl" in
         '') usedl="$undef"
-            cat <<'EOM'
+            cat <<'EOM' >&4
 
 The bundled C compiler can not produce shared libraries, so you will
 not be able to use dynamic loading. 
@@ -66,7 +72,7 @@ then
        then
                archname='PA-RISC2'
        else
-               echo "This 10.0 system is of a PA-RISC type I don't recognize."
+               echo "This 10.0 system is of a PA-RISC type I don't recognize." >&2
                echo "Debugging output: $xxcontext"
                archname=''
        fi
@@ -83,7 +89,7 @@ else
        then
                archname='HP-MC68K'
        else
-               echo "I cannot recognize what chip set this system is using."
+               echo "I cannot recognize what chip set this system is using." >&2
                echo "Debugging output: $xxcontext"
                archname=''
        fi
index a5d08e0..f5883f3 100644 (file)
@@ -17,7 +17,7 @@ esac
 # I don't know if they affect versions of perl other than 5.000 or
 # versions of IRIX other than 4.0.4.
 #
-cat <<'EOM'
+cat <<'EOM' >&4
 If you have problems, you might have try including
        -DSTANDARD_C -cckr 
 in ccflags.
index 7ed058e..bc0b7e8 100644 (file)
@@ -6,7 +6,7 @@ glibpth="/usr/lib/cmplrs/cc $glibpth"
 groupstype=int
 nm_opt='-B'
 case $PATH in
-*bsd*:/bin:*) cat <<END
+*bsd*:/bin:*) cat <<END >&4
 NOTE:  Some people have reported having much better luck with Mips CC than
 with the BSD cc.  Put /bin first in your PATH if you have difficulties.
 END
index 080829b..b8cc2c2 100644 (file)
@@ -6,15 +6,15 @@
 # <klwhite@magnus.acs.ohio-state.edu>, based on suggestions by Andreas
 # Koenig and Andy Dougherty.
 
-echo With NS 3.0 you won\'t be able to use the POSIX module.
-echo Be aware that some of the tests that are run during "make test"
-echo will fail due to the lack of POSIX support on this system.
-echo
-echo Also, if you have the GDBM installed, make sure the header file
-echo is located at a place on the system where the C compiler will
-echo find it.  By default, it is placed in /usr/local/include/gdbm.h.
-echo It will not be found there.  Try moving it to
-echo /NextDeveloper/Headers/bsd/gdbm.h.
+echo With NS 3.0 you won\'t be able to use the POSIX module.           >&4
+echo Be aware that some of the tests that are run during \"make test\" >&4
+echo will fail due to the lack of POSIX support on this system.                >&4
+echo                                                                   >&4
+echo Also, if you have the GDBM installed, make sure the header file   >&4
+echo is located at a place on the system where the C compiler will     >&4
+echo find it.  By default, it is placed in /usr/local/include/gdbm.h.  >&4
+echo It will not be found there.  Try moving it to                     >&4
+echo /NextDeveloper/Headers/bsd/gdbm.h.                                        >&4
 
 ccflags='-DUSE_NEXT_CTYPE -DNEXT30_NO_ATTRIBUTE'
 POSIX_cflags='ccflags="-posix $ccflags"'
index 70e478b..c442a08 100644 (file)
@@ -30,7 +30,7 @@ cc='gcc'
 usrinc='/emx/include'
 libemx="`../UU/loc . X c:/emx/lib d:/emx/lib e:/emx/lib f:/emx/lib g:/emx/lib h:/emx/lib /emx/lib`"
 
-if test "$libemx" = "X"; then echo "Cannot find C library!"; fi
+if test "$libemx" = "X"; then echo "Cannot find C library!" >&2; fi
 
 # Acute backslashitis:
 libpth="`echo \"$LIBRARY_PATH\" | tr ';\\\' ' /'`"
index e0ce55c..9334c94 100644 (file)
@@ -120,7 +120,7 @@ selecttype='fd_set *'
 libswanted="$libswanted unix"
 
 if [ -z "`which ar 2>/dev/null`" ]; then
-  cat <<-'EOF'
+  cat <<-'EOF' >&4
        I don't see an 'ar', so I'm guessing you are running
        Watcom 9.5 or earlier. You may want to install the ar
        cover found in the qnx subdirectory of this distribution.
@@ -158,7 +158,7 @@ fi
 
 cppstdin=`which cpp 2>/dev/null`
 if [ -n "$cppstdin" ]; then
-  cat <<-EOF
+  cat <<-EOF >&4
        I found a cpp at $cppstdin and will assume it is a good
        thing to use. If this proves to be false, there is a
        thin cover for cpp in the qnx subdirectory of this
@@ -166,7 +166,7 @@ if [ -n "$cppstdin" ]; then
        EOF
   cpprun="$cppstdin"
 else
-  cat <<-EOF
+  cat <<-EOF >&4
        
        There is a cpp cover in the qnx subdirectory of this
        distribution which works a little better than the
index 10baafd..6d398fc 100644 (file)
@@ -1,3 +1,3 @@
 yacc='/usr/bin/yacc -Sm25000'
-echo "NOTE: you may have problems due to a spurious semicolon on the strerror()"
-echo "macro definition in /usr/include/string.h.  If so, delete the semicolon."
+echo "NOTE: you may have problems due to a spurious semicolon on the strerror()" >&4
+echo "macro definition in /usr/include/string.h.  If so, delete the semicolon."  >&4
index 84f5817..34bcada 100644 (file)
@@ -1,5 +1,5 @@
 yacc='/usr/bin/yacc -Sm25000'
 ccflags="$ccflags -UM_I86"
 usemymalloc='y'
-echo "NOTE: you may have problems due to a spurious semicolon on the strerror()"
-echo "macro definition in /usr/include/string.h.  If so, delete the semicolon."
+echo "NOTE: you may have problems due to a spurious semicolon on the strerror()" >&4
+echo "macro definition in /usr/include/string.h.  If so, delete the semicolon."  >&4
index 255811f..89dde01 100644 (file)
@@ -47,7 +47,7 @@ esac
 # Here's another draft of the perl5/solaris/gcc sanity-checker. 
 
 case $PATH in
-*/usr/ucb*:/usr/bin:*|*/usr/ucb*:/usr/bin) cat <<END
+*/usr/ucb*:/usr/bin:*|*/usr/ucb*:/usr/bin) cat <<END >&4
 
 NOTE:  Some people have reported problems with /usr/ucb/cc.  
 Remove /usr/ucb from your PATH if you have difficulties.
@@ -63,7 +63,7 @@ esac
 case $? in
 0) ;;
 *)
-       cat <<END
+       cat <<END >&4
 
 NOTE: Your system does not have /dev/fd mounted.  If you want to
 be able to use set-uid scripts you must ask your system administrator
@@ -79,7 +79,7 @@ esac
 /usr/bin/ls /usr/lib/libucb* >/dev/null 2>&1
 case $? in
 0)
-       cat <<END
+       cat <<END >&4
 
 NOTE: libucb has been found in /usr/lib.  libucb should reside in
 /usr/ucblib.  You may have trouble while building Perl extensions.
@@ -96,7 +96,7 @@ if grep GNU make.vers > /dev/null 2>&1; then
     tmp=`/usr/bin/which make`
     case "`/usr/bin/ls -l $tmp`" in
     ??????s*)
-           cat <<END
+           cat <<END >&2
        
 NOTE: Your PATH points to GNU make, and your GNU make has the set-group-id
 bit set.  You must either rearrange your PATH to put /usr/ccs/bin before the
@@ -137,7 +137,7 @@ case "`${cc:-cc} -v 2>&1`" in
        case $verbose in
        */usr/ccs/bin/as*) ;;
        *)
-           cat <<END
+           cat <<END >&2
 
 NOTE: You are using GNU as(1).  GNU as(1) will not build Perl.
 You must arrange to use /usr/ccs/bin/as, perhaps by setting
@@ -152,7 +152,7 @@ END
        case $verbose in
        */usr/ccs/bin/ld*) ;;
        *)
-           cat <<END
+           cat <<END >&2
 
 NOTE: You are using GNU ld(1).  GNU ld(1) will not build Perl.
 You must arrange to use /usr/ccs/bin/ld, perhaps by setting
@@ -172,7 +172,7 @@ END
        # See if as(1) is GNU as(1).  GNU as(1) won't work for this job.
        case `as --version < /dev/null 2>&1` in
        *GNU*)
-               cat <<END
+               cat <<END >&2
 
 NOTE: You are using GNU as(1).  GNU as(1) will not build Perl.
 You must arrange to use /usr/ccs/bin, perhaps by adding it to the
@@ -201,7 +201,7 @@ END
                esac
        fi
        if $gnu_ld ; then
-               cat <<END
+               cat <<END >&2
 
 NOTE: You are using GNU ld(1).  GNU ld(1) will not build Perl.
 You must arrange to use /usr/ccs/bin, perhaps by adding it to the
index d3c4a39..d8d2063 100644 (file)
@@ -22,7 +22,7 @@ esac
 # Then run "sh5 Configure.sh5 [your options]"
 
 case "$myuname" in
-*risc*) cat <<EOF
+*risc*) cat <<EOF >&4
 Note that there is a bug in some versions of NFS on the DECStation that
 may cause utime() to work incorrectly.  If so, regression test io/fs
 may fail if run under NFS.  Ignore the failure.
index ebc7809..95a31fd 100644 (file)
@@ -6,7 +6,7 @@ ccflags="$ccflags -X18"
 
 usemymalloc='y'
 
-echo " "
-echo "NOTE: You may have to take out makefile dependencies on the files in"
-echo "/usr/include (i.e. /usr/include/ctype.h) or the make will fail.  A"
-echo "simple 'grep -v /usr/include/ makefile' should suffice."
+echo " "                                                                   >&4
+echo "NOTE: You may have to take out makefile dependencies on the files in" >&4
+echo "/usr/include (i.e. /usr/include/ctype.h) or the make will fail.  A"   >&4
+echo "simple 'grep -v /usr/include/ makefile' should suffice."             >&4
diff --git a/hv.c b/hv.c
index cb2b8fe..f63dff8 100644 (file)
--- a/hv.c
+++ b/hv.c
@@ -426,7 +426,7 @@ I32 flags;
        if (entry == xhv->xhv_eiter)
            HvLAZYDEL_on(hv);
        else
-           he_free(hv, entry);
+           hv_free_ent(hv, entry);
        --xhv->xhv_keys;
        return sv;
     }
@@ -488,7 +488,7 @@ U32 hash;
        if (entry == xhv->xhv_eiter)
            HvLAZYDEL_on(hv);
        else
-           he_free(hv, entry);
+           hv_free_ent(hv, entry);
        --xhv->xhv_keys;
        return sv;
     }
@@ -749,45 +749,45 @@ newHV()
 }
 
 void
-he_free(hv, hent)
+hv_free_ent(hv, entry)
 HV *hv;
-register HE *hent;
+register HE *entry;
 {
-    if (!hent)
+    if (!entry)
        return;
-    if (isGV(HeVAL(hent)) && GvCVu(HeVAL(hent)) && HvNAME(hv))
+    if (isGV(HeVAL(entry)) && GvCVu(HeVAL(entry)) && HvNAME(hv))
        sub_generation++;       /* may be deletion of method from stash */
-    SvREFCNT_dec(HeVAL(hent));
-    if (HeKLEN(hent) == HEf_SVKEY) {
-       SvREFCNT_dec(HeKEY_sv(hent));
-        Safefree(HeKEY_hek(hent));
+    SvREFCNT_dec(HeVAL(entry));
+    if (HeKLEN(entry) == HEf_SVKEY) {
+       SvREFCNT_dec(HeKEY_sv(entry));
+        Safefree(HeKEY_hek(entry));
     }
     else if (HvSHAREKEYS(hv))
-       unshare_hek(HeKEY_hek(hent));
+       unshare_hek(HeKEY_hek(entry));
     else
-       Safefree(HeKEY_hek(hent));
-    del_he(hent);
+       Safefree(HeKEY_hek(entry));
+    del_he(entry);
 }
 
 void
-he_delayfree(hv, hent)
+hv_delayfree_ent(hv, entry)
 HV *hv;
-register HE *hent;
+register HE *entry;
 {
-    if (!hent)
+    if (!entry)
        return;
-    if (isGV(HeVAL(hent)) && GvCVu(HeVAL(hent)) && HvNAME(hv))
+    if (isGV(HeVAL(entry)) && GvCVu(HeVAL(entry)) && HvNAME(hv))
        sub_generation++;       /* may be deletion of method from stash */
-    sv_2mortal(HeVAL(hent));   /* free between statements */
-    if (HeKLEN(hent) == HEf_SVKEY) {
-       sv_2mortal(HeKEY_sv(hent));
-       Safefree(HeKEY_hek(hent));
+    sv_2mortal(HeVAL(entry));  /* free between statements */
+    if (HeKLEN(entry) == HEf_SVKEY) {
+       sv_2mortal(HeKEY_sv(entry));
+       Safefree(HeKEY_hek(entry));
     }
     else if (HvSHAREKEYS(hv))
-       unshare_hek(HeKEY_hek(hent));
+       unshare_hek(HeKEY_hek(entry));
     else
-       Safefree(HeKEY_hek(hent));
-    del_he(hent);
+       Safefree(HeKEY_hek(entry));
+    del_he(entry);
 }
 
 void
@@ -813,8 +813,8 @@ hfreeentries(hv)
 HV *hv;
 {
     register HE **array;
-    register HE *hent;
-    register HE *ohent = Null(HE*);
+    register HE *entry;
+    register HE *oentry = Null(HE*);
     I32 riter;
     I32 max;
 
@@ -826,17 +826,17 @@ HV *hv;
     riter = 0;
     max = HvMAX(hv);
     array = HvARRAY(hv);
-    hent = array[0];
+    entry = array[0];
     for (;;) {
-       if (hent) {
-           ohent = hent;
-           hent = HeNEXT(hent);
-           he_free(hv, ohent);
+       if (entry) {
+           oentry = entry;
+           entry = HeNEXT(entry);
+           hv_free_ent(hv, oentry);
        }
-       if (!hent) {
+       if (!entry) {
            if (++riter > max)
                break;
-           hent = array[riter];
+           entry = array[riter];
        } 
     }
     (void)hv_iterinit(hv);
@@ -882,7 +882,7 @@ HV *hv;
 #endif
     if (entry && HvLAZYDEL(hv)) {      /* was deleted earlier? */
        HvLAZYDEL_off(hv);
-       he_free(hv, entry);
+       hv_free_ent(hv, entry);
     }
     xhv->xhv_riter = -1;
     xhv->xhv_eiter = Null(HE*);
@@ -949,7 +949,7 @@ HV *hv;
 
     if (oldentry && HvLAZYDEL(hv)) {           /* was deleted earlier? */
        HvLAZYDEL_off(hv);
-       he_free(hv, oldentry);
+       hv_free_ent(hv, oldentry);
     }
 
     xhv->xhv_eiter = entry;
index 600a681..c97feba 100755 (executable)
@@ -186,7 +186,7 @@ next unless -e $name;
 chmod 0777, $name if $^O eq 'os2';
 print STDERR "  unlink $name\n";
 ( CORE::unlink($name) and ++$cnt 
-    or warn "Couldn't unlink $name: $!\n" ) unless $nonono;
+    or warn "Couldn't unlink $name: $!\n" ) unless $notify;
     }
     return $cnt;
 }
index 1267f49..764a6f9 100755 (executable)
@@ -1,15 +1,21 @@
 #!./perl
-BEGIN { @INC=('./lib', '../lib') }
+
+BEGIN {
+    require 5.003_90;
+    @INC = 'lib';
+    $ENV{PERL5LIB} = 'lib';
+}
+
 use File::Find;
 use File::Compare;
+use File::Copy ();
 use File::Path ();
 use Config;
 use subs qw(unlink rename link chmod);
 
 # override the ones in the rest of the script
-sub mkpath
-{
-  File::Path::mkpath(@_) unless $nonono;
+sub mkpath {
+    File::Path::mkpath(@_) unless $nonono;
 }
 
 $mainperldir = "/usr/bin";
@@ -80,14 +86,14 @@ if ($d_dosuid && $>) { die "You must run as root to install suidperl\n"; }
 
 # First we install the version-numbered executables.
 
-&safe_unlink("$installbin/perl$ver$exe_ext");
-&cmd("cp perl$exe_ext $installbin/perl$ver$exe_ext");
-&chmod(0755, "$installbin/perl$ver$exe_ext");
+safe_unlink("$installbin/perl$ver$exe_ext");
+copy("perl$exe_ext", "$installbin/perl$ver$exe_ext");
+chmod(0755, "$installbin/perl$ver$exe_ext");
 
-&safe_unlink("$installbin/sperl$ver$exe_ext");
+safe_unlink("$installbin/sperl$ver$exe_ext");
 if ($d_dosuid) {
-    &cmd("cp suidperl$exe_ext $installbin/sperl$ver$exe_ext");
-    &chmod(04711, "$installbin/sperl$ver$exe_ext");
+    copy("suidperl$exe_ext", "$installbin/sperl$ver$exe_ext");
+    chmod(04711, "$installbin/sperl$ver$exe_ext");
 }
 
 # Install library files.
@@ -100,8 +106,8 @@ mkpath($installsitelib, 1, 0777) if ($installsitelib);
 mkpath($installsitearch, 1, 0777) if ($installsitearch);
 
 if (chdir "lib") {
-    $do_installarchlib = ! &samepath($installarchlib, '.');
-    $do_installprivlib = ! &samepath($installprivlib, '.');
+    $do_installarchlib = ! samepath($installarchlib, '.');
+    $do_installprivlib = ! samepath($installprivlib, '.');
     $do_installprivlib = 0 if $versiononly && !($installprivlib =~ m/\Q$]/);
 
     if ($do_installarchlib || $do_installprivlib) {
@@ -123,8 +129,8 @@ push(@corefiles,'sperl.o') if -f 'sperl.o';
 foreach $file (@corefiles) {
     # HP-UX (at least) needs to maintain execute permissions
     # on dynamically-loaded libraries.
-    cp_if_diff($file,"$installarchlib/CORE/$file")
-       and &chmod($file =~ /^\.(so|$dlext)$/ ? 0555 : 0444,
+    copy_if_diff($file,"$installarchlib/CORE/$file")
+       and chmod($file =~ /^\.(so|$dlext)$/ ? 0555 : 0444,
                   "$installarchlib/CORE/$file");
 }
 
@@ -133,7 +139,7 @@ foreach $file (@corefiles) {
 $mainperl_is_instperl = 0;
 
 if (!$versiononly && !$nonono && -t STDIN && -t STDERR
-       && -w $mainperldir && ! &samepath($mainperldir, $installbin)) {
+       && -w $mainperldir && ! samepath($mainperldir, $installbin)) {
     local($usrbinperl) = "$mainperldir/perl$exe_ext";
     local($instperl)   = "$installbin/perl$exe_ext";
     local($expinstperl)        = "$binexp/perl$exe_ext";
@@ -144,48 +150,48 @@ if (!$versiononly && !$nonono && -t STDIN && -t STDERR
        # Try to be clever about mainperl being a symbolic link
        # to binexp/perl if binexp and installbin are different.
        $mainperl_is_instperl =
-           &samepath($usrbinperl, $instperl) ||
-           &samepath($usrbinperl, $expinstperl) ||
+           samepath($usrbinperl, $instperl) ||
+           samepath($usrbinperl, $expinstperl) ||
             (($binexp ne $installbin) &&
              (-l $usrbinperl) &&
              ((readlink $usrbinperl) eq $expinstperl));
     }
     if ((! $mainperl_is_instperl) &&
-       (&yn("Many scripts expect perl to be installed as $usrbinperl.\n" . 
+       (yn("Many scripts expect perl to be installed as $usrbinperl.\n" . 
             "Do you wish to have $usrbinperl be the same as\n" .
             "$expinstperl? [y] ")))
     {  
        unlink($usrbinperl);
        eval { CORE::link $instperl, $usrbinperl } ||
            eval { symlink $expinstperl, $usrbinperl } ||
-               cmd("cp $instperl $usrbinperl");
+               copy($instperl, $usrbinperl);
        $mainperl_is_instperl = 1;
     }
 }
 
 # Make links to ordinary names if installbin directory isn't current directory.
 
-if (! $versiononly && ! &samepath($installbin, '.')) {
-    &safe_unlink("$installbin/perl$exe_ext", "$installbin/suidperl$exe_ext");
-    &link("$installbin/perl$ver$exe_ext", "$installbin/perl$exe_ext");
-    &link("$installbin/sperl$ver$exe_ext", "$installbin/suidperl$exe_ext") 
+if (! $versiononly && ! samepath($installbin, '.')) {
+    safe_unlink("$installbin/perl$exe_ext", "$installbin/suidperl$exe_ext");
+    link("$installbin/perl$ver$exe_ext", "$installbin/perl$exe_ext");
+    link("$installbin/sperl$ver$exe_ext", "$installbin/suidperl$exe_ext") 
       if $d_dosuid;
 }
 
-if (!$versiononly && ! &samepath($installbin, 'x2p')) {
-    &safe_unlink("$installbin/a2p$exe_ext");
-    &cmd("cp x2p/a2p$exe_ext $installbin/a2p$exe_ext");
-    &chmod(0755, "$installbin/a2p$exe_ext");
+if (!$versiononly && ! samepath($installbin, 'x2p')) {
+    safe_unlink("$installbin/a2p$exe_ext");
+    copy("x2p/a2p$exe_ext", "$installbin/a2p$exe_ext");
+    chmod(0755, "$installbin/a2p$exe_ext");
 }
 
 # cppstdin is just a script, but it is architecture-dependent, so
 # it can't safely be shared.  Place it in $installbin.
 # Note that Configure doesn't build cppstin if it isn't needed, so
 # we skip this if cppstdin doesn't exist.
-if (! $versiononly && (-f cppstdin) && (! &samepath($installbin, '.'))) {
-    &safe_unlink("$installbin/cppstdin");
-    &cmd("cp cppstdin $installbin/cppstdin");
-    &chmod(0755, "$installbin/cppstdin");
+if (! $versiononly && (-f 'cppstdin') && (! samepath($installbin, '.'))) {
+    safe_unlink("$installbin/cppstdin");
+    copy("cppstdin", "$installbin/cppstdin");
+    chmod(0755, "$installbin/cppstdin");
 }
 
 # Install scripts.
@@ -194,25 +200,26 @@ mkpath($installscript, 1, 0777);
 
 if (! $versiononly) {
     for (@scripts) {
-        &cmd("cp $_ $installscript");
-        s#.*/##; &chmod(0755, "$installscript/$_");
+       (my $base = $_) =~ s#.*/##;
+       copy($_, "$installscript/$base");
+       chmod(0755, "$installscript/$base");
     }
 }
 
 # pstruct should be a link to c2ph
 
 if (! $versiononly) {
-    &safe_unlink("$installscript/pstruct");
-    &link("$installscript/c2ph","$installscript/pstruct");
+    safe_unlink("$installscript/pstruct");
+    link("$installscript/c2ph","$installscript/pstruct");
 }
 
 # Install pod pages.  Where? I guess in $installprivlib/pod.
 
-if (! $versiononly && !($installprivlib =~ m/\Q$]/)) {
+if (! $versiononly || !($installprivlib =~ m/\Q$]/)) {
     mkpath("${installprivlib}/pod", 1, 0777);
     foreach $file (@pods) {
        # $file is a name like  pod/perl.pod
-       cp_if_diff($file, "${installprivlib}/${file}");
+       copy_if_diff($file, "${installprivlib}/${file}");
     }
 }
 
@@ -232,8 +239,8 @@ if (!$versiononly) {
        next unless m,^/,;
        # Use &samepath here because some systems have other dirs linked
        # to $mainperldir (like SunOS)
-       next if &samepath($_, $binexp);
-       next if ($mainperl_is_instperl && &samepath($_, $mainperldir));
+       next if samepath($_, $binexp);
+       next if ($mainperl_is_instperl && samepath($_, $mainperldir));
        push(@otherperls, "$_/perl$exe_ext")
            if (-x "$_/perl$exe_ext" && ! -d "$_/perl$exe_ext");
     }
@@ -279,32 +286,23 @@ sub unlink {
 }
 
 sub safe_unlink {
-    local(@names) = @_;
-
+    return if $nonono;
+    local @names = @_;
     foreach $name (@names) {
        next unless -e $name;
-       next if $nonono;
        chmod 0777, $name if $^O eq 'os2';
        print STDERR "  unlink $name\n";
        next if CORE::unlink($name);
        warn "Couldn't unlink $name: $!\n";
        if ($! =~ /busy/i) {
            print STDERR "  mv $name $name.old\n";
-           &rename($name, "$name.old") || warn "Couldn't rename $name: $!\n";
+           safe_rename($name, "$name.old")
+               or warn "Couldn't rename $name: $!\n";
        }
     }
 }
 
-sub cmd {
-    local($cmd) = @_;
-    print STDERR "  $cmd\n";
-    unless ($nonono) {
-       system $cmd;
-       warn "Command failed!!!\n" if $?;
-    }
-}
-
-sub rename {
+sub safe_rename {
     local($from,$to) = @_;
     if (-f $to and not unlink($to)) {
        my($i);
@@ -324,11 +322,16 @@ sub link {
 
     print STDERR "  ln $from $to\n";
     eval {
-      CORE::link($from,$to) ? $success++ : warn "Couldn't link $from to $to: $!\n" unless $nonono;
+       CORE::link($from, $to)
+           ? $success++
+           : warn "Couldn't link $from to $to: $!\n"
+         unless $nonono;
     };
     if ($@) {
-      system( $cp, $from, $to )==0 ? $success++ :
-       warn "Couldn't copy $from to $to: $!\n" unless $nonono;
+       File::Copy::copy($from, $to)
+           ? $success++
+           : warn "Couldn't copy $from to $to: $!\n"
+         unless $nonono;
     }
     $success;
 }
@@ -337,8 +340,18 @@ sub chmod {
     local($mode,$name) = @_;
 
     printf STDERR "  chmod %o %s\n", $mode, $name;
-    CORE::chmod($mode,$name) || warn sprintf("Couldn't chmod %o %s: $!\n",$mode,$name)
-       unless $nonono;
+    CORE::chmod($mode,$name)
+       || warn sprintf("Couldn't chmod %o %s: $!\n", $mode, $name)
+      unless $nonono;
+}
+
+sub copy {
+    my($from,$to) = @_;
+
+    print STDERR "  cp $from $to\n";
+    File::Copy::copy($from, $to)
+       || warn "Couldn't copy $from to $to: $!\n"
+      unless $nonono;
 }
 
 sub samepath {
@@ -383,15 +396,15 @@ sub installlib {
            #but we have to delete old *.al and *.ix files from the 5.000
            #distribution:
            #This might not work because $archname might have changed.
-           &unlink("$installarchlib/$name");
+           unlink("$installarchlib/$name");
        }
        if (compare($_, "$installlib/$name") || $nonono) {
-           &unlink("$installlib/$name");
+           unlink("$installlib/$name");
            mkpath("$installlib/$dir", 1, 0777);
            # HP-UX (at least) needs to maintain execute permissions
            # on dynamically-loaded libraries.
-           cp_if_diff($_, "$installlib/$name")
-               and &chmod($name =~ /\.(so|$dlext)$/o ? 0555 : 0444,
+           copy_if_diff($_, "$installlib/$name")
+               and chmod($name =~ /\.(so|$dlext)$/o ? 0555 : 0444,
                           "$installlib/$name");
        }
     } elsif (-d $_) {
@@ -408,19 +421,19 @@ sub installlib {
 # get an error message to the effect that the symbol table is older
 # than the library.
 # Return true if copying occurred.
-sub cp_if_diff {
+
+sub copy_if_diff {
     my($from,$to)=@_;
     -f $from || die "$0: $from not found";
     if (compare($from, $to) || $nonono) {
-       my ($atime, $mtime);
-       unlink($to);   # In case we don't have write permissions.
+       safe_unlink($to);   # In case we don't have write permissions.
         if ($nonono) {
             $from = $depth . "/" . $from if $depth;
         }
-       cmd("cp $from $to");
-       # Restore timestamps if it's a .a library.
-       if ($to =~ /\.a$/ or $^O eq 'os2') {    # For binary install
-           ($atime, $mtime) = (stat $from)[8,9];
+       copy($from, $to);
+       # Restore timestamps if it's a .a library or for OS/2.
+       if (!$nonono && ($^O eq 'os2' || $to =~ /\.a$/)) {
+           my ($atime, $mtime) = (stat $from)[8,9];
            utime $atime, $mtime, $to;
        }
        1;
index 8cb2748..cd08665 100644 (file)
 #define KEY_NULL               0
-#define KEY___LINE__           1
-#define KEY___FILE__           2
-#define KEY___DATA__           3
-#define KEY___END__            4
-#define KEY_AUTOLOAD           5
-#define KEY_BEGIN              6
-#define KEY_CORE               7
-#define KEY_DESTROY            8
-#define KEY_END                        9
-#define KEY_EQ                 10
-#define KEY_GE                 11
-#define KEY_GT                 12
-#define KEY_LE                 13
-#define KEY_LT                 14
-#define KEY_NE                 15
-#define KEY_abs                        16
-#define KEY_accept             17
-#define KEY_alarm              18
-#define KEY_and                        19
-#define KEY_atan2              20
-#define KEY_bind               21
-#define KEY_binmode            22
-#define KEY_bless              23
-#define KEY_caller             24
-#define KEY_chdir              25
-#define KEY_chmod              26
-#define KEY_chomp              27
-#define KEY_chop               28
-#define KEY_chown              29
-#define KEY_chr                        30
-#define KEY_chroot             31
-#define KEY_close              32
-#define KEY_closedir           33
-#define KEY_cmp                        34
-#define KEY_connect            35
-#define KEY_continue           36
-#define KEY_cos                        37
-#define KEY_crypt              38
-#define KEY_dbmclose           39
-#define KEY_dbmopen            40
-#define KEY_defined            41
-#define KEY_delete             42
-#define KEY_die                        43
-#define KEY_do                 44
-#define KEY_dump               45
-#define KEY_each               46
-#define KEY_else               47
-#define KEY_elsif              48
-#define KEY_endgrent           49
-#define KEY_endhostent         50
-#define KEY_endnetent          51
-#define KEY_endprotoent                52
-#define KEY_endpwent           53
-#define KEY_endservent         54
-#define KEY_eof                        55
-#define KEY_eq                 56
-#define KEY_eval               57
-#define KEY_exec               58
-#define KEY_exists             59
-#define KEY_exit               60
-#define KEY_exp                        61
-#define KEY_fcntl              62
-#define KEY_fileno             63
-#define KEY_flock              64
-#define KEY_for                        65
-#define KEY_foreach            66
-#define KEY_fork               67
-#define KEY_format             68
-#define KEY_formline           69
-#define KEY_ge                 70
-#define KEY_getc               71
-#define KEY_getgrent           72
-#define KEY_getgrgid           73
-#define KEY_getgrnam           74
-#define KEY_gethostbyaddr      75
-#define KEY_gethostbyname      76
-#define KEY_gethostent         77
-#define KEY_getlogin           78
-#define KEY_getnetbyaddr       79
-#define KEY_getnetbyname       80
-#define KEY_getnetent          81
-#define KEY_getpeername                82
-#define KEY_getpgrp            83
-#define KEY_getppid            84
-#define KEY_getpriority                85
-#define KEY_getprotobyname     86
-#define KEY_getprotobynumber   87
-#define KEY_getprotoent                88
-#define KEY_getpwent           89
-#define KEY_getpwnam           90
-#define KEY_getpwuid           91
-#define KEY_getservbyname      92
-#define KEY_getservbyport      93
-#define KEY_getservent         94
-#define KEY_getsockname                95
-#define KEY_getsockopt         96
-#define KEY_glob               97
-#define KEY_gmtime             98
-#define KEY_goto               99
-#define KEY_grep               100
-#define KEY_gt                 101
-#define KEY_hex                        102
-#define KEY_if                 103
-#define KEY_index              104
-#define KEY_int                        105
-#define KEY_ioctl              106
-#define KEY_join               107
-#define KEY_keys               108
-#define KEY_kill               109
-#define KEY_last               110
-#define KEY_lc                 111
-#define KEY_lcfirst            112
-#define KEY_le                 113
-#define KEY_length             114
-#define KEY_link               115
-#define KEY_listen             116
-#define KEY_local              117
-#define KEY_localtime          118
-#define KEY_log                        119
-#define KEY_lstat              120
-#define KEY_lt                 121
-#define KEY_m                  122
-#define KEY_map                        123
-#define KEY_mkdir              124
-#define KEY_msgctl             125
-#define KEY_msgget             126
-#define KEY_msgrcv             127
-#define KEY_msgsnd             128
-#define KEY_my                 129
-#define KEY_ne                 130
-#define KEY_next               131
-#define KEY_no                 132
-#define KEY_not                        133
-#define KEY_oct                        134
-#define KEY_open               135
-#define KEY_opendir            136
-#define KEY_or                 137
-#define KEY_ord                        138
-#define KEY_pack               139
-#define KEY_package            140
-#define KEY_pipe               141
-#define KEY_pop                        142
-#define KEY_pos                        143
-#define KEY_print              144
-#define KEY_printf             145
-#define KEY_prototype          146
-#define KEY_push               147
-#define KEY_q                  148
-#define KEY_qq                 149
-#define KEY_quotemeta          150
-#define KEY_qw                 151
-#define KEY_qx                 152
-#define KEY_rand               153
-#define KEY_read               154
-#define KEY_readdir            155
-#define KEY_readline           156
-#define KEY_readlink           157
-#define KEY_readpipe           158
-#define KEY_recv               159
-#define KEY_redo               160
-#define KEY_ref                        161
-#define KEY_rename             162
-#define KEY_require            163
-#define KEY_reset              164
-#define KEY_return             165
-#define KEY_reverse            166
-#define KEY_rewinddir          167
-#define KEY_rindex             168
-#define KEY_rmdir              169
-#define KEY_s                  170
-#define KEY_scalar             171
-#define KEY_seek               172
-#define KEY_seekdir            173
-#define KEY_select             174
-#define KEY_semctl             175
-#define KEY_semget             176
-#define KEY_semop              177
-#define KEY_send               178
-#define KEY_setgrent           179
-#define KEY_sethostent         180
-#define KEY_setnetent          181
-#define KEY_setpgrp            182
-#define KEY_setpriority                183
-#define KEY_setprotoent                184
-#define KEY_setpwent           185
-#define KEY_setservent         186
-#define KEY_setsockopt         187
-#define KEY_shift              188
-#define KEY_shmctl             189
-#define KEY_shmget             190
-#define KEY_shmread            191
-#define KEY_shmwrite           192
-#define KEY_shutdown           193
-#define KEY_sin                        194
-#define KEY_sleep              195
-#define KEY_socket             196
-#define KEY_socketpair         197
-#define KEY_sort               198
-#define KEY_splice             199
-#define KEY_split              200
-#define KEY_sprintf            201
-#define KEY_sqrt               202
-#define KEY_srand              203
-#define KEY_stat               204
-#define KEY_study              205
-#define KEY_sub                        206
-#define KEY_substr             207
-#define KEY_symlink            208
-#define KEY_syscall            209
-#define KEY_sysopen            210
-#define KEY_sysread            211
-#define KEY_system             212
-#define KEY_syswrite           213
-#define KEY_tell               214
-#define KEY_telldir            215
-#define KEY_tie                        216
-#define KEY_tied               217
-#define KEY_time               218
-#define KEY_times              219
-#define KEY_tr                 220
-#define KEY_truncate           221
-#define KEY_uc                 222
-#define KEY_ucfirst            223
-#define KEY_umask              224
-#define KEY_undef              225
-#define KEY_unless             226
-#define KEY_unlink             227
-#define KEY_unpack             228
-#define KEY_unshift            229
-#define KEY_untie              230
-#define KEY_until              231
-#define KEY_use                        232
-#define KEY_utime              233
-#define KEY_values             234
-#define KEY_vec                        235
-#define KEY_wait               236
-#define KEY_waitpid            237
-#define KEY_wantarray          238
-#define KEY_warn               239
-#define KEY_while              240
-#define KEY_write              241
-#define KEY_x                  242
-#define KEY_xor                        243
-#define KEY_y                  244
+#define KEY___FILE__           1
+#define KEY___LINE__           2
+#define KEY___PACKAGE__                3
+#define KEY___DATA__           4
+#define KEY___END__            5
+#define KEY_AUTOLOAD           6
+#define KEY_BEGIN              7
+#define KEY_CORE               8
+#define KEY_DESTROY            9
+#define KEY_END                        10
+#define KEY_EQ                 11
+#define KEY_GE                 12
+#define KEY_GT                 13
+#define KEY_LE                 14
+#define KEY_LT                 15
+#define KEY_NE                 16
+#define KEY_abs                        17
+#define KEY_accept             18
+#define KEY_alarm              19
+#define KEY_and                        20
+#define KEY_atan2              21
+#define KEY_bind               22
+#define KEY_binmode            23
+#define KEY_bless              24
+#define KEY_caller             25
+#define KEY_chdir              26
+#define KEY_chmod              27
+#define KEY_chomp              28
+#define KEY_chop               29
+#define KEY_chown              30
+#define KEY_chr                        31
+#define KEY_chroot             32
+#define KEY_close              33
+#define KEY_closedir           34
+#define KEY_cmp                        35
+#define KEY_connect            36
+#define KEY_continue           37
+#define KEY_cos                        38
+#define KEY_crypt              39
+#define KEY_dbmclose           40
+#define KEY_dbmopen            41
+#define KEY_defined            42
+#define KEY_delete             43
+#define KEY_die                        44
+#define KEY_do                 45
+#define KEY_dump               46
+#define KEY_each               47
+#define KEY_else               48
+#define KEY_elsif              49
+#define KEY_endgrent           50
+#define KEY_endhostent         51
+#define KEY_endnetent          52
+#define KEY_endprotoent                53
+#define KEY_endpwent           54
+#define KEY_endservent         55
+#define KEY_eof                        56
+#define KEY_eq                 57
+#define KEY_eval               58
+#define KEY_exec               59
+#define KEY_exists             60
+#define KEY_exit               61
+#define KEY_exp                        62
+#define KEY_fcntl              63
+#define KEY_fileno             64
+#define KEY_flock              65
+#define KEY_for                        66
+#define KEY_foreach            67
+#define KEY_fork               68
+#define KEY_format             69
+#define KEY_formline           70
+#define KEY_ge                 71
+#define KEY_getc               72
+#define KEY_getgrent           73
+#define KEY_getgrgid           74
+#define KEY_getgrnam           75
+#define KEY_gethostbyaddr      76
+#define KEY_gethostbyname      77
+#define KEY_gethostent         78
+#define KEY_getlogin           79
+#define KEY_getnetbyaddr       80
+#define KEY_getnetbyname       81
+#define KEY_getnetent          82
+#define KEY_getpeername                83
+#define KEY_getpgrp            84
+#define KEY_getppid            85
+#define KEY_getpriority                86
+#define KEY_getprotobyname     87
+#define KEY_getprotobynumber   88
+#define KEY_getprotoent                89
+#define KEY_getpwent           90
+#define KEY_getpwnam           91
+#define KEY_getpwuid           92
+#define KEY_getservbyname      93
+#define KEY_getservbyport      94
+#define KEY_getservent         95
+#define KEY_getsockname                96
+#define KEY_getsockopt         97
+#define KEY_glob               98
+#define KEY_gmtime             99
+#define KEY_goto               100
+#define KEY_grep               101
+#define KEY_gt                 102
+#define KEY_hex                        103
+#define KEY_if                 104
+#define KEY_index              105
+#define KEY_int                        106
+#define KEY_ioctl              107
+#define KEY_join               108
+#define KEY_keys               109
+#define KEY_kill               110
+#define KEY_last               111
+#define KEY_lc                 112
+#define KEY_lcfirst            113
+#define KEY_le                 114
+#define KEY_length             115
+#define KEY_link               116
+#define KEY_listen             117
+#define KEY_local              118
+#define KEY_localtime          119
+#define KEY_log                        120
+#define KEY_lstat              121
+#define KEY_lt                 122
+#define KEY_m                  123
+#define KEY_map                        124
+#define KEY_mkdir              125
+#define KEY_msgctl             126
+#define KEY_msgget             127
+#define KEY_msgrcv             128
+#define KEY_msgsnd             129
+#define KEY_my                 130
+#define KEY_ne                 131
+#define KEY_next               132
+#define KEY_no                 133
+#define KEY_not                        134
+#define KEY_oct                        135
+#define KEY_open               136
+#define KEY_opendir            137
+#define KEY_or                 138
+#define KEY_ord                        139
+#define KEY_pack               140
+#define KEY_package            141
+#define KEY_pipe               142
+#define KEY_pop                        143
+#define KEY_pos                        144
+#define KEY_print              145
+#define KEY_printf             146
+#define KEY_prototype          147
+#define KEY_push               148
+#define KEY_q                  149
+#define KEY_qq                 150
+#define KEY_quotemeta          151
+#define KEY_qw                 152
+#define KEY_qx                 153
+#define KEY_rand               154
+#define KEY_read               155
+#define KEY_readdir            156
+#define KEY_readline           157
+#define KEY_readlink           158
+#define KEY_readpipe           159
+#define KEY_recv               160
+#define KEY_redo               161
+#define KEY_ref                        162
+#define KEY_rename             163
+#define KEY_require            164
+#define KEY_reset              165
+#define KEY_return             166
+#define KEY_reverse            167
+#define KEY_rewinddir          168
+#define KEY_rindex             169
+#define KEY_rmdir              170
+#define KEY_s                  171
+#define KEY_scalar             172
+#define KEY_seek               173
+#define KEY_seekdir            174
+#define KEY_select             175
+#define KEY_semctl             176
+#define KEY_semget             177
+#define KEY_semop              178
+#define KEY_send               179
+#define KEY_setgrent           180
+#define KEY_sethostent         181
+#define KEY_setnetent          182
+#define KEY_setpgrp            183
+#define KEY_setpriority                184
+#define KEY_setprotoent                185
+#define KEY_setpwent           186
+#define KEY_setservent         187
+#define KEY_setsockopt         188
+#define KEY_shift              189
+#define KEY_shmctl             190
+#define KEY_shmget             191
+#define KEY_shmread            192
+#define KEY_shmwrite           193
+#define KEY_shutdown           194
+#define KEY_sin                        195
+#define KEY_sleep              196
+#define KEY_socket             197
+#define KEY_socketpair         198
+#define KEY_sort               199
+#define KEY_splice             200
+#define KEY_split              201
+#define KEY_sprintf            202
+#define KEY_sqrt               203
+#define KEY_srand              204
+#define KEY_stat               205
+#define KEY_study              206
+#define KEY_sub                        207
+#define KEY_substr             208
+#define KEY_symlink            209
+#define KEY_syscall            210
+#define KEY_sysopen            211
+#define KEY_sysread            212
+#define KEY_system             213
+#define KEY_syswrite           214
+#define KEY_tell               215
+#define KEY_telldir            216
+#define KEY_tie                        217
+#define KEY_tied               218
+#define KEY_time               219
+#define KEY_times              220
+#define KEY_tr                 221
+#define KEY_truncate           222
+#define KEY_uc                 223
+#define KEY_ucfirst            224
+#define KEY_umask              225
+#define KEY_undef              226
+#define KEY_unless             227
+#define KEY_unlink             228
+#define KEY_unpack             229
+#define KEY_unshift            230
+#define KEY_untie              231
+#define KEY_until              232
+#define KEY_use                        233
+#define KEY_utime              234
+#define KEY_values             235
+#define KEY_vec                        236
+#define KEY_wait               237
+#define KEY_waitpid            238
+#define KEY_wantarray          239
+#define KEY_warn               240
+#define KEY_while              241
+#define KEY_write              242
+#define KEY_x                  243
+#define KEY_xor                        244
+#define KEY_y                  245
index 595e875..8920a3b 100755 (executable)
@@ -25,8 +25,9 @@ sub tab {
 __END__
 
 NULL
-__LINE__
 __FILE__
+__LINE__
+__PACKAGE__
 __DATA__
 __END__
 AUTOLOAD
index f7b8eee..ab634b2 100644 (file)
@@ -5,6 +5,7 @@ require Exporter;
 
 use Config;
 use Carp;
+use File::Path qw(mkpath);
 
 @ISA = qw(Exporter);
 @EXPORT = qw(&autosplit &autosplit_lib_modules);
@@ -154,12 +155,7 @@ sub autosplit_file{
        $filename = VMS::Filespec::unixify($filename); # may have dirs
     }
     unless (-d $autodir){
-       local($", @p)="/";
-       foreach(split(/\//,$autodir)){
-           push(@p, $_);
-           next if -d "@p/";
-           mkdir("@p",0755) or die "AutoSplit unable to mkdir @p: $!";
-       }
+       mkpath($autodir,0,0755);
        # We should never need to create the auto dir here. installperl
        # (or similar) should have done it. Expecting it to exist is a valuable
        # sanity check against autosplitting into some random directory by mistake.
@@ -193,14 +189,20 @@ sub autosplit_file{
 
     $package or die "Can't find 'package Name;' in $filename\n";
 
-    my($modpname) = $package; $modpname =~ s#::#/#g;
-    my($al_idx_file) = "$autodir/$modpname/$IndexFile";
+    my($modpname) = $package; 
+    if ($^O eq 'MSWin32') {
+       $modpname =~ s#::#\\#g; 
+    } else {
+       $modpname =~ s#::#/#g;
+    }
 
-    die "Package $package does not match filename $filename"
-           unless ($filename =~ m/$modpname.pm$/ or
+    die "Package $package ($modpname.pm) does not match filename $filename"
+           unless ($filename =~ m/\Q$modpname.pm\E$/ or
                    ($^O eq "msdos") or
                    $Is_VMS && $filename =~ m/$modpname.pm/i);
 
+    my($al_idx_file) = "$autodir/$modpname/$IndexFile";
+
     if ($check_mod_time){
        my($al_ts_time) = (stat("$al_idx_file"))[9] || 1;
        if ($al_ts_time >= $pm_mod_time){
@@ -215,12 +217,7 @@ sub autosplit_file{
        if $Verbose;
 
     unless (-d "$autodir/$modpname"){
-       local($", @p)="/";
-       foreach(split(/\//,"$autodir/$modpname")){
-           push(@p, $_);
-           next if -d "@p/";
-           mkdir("@p",0777) or die "AutoSplit unable to mkdir @p: $!";
-       }
+       mkpath("$autodir/$modpname",0,0777);
     }
 
     # We must try to deal with some SVR3 systems with a limit of 14
index ec08d30..c0cfe08 100644 (file)
@@ -68,9 +68,16 @@ sub longmess {
              }
              for (@a) {
                $_ = "undef", next unless defined $_;
-               s/'/\\'/g;
-               substr($_,$MaxArgLen) = '...' if $MaxArgLen and $MaxArgLen < length;
-               s/([^\0]*)/'$1'/ unless /^-?[\d.]+$/;
+               if (ref $_) {
+                 $_ .= '';
+                 s/'/\\'/g;
+               }
+               else {
+                 s/'/\\'/g;
+                 substr($_,$MaxArgLen) = '...'
+                   if $MaxArgLen and $MaxArgLen < length;
+               }
+               $_ = "'$_'" unless /^-?[\d.]+$/;
                s/([\200-\377])/sprintf("M-%c",ord($1)&0177)/eg;
                s/([\0-\37\177])/sprintf("^%c",ord($1)^64)/eg;
              }
@@ -81,7 +88,10 @@ sub longmess {
        }
        $error = "called";
     }
-    $mess || $error;
+    # this kludge circumvents die's incorrect handling of NUL
+    my $msg = \($mess || $error);
+    $$msg =~ tr/\0//d;
+    $$msg;
 }
 
 sub shortmess {        # Short-circuit &longmess if called via multiple packages
@@ -113,7 +123,9 @@ sub shortmess {     # Short-circuit &longmess if called via multiple packages
                if(defined @{$pack . "::ISA"});
        }
        else {
-           return "$error at $file line $line\n";
+           # this kludge circumvents die's incorrect handling of NUL
+           (my $msg = "$error at $file line $line\n") =~ tr/\0//d;
+           return $msg;
        }
     }
     continue {
index e93cf1a..f924a59 100644 (file)
@@ -230,6 +230,7 @@ sub chdir {
 sub _vms_cwd {
     return $ENV{'DEFAULT'}
 }
+
 sub _os2_cwd {
     $ENV{'PWD'} = `cmd /c cd`;
     chop $ENV{'PWD'};
@@ -237,6 +238,8 @@ sub _os2_cwd {
     return $ENV{'PWD'};
 }
 
+*_NT_cwd = \&_os2_cwd unless defined &_NT_cwd;
+
 sub _msdos_cwd {
     $ENV{'PWD'} = `command /c cd`;
     chop $ENV{'PWD'};
@@ -255,6 +258,7 @@ sub _msdos_cwd {
     }
     elsif ($^O eq 'NT' or $^O eq 'MSWin32') {
         # We assume that &_NT_cwd is defined as an XSUB or in the core.
+        *cwd        = \&_NT_cwd;
         *getcwd     = \&_NT_cwd;
         *fastcwd    = \&_NT_cwd;
         *fastgetcwd = \&_NT_cwd;
index abdb1e7..7b03732 100644 (file)
@@ -2,21 +2,31 @@ package Exporter;
 
 require 5.001;
 
+#
+# We go to a lot of trouble not to 'require Carp' at file scope,
+#  because Carp requires Exporter, and something has to give.
+#
+
 $ExportLevel = 0;
 $Verbose = 0 unless $Verbose;
 
-require Carp;
-
 sub export {
 
     # First make import warnings look like they're coming from the "use".
     local $SIG{__WARN__} = sub {
        my $text = shift;
-       $text =~ s/ at \S*Exporter.pm line \d+.*\n//;
-       local $Carp::CarpLevel = 1;     # ignore package calling us too.
-       Carp::carp($text);
+       if ($text =~ s/ at \S*Exporter.pm line \d+.*\n//) {
+           require Carp;
+           local $Carp::CarpLevel = 1; # ignore package calling us too.
+           Carp::carp($text);
+       }
+       else {
+           warn $text;
+       }
     };
     local $SIG{__DIE__} = sub {
+       require Carp;
+       local $Carp::CarpLevel = 1;     # ignore package calling us too.
        Carp::croak("$_[0]Illegal null symbol in \@${1}::EXPORT")
            if $_[0] =~ /^Unable to create sub named "(.*?)::"/;
     };
@@ -103,7 +113,10 @@ sub export {
                }
            }
        }
-       Carp::croak("Can't continue after import errors") if $oops;
+       if ($oops) {
+           require Carp;
+           Carp::croak("Can't continue after import errors");
+       }
     }
     else {
        @imports = @exports;
@@ -127,7 +140,10 @@ sub export {
                warn qq["$sym" is not implemented by the $pkg module ],
                        "on this architecture";
            }
-           Carp::croak("Can't continue after import errors") if @failed;
+           if (@failed) {
+               require Carp;
+               Carp::croak("Can't continue after import errors");
+           }
        }
     }
 
@@ -145,7 +161,7 @@ sub export {
            $type eq '@' ? \@{"${pkg}::$sym"} :
            $type eq '%' ? \%{"${pkg}::$sym"} :
            $type eq '*' ?  *{"${pkg}::$sym"} :
-               Carp::croak("Can't export symbol: $type$sym");
+           do { require Carp; Carp::croak("Can't export symbol: $type$sym") };
     }
 }
 
@@ -165,8 +181,11 @@ sub _push_tags {
     push(@{"${pkg}::$var"},
        map { $export_tags{$_} ? @{$export_tags{$_}} : scalar(++$nontag,$_) }
                (@$syms) ? @$syms : keys %export_tags);
-    # This may change to a die one day
-    Carp::carp("Some names are not tags") if $nontag and $^W;
+    if ($nontag and $^W) {
+       # This may change to a die one day
+       require Carp;
+       Carp::carp("Some names are not tags");
+    }
 }
 
 sub export_tags    { _push_tags((caller)[0], "EXPORT",    \@_) }
@@ -188,6 +207,7 @@ sub require_version {
        $version ||= "(undef)";
        my $file = $INC{"$pkg.pm"};
        $file &&= " ($file)";
+       require Carp;
        Carp::croak("$pkg $wanted required--this is only version $version$file")
     }
     $version;
@@ -246,7 +266,7 @@ In other files which wish to use ModuleName:
 =head1 DESCRIPTION
 
 The Exporter module implements a default C<import> method which
-many modules choose inherit rather than implement their own.
+many modules choose to inherit rather than implement their own.
 
 Perl automatically calls the C<import> method when processing a
 C<use> statement for a module. Modules and C<use> are documented
diff --git a/lib/ExtUtils/Command.pm b/lib/ExtUtils/Command.pm
new file mode 100644 (file)
index 0000000..8c4fd7a
--- /dev/null
@@ -0,0 +1,212 @@
+package ExtUtils::Command;
+use strict;
+# use AutoLoader;
+use File::Copy;
+use File::Compare;
+use File::Basename;
+use File::Path qw(rmtree);
+require Exporter;
+use vars qw(@ISA @EXPORT $VERSION);
+@ISA     = qw(Exporter);
+@EXPORT  = qw(cp rm_f rm_rf mv cat eqtime mkpath touch test_f);
+$VERSION = '1.00';
+
+=head1 NAME
+
+ExtUtils::Command - utilities to replace common UNIX commands in Makefiles etc.
+
+=head1 SYNOPSYS
+
+  perl -MExtUtils::command -e cat files... > destination
+  perl -MExtUtils::command -e mv source... destination
+  perl -MExtUtils::command -e cp source... destination
+  perl -MExtUtils::command -e touch files...
+  perl -MExtUtils::command -e rm_f file...
+  perl -MExtUtils::command -e rm_rf directories...
+  perl -MExtUtils::command -e mkpath directories...
+  perl -MExtUtils::command -e eqtime source destination
+  perl -MExtUtils::command -e chmod mode files...
+  perl -MExtUtils::command -e test_f file
+
+=head1 DESCRIPTION
+
+The module is used in Win32 port to replace common UNIX commands.
+Most commands are wrapers on generic modules File::Path and File::Basename.
+
+=over 4
+
+=item cat 
+
+Concatenates all files menthion on command line to STDOUT.
+
+=cut 
+
+sub cat ()
+{
+ print while (<>);
+}
+
+=item eqtime src dst
+
+Sets modified time of dst to that of src
+
+=cut 
+
+sub eqtime
+{
+ my ($src,$dst) = @ARGV;
+ open(F,">$dst");
+ close(F);
+ utime((stat($src))[8,9],$dst);
+}
+
+=item rm_f files....
+
+Removes directories - recursively (even if readonly)
+
+=cut 
+
+sub rm_rf
+{
+ rmtree([@ARGV],0,0);
+}
+
+=item rm_f files....
+
+Removes files (even if readonly)
+
+=cut 
+
+sub rm_f
+{
+ foreach (@ARGV)
+  {
+   next unless -e $_;
+   chmod(0777,$_);
+   next if (-f $_ and unlink($_));
+   die "Cannot delete $_:$!";
+  }
+}
+
+=item touch files ...
+
+Makes files exist, with current timestamp 
+
+=cut 
+
+sub touch
+{
+ while (@ARGV)
+  {
+   my $file = shift(@ARGV);               
+   open(FILE,">>$file") || die "Cannot write $file:$!";
+   close(FILE);
+  }
+}
+
+=item mv source... destination
+
+Moves source to destination.
+Multiple sources are allowed if destination is an existing directory.
+
+=cut 
+
+sub mv
+{
+ my $dst = pop(@ARGV);
+ if (-d $dst)
+  {
+   while (@ARGV)
+    {
+     my $src = shift(@ARGV);               
+     my $leaf = basename($src);            
+     move($src,"$dst/$leaf");  # fixme
+    }
+  }
+ else
+  {
+   my $src = shift(@ARGV);
+   move($src,$dst) || die "Cannot move $src $dst:$!";
+  }
+}
+
+=item cp source... destination
+
+Copies source to destination.
+Multiple sources are allowed if destination is an existing directory.
+
+=cut 
+
+sub cp
+{
+ my $dst = pop(@ARGV);
+ if (-d $dst)
+  {
+   while (@ARGV)
+    {
+     my $src = shift(@ARGV);               
+     my $leaf = basename($src);            
+     copy($src,"$dst/$leaf");  # fixme
+    }
+  }
+ else
+  {
+   copy(shift,$dst);
+  }
+}
+
+=item chmod mode files...
+
+Sets UNIX like permissions 'mode' on all the files.
+
+=cut 
+
+sub chmod
+{
+ chmod(@ARGV) || die "Cannot chmod ".join(' ',@ARGV).":$!";
+}
+
+=item mkpath directory...
+
+Creates directory, including any parent directories.
+
+=cut 
+
+sub mkpath
+{
+ File::Path::mkpath([@ARGV],1,0777);
+}
+
+=item test_f file
+
+Tests if a file exists
+
+=cut 
+
+sub test_f
+{
+ exit !-f shift(@ARGV);
+}
+
+1;
+__END__ 
+
+=back
+
+=head1 BUGS
+
+eqtime does not work right on Win32 due to problems with utime() built-in
+command.
+
+Should probably be Auto/Self loaded.
+
+=head1 SEE ALSO 
+
+ExtUtils::MakeMaker, ExtUtils::MM_Unix, ExtUtils::MM_Win32
+
+=head1 AUTHOR
+
+Nick Ing-Simmons <F<nick@ni-s.u-net.com>>.
+
+=cut
+
index a88bd99..71f553b 100644 (file)
@@ -233,6 +233,17 @@ sub pm_to_blib {
     # my $my_req = $self->catfile(qw(auto ExtUtils Install forceunlink.al));
     # require $my_req; # Hairy, but for the first
 
+    if (!ref($fromto) && -r $fromto)
+     {
+      # Win32 has severe command line length limitations, but
+      # can generate temporary files on-the-fly
+      # so we pass name of file here - eval it to get hash 
+      open(FROMTO,"<$fromto") or die "Cannot open $fromto:$!";
+      my $str = '$fromto = {qw{'.join('',<FROMTO>).'}}';
+      eval $str;
+      close(FROMTO);
+     }
+
     my $umask = umask 0022 unless $Is_VMS;
     mkpath($autodir,0,0755);
     foreach (keys %$fromto) {
index 1a1f8b1..65abfc2 100644 (file)
@@ -54,6 +54,17 @@ sub file_name_is_absolute {
     $file =~ m{^([a-z]:)?[\\/]}i ;
 }
 
+sub perl_archive
+{
+ return "\$(PERL_INC)/libperl\$(LIB_EXT)";
+}
+
+sub export_list
+{
+ my ($self) = @_;
+ return "$self->{BASEEXT}.def";
+}
+
 1;
 __END__
 
index 465a075..f4ee44f 100644 (file)
@@ -8,7 +8,7 @@ use strict;
 use vars qw($VERSION $Is_Mac $Is_OS2 $Is_VMS
            $Verbose %pm %static $Xsubpp_Version);
 
-$VERSION = substr q$Revision: 1.113 $, 10;
+$VERSION = substr q$Revision: 1.114 $, 10;
 # $Id: MM_Unix.pm,v 1.113 1997/02/11 21:54:09 k Exp $
 
 Exporter::import('ExtUtils::MakeMaker',
@@ -176,6 +176,7 @@ sub ExtUtils::MM_Unix::dynamic ;
 sub ExtUtils::MM_Unix::dynamic_bs ;
 sub ExtUtils::MM_Unix::dynamic_lib ;
 sub ExtUtils::MM_Unix::exescan ;
+sub ExtUtils::MM_Unix::export_list ;
 sub ExtUtils::MM_Unix::extliblist ;
 sub ExtUtils::MM_Unix::file_name_is_absolute ;
 sub ExtUtils::MM_Unix::find_perl ;
@@ -201,6 +202,7 @@ sub ExtUtils::MM_Unix::nicetext ;
 sub ExtUtils::MM_Unix::parse_version ;
 sub ExtUtils::MM_Unix::pasthru ;
 sub ExtUtils::MM_Unix::path ;
+sub ExtUtils::MM_Unix::perl_archive;
 sub ExtUtils::MM_Unix::perl_script ;
 sub ExtUtils::MM_Unix::perldepend ;
 sub ExtUtils::MM_Unix::pm_to_blib ;
@@ -395,7 +397,7 @@ clean ::
 ');
     # clean subdirectories first
     for $dir (@{$self->{DIR}}) {
-       push @m, "\t-cd $dir && test -f $self->{MAKEFILE} && \$(MAKE) clean\n";
+       push @m, "\t-cd $dir && \$(TEST_F) $self->{MAKEFILE} && \$(MAKE) clean\n";
     }
 
     my(@otherfiles) = values %{$self->{XS}}; # .c files from *.xs files
@@ -409,7 +411,7 @@ clean ::
     push @m, "\t-$self->{RM_RF} @otherfiles\n";
     # See realclean and ext/utils/make_ext for usage of Makefile.old
     push(@m,
-        "\t-$self->{MV} $self->{MAKEFILE} $self->{MAKEFILE}.old 2>/dev/null\n");
+        "\t-$self->{MV} $self->{MAKEFILE} $self->{MAKEFILE}.old \$(DEV_NULL)\n");
     push(@m,
         "\t$attribs{POSTOP}\n")   if $attribs{POSTOP};
     join("", @m);
@@ -600,20 +602,11 @@ INST_BOOT    =
 ';
     }
 
-    if ($Is_OS2) {
-       $tmp = "$self->{BASEEXT}.def";
-    } else {
-       $tmp = "";
-    }
+    $tmp = $self->export_list;
     push @m, "
 EXPORT_LIST = $tmp
 ";
-
-    if ($Is_OS2) {
-       $tmp = "\$(PERL_INC)/libperl\$(LIB_EXT)";
-    } else {
-       $tmp = "";
-    }
+    $tmp = $self->perl_archive;
     push @m, "
 PERL_ARCHIVE = $tmp
 ";
@@ -673,8 +666,7 @@ sub dir_target {
     foreach $dir (@dirs) {
        my($src) = $self->catfile($self->{PERL_INC},'perl.h');
        my($targ) = $self->catfile($dir,'.exists');
-       my($targdir) = $targ;       # Necessary because catfile may have
-       $targdir =~ s:/?.exists$::; # adapted syntax of $dir to target OS
+       my($targdir) = dirname($targ); # Necessary because catfile may have adapted syntax of $dir to target OS
        next if $self->{DIR_TARGET}{$self}{$targdir}++;
        push @m, qq{
 $targ :: $src
@@ -713,7 +705,7 @@ sub dist {
 
     my($to_unix)  = $attribs{TO_UNIX} || ($Is_OS2
                                          ? "$self->{NOECHO}"
-                                         . 'test -f tmp.zip && $(RM) tmp.zip;'
+                                         . '$(TEST_F) tmp.zip && $(RM) tmp.zip;'
                                          . ' $(ZIP) -ll -mr tmp.zip $(DISTVNAME) && unzip -o tmp.zip && $(RM) tmp.zip'
                                          : "$self->{NOECHO}\$(NOOP)");
 
@@ -757,20 +749,20 @@ distclean :: realclean distcheck
 
     push @m, q{
 distcheck :
-       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&fullcheck";' \\
-               -e 'fullcheck();'
+       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=fullcheck \\
+               -e fullcheck
 };
 
     push @m, q{
 skipcheck :
-       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&skipcheck";' \\
-               -e 'skipcheck();'
+       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=skipcheck \\
+               -e skipcheck
 };
 
     push @m, q{
 manifest :
-       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&mkmanifest";' \\
-               -e 'mkmanifest();'
+       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=mkmanifest \\
+               -e mkmanifest
 };
     join "", @m;
 }
@@ -786,8 +778,8 @@ sub dist_ci {
     my @m;
     push @m, q{
 ci :
-       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e 'use ExtUtils::Manifest "&maniread";' \\
-               -e '@all = keys %{ maniread() };' \\
+       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=maniread \\
+               -e "@all = keys %{ maniread() };" \\
                -e 'print("Executing $(CI) @all\n"); system("$(CI) @all");' \\
                -e 'print("Executing $(RCS_LABEL) ...\n"); system("$(RCS_LABEL) @all");'
 };
@@ -854,7 +846,7 @@ sub dist_dir {
 distdir :
        $(RM_RF) $(DISTVNAME)
        $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=manicopy,maniread \\
-               -e 'manicopy(maniread(),"$(DISTVNAME)", "$(DIST_CP)");'
+               -e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');"
 };
     join "", @m;
 }
@@ -955,8 +947,8 @@ BOOTSTRAP = '."$self->{BASEEXT}.bs".'
 $(BOOTSTRAP): '."$self->{MAKEFILE} $self->{BOOTDEP}".' $(INST_ARCHAUTODIR)/.exists
        '.$self->{NOECHO}.'echo "Running Mkbootstrap for $(NAME) ($(BSLOADLIBS))"
        '.$self->{NOECHO}.'$(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" \
-               -e \'use ExtUtils::Mkbootstrap;\' \
-               -e \'Mkbootstrap("$(BASEEXT)","$(BSLOADLIBS)");\'
+               -MExtUtils::Mkbootstrap \
+               -e "Mkbootstrap(\'$(BASEEXT)\',\'$(BSLOADLIBS)\');"
        '.$self->{NOECHO}.'$(TOUCH) $(BOOTSTRAP)
        $(CHMOD) 644 $@
 
@@ -1718,7 +1710,7 @@ usually solves this kind of problem.
 
 Initializes EXTRALIBS, BSLOADLIBS, LDLOADLIBS, LIBS, LD_RUN_PATH,
 OBJECT, BOOTDEP, PERLMAINCC, LDFROM, LINKTYPE, NOOP, FIRST_MAKEFILE,
-MAKEFILE, NOECHO, RM_F, RM_RF, TOUCH, CP, MV, CHMOD, UMASK_NULL
+MAKEFILE, NOECHO, RM_F, RM_RF, TEST_F, TOUCH, CP, MV, CHMOD, UMASK_NULL
 
 =cut
 
@@ -1776,10 +1768,12 @@ sub init_others {       # --- Initialize Other Attributes
     $self->{RM_F}  ||= "rm -f";
     $self->{RM_RF} ||= "rm -rf";
     $self->{TOUCH} ||= "touch";
+    $self->{TEST_F} ||= "test -f";
     $self->{CP} ||= "cp";
     $self->{MV} ||= "mv";
     $self->{CHMOD} ||= "chmod";
     $self->{UMASK_NULL} ||= "umask 0";
+    $self->{DEV_NULL} ||= "> /dev/null 2>&1";
 }
 
 =item install (o)
@@ -2196,8 +2190,8 @@ $tmp/perlmain\$(OBJ_EXT): $tmp/perlmain.c
     push @m, qq{
 $tmp/perlmain.c: $makefilename}, q{
        }.$self->{NOECHO}.q{echo Writing $@
-       }.$self->{NOECHO}.q{$(PERL) $(MAP_PERLINC) -e 'use ExtUtils::Miniperl; \\
-               writemain(grep s#.*/auto/##, qw|$(MAP_STATIC)|)' > $@t && mv $@t $@
+       }.$self->{NOECHO}.q{$(PERL) $(MAP_PERLINC) -MExtUtils::Miniperl \\
+               -e "writemain(grep s#.*/auto/##, qw|$(MAP_STATIC)|)" > $@t && $(MV) $@t $@
 
 };
 
@@ -2250,11 +2244,12 @@ $(OBJECT) : $(FIRST_MAKEFILE)
 }.$self->{MAKEFILE}.q{ : Makefile.PL $(CONFIGDEP)
        }.$self->{NOECHO}.q{echo "Makefile out-of-date with respect to $?"
        }.$self->{NOECHO}.q{echo "Cleaning current config before rebuilding Makefile..."
-       -}.$self->{NOECHO}.q{mv }."$self->{MAKEFILE} $self->{MAKEFILE}.old".q{
-       -$(MAKE) -f }.$self->{MAKEFILE}.q{.old clean >/dev/null 2>&1 || true
+       -}.$self->{NOECHO}.q{$(MV) }."$self->{MAKEFILE} $self->{MAKEFILE}.old".q{
+       -$(MAKE) -f }.$self->{MAKEFILE}.q{.old clean $(DEV_NULL) || $(NOOP)
        $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" Makefile.PL }.join(" ",map(qq["$_"],@ARGV)).q{
-       }.$self->{NOECHO}.q{echo ">>> Your Makefile has been rebuilt. <<<"
-       }.$self->{NOECHO}.q{echo ">>> Please rerun the make command.  <<<"; false
+       }.$self->{NOECHO}.q{echo "==> Your Makefile has been rebuilt. <=="
+       }.$self->{NOECHO}.q{echo "==> Please rerun the make command.  <=="
+       false
 
 # To change behavior to :: would be nice, but would break Tk b9.02
 # so you find such a warning below the dist target.
@@ -2554,7 +2549,7 @@ sub pm_to_blib {
 pm_to_blib: $(TO_INST_PM)
        }.$self->{NOECHO}.q{$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \
        "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Install \
-        -e 'pm_to_blib({qw{$(PM_TO_BLIB)}},"}.$autodir.q{")'
+        -e "pm_to_blib({qw{$(PM_TO_BLIB)}},'}.$autodir.q{')"
        }.$self->{NOECHO}.q{$(TOUCH) $@
 };
 }
@@ -2647,7 +2642,7 @@ sub realclean {
 realclean purge ::  clean
 ');
     # realclean subdirectories first (already cleaned)
-    my $sub = "\t-cd %s && test -f %s && \$(MAKE) %s realclean\n";
+    my $sub = "\t-cd %s && \$(TEST_F) %s && \$(MAKE) %s realclean\n";
     foreach(@{$self->{DIR}}){
        push(@m, sprintf($sub,$_,"$self->{MAKEFILE}.old","-f $self->{MAKEFILE}.old"));
        push(@m, sprintf($sub,$_,"$self->{MAKEFILE}",''));
@@ -2845,7 +2840,7 @@ testdb :: testdb_\$(LINKTYPE)
 
 test :: \$(TEST_TYPE)
 ");
-    push(@m, map("\t$self->{NOECHO}cd $_ && test -f $self->{MAKEFILE} && \$(MAKE) test \$(PASTHRU)\n",
+    push(@m, map("\t$self->{NOECHO}cd $_ && \$(TEST_F) $self->{MAKEFILE} && \$(MAKE) test \$(PASTHRU)\n",
                 @{$self->{DIR}}));
     push(@m, "\t$self->{NOECHO}echo 'No tests defined for \$(NAME) extension.'\n")
        unless $tests or -f "test.pl" or @{$self->{DIR}};
@@ -2936,27 +2931,23 @@ sub tools_other {
 SHELL = $bin_sh
 };
 
-    for (qw/ CHMOD CP LD MV NOOP RM_F RM_RF TOUCH UMASK_NULL / ) {
+    for (qw/ CHMOD CP LD MV NOOP RM_F RM_RF TEST_F TOUCH UMASK_NULL DEV_NULL/ ) {
        push @m, "$_ = $self->{$_}\n";
     }
 
-
     push @m, q{
 # The following is a portable way to say mkdir -p
 # To see which directories are created, change the if 0 to if 1
-MKPATH = $(PERL) -wle '$$"="/"; foreach $$p (@ARGV){' \\
--e 'next if -d $$p; my(@p); foreach(split(/\//,$$p)){' \\
--e 'push(@p,$$_); next if -d "@p/"; print "mkdir @p" if 0;' \\
--e 'mkdir("@p",0777)||die $$! } } exit 0;'
+MKPATH = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e mkpath
 
 # This helps us to minimize the effect of the .exists files A yet
 # better solution would be to have a stable file in the perl
 # distribution with a timestamp of zero. But this solution doesn't
 # need any changes to the core distribution and works with older perls
-EQUALIZE_TIMESTAMP = $(PERL) -we 'open F, ">$$ARGV[1]"; close F;' \\
--e 'utime ((stat("$$ARGV[0]"))[8,9], $$ARGV[1])'
+EQUALIZE_TIMESTAMP = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e eqtime
 };
 
+
     return join "", @m if $self->{PARENT};
 
     push @m, q{
@@ -2971,7 +2962,7 @@ UNINST=0
 VERBINST=1
 
 MOD_INSTALL = $(PERL) -I$(INST_LIB) -I$(PERL_LIB) -MExtUtils::Install \
--e 'install({@ARGV},"$(VERBINST)",0,"$(UNINST)");'
+-e "install({@ARGV},'$(VERBINST)',0,'$(UNINST)');"
 
 DOC_INSTALL = $(PERL) -e '$$\="\n\n";' \
 -e 'print "=head2 ", scalar(localtime), ": C<", shift, ">", " L<", shift, ">";' \
@@ -3110,10 +3101,15 @@ sub top_targets {
     my(@m);
     push @m, '
 #all ::        config $(INST_PM) subdirs linkext manifypods
+';
 
+    push @m, '
 all :: pure_all manifypods
        '.$self->{NOECHO}.'$(NOOP)
-
+' 
+         unless $self->{SKIPHASH}{'all'};
+    
+    push @m, '
 pure_all :: config pm_to_blib subdirs linkext
        '.$self->{NOECHO}.'$(NOOP)
 
@@ -3168,7 +3164,7 @@ help:
 Version_check:
        }.$self->{NOECHO}.q{$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) \
                -MExtUtils::MakeMaker=Version_check \
-               -e 'Version_check("$(MM_VERSION)")'
+               -e "Version_check('$(MM_VERSION)')"
 };
 
     join('',@m);
@@ -3200,7 +3196,7 @@ sub xs_c {
     return '' unless $self->needs_linking();
     '
 .xs.c:
-       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >$*.tc && mv $*.tc $@
+       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >$*.tc && $(MV) $*.tc $@
 ';
 }
 
@@ -3216,11 +3212,38 @@ sub xs_o {      # many makes are too dumb to use xs_c then c_o
     return '' unless $self->needs_linking();
     '
 .xs$(OBJ_EXT):
-       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >xstmp.c && mv xstmp.c $*.c
+       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) $(XSUBPP) $(XSPROTOARG) $(XSUBPPARGS) $*.xs >xstmp.c && $(MV) xstmp.c $*.c
        $(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) $*.c
 ';
 }
 
+=item perl_archive
+
+This is internal method that returns path to libperl.a equivalent
+to be linked to dynamic extensions. UNIX does not have one but OS2
+and Win32 do.
+
+=cut 
+
+sub perl_archive
+{
+ return "";
+}
+
+=item export_list
+
+This is internal method that returns name of a file that is
+passed to linker to define symbols to be exported.
+UNIX does not have one but OS2 and Win32 do.
+
+=cut 
+
+sub export_list
+{
+ return "";
+}
+
+
 1;
 
 =back
index 0e2897c..23e8fdb 100644 (file)
@@ -1051,7 +1051,10 @@ EOM
     $command = "$self->{PERL} $xsubpp $file";
     print "Running: $command\n" if $Verbose;
     my $text = `$command` ;
-    warn "Running '$command' exits with status " . $? unless ($? & 1);
+    if ($?) {
+       use vmsish 'status';
+       warn "Running '$command' exits with status $?";
+    }
     unlink $file ;
 
     # gets 1.2 -> 1.92 and 2.000a1
diff --git a/lib/ExtUtils/MM_Win32.pm b/lib/ExtUtils/MM_Win32.pm
new file mode 100644 (file)
index 0000000..d001901
--- /dev/null
@@ -0,0 +1,493 @@
+package ExtUtils::MM_Win32;
+
+=head1 NAME
+
+ExtUtils::MM_Win32 - methods to override UN*X behaviour in ExtUtils::MakeMaker
+
+=head1 SYNOPSIS
+
+ use ExtUtils::MM_Win32; # Done internally by ExtUtils::MakeMaker if needed
+
+=head1 DESCRIPTION
+
+See ExtUtils::MM_Unix for a documentation of the methods provided
+there. This package overrides the implementation of these methods, not
+the semantics.
+
+=over
+
+=cut 
+
+#use Config;
+#use Cwd;
+use File::Basename;
+require Exporter;
+
+Exporter::import('ExtUtils::MakeMaker',
+       qw( $Verbose &neatvalue));
+
+$ENV{EMXSHELL} = 'sh'; # to run `commands`
+unshift @MM::ISA, 'ExtUtils::MM_Win32';
+
+sub dlsyms {
+    my($self,%attribs) = @_;
+
+    my($funcs) = $attribs{DL_FUNCS} || $self->{DL_FUNCS} || {};
+    my($vars)  = $attribs{DL_VARS} || $self->{DL_VARS} || [];
+    my($imports)  = $attribs{IMPORTS} || $self->{IMPORTS} || {};
+    my(@m);
+    (my $boot = $self->{NAME}) =~ s/:/_/g;
+
+    if (not $self->{SKIPHASH}{'dynamic'}) {
+       push(@m,"
+$self->{BASEEXT}.def: Makefile.PL
+",
+     q!        $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Mksymlists \\
+     -e "Mksymlists('NAME' => '!, $self->{NAME},
+     q!', 'DLBASE' => '!,$self->{DLBASE},
+     q!', 'DL_FUNCS' => !,neatvalue($funcs),
+     q!, 'IMPORTS' => !,neatvalue($imports),
+     q!, 'DL_VARS' => !, neatvalue($vars), q!);"
+!);
+    }
+    join('',@m);
+}
+
+sub replace_manpage_separator {
+    my($self,$man) = @_;
+    $man =~ s,/+,.,g;
+    $man;
+}
+
+sub maybe_command {
+    my($self,$file) = @_;
+    return "$file.exe" if -e "$file.exe";
+    return;
+}
+
+sub file_name_is_absolute {
+    my($self,$file) = @_;
+    $file =~ m{^([a-z]:)?[\\/]}i ;
+}
+
+sub find_perl {
+    my($self, $ver, $names, $dirs, $trace) = @_;
+    my($name, $dir);
+    if ($trace >= 2){
+       print "Looking for perl $ver by these names:
+@$names
+in these dirs:
+@$dirs
+";
+    }
+    foreach $dir (@$dirs){
+       next unless defined $dir; # $self->{PERL_SRC} may be undefined
+       foreach $name (@$names){
+           my ($abs, $val);
+           if ($self->file_name_is_absolute($name)) { # /foo/bar
+               $abs = $name;
+           } elsif ($self->canonpath($name) eq $self->canonpath(basename($name))) { # foo
+               $abs = $self->catfile($dir, $name);
+           } else { # foo/bar
+               $abs = $self->canonpath($self->catfile($self->curdir, $name));
+           }
+           print "Checking $abs\n" if ($trace >= 2);
+           next unless $self->maybe_command($abs);
+           print "Executing $abs\n" if ($trace >= 2);
+           $val = `$abs -e "require $ver;" 2>&1`;
+           if ($? == 0) {
+               print "Using PERL=$abs\n" if $trace;
+               return $abs;
+           } elsif ($trace >= 2) {
+               print "Result: `$val'\n";
+           }
+       }
+    }
+    print STDOUT "Unable to find a perl $ver (by these names: @$names, in these dirs: @$dirs)\n";
+    0; # false and not empty
+}
+
+sub catdir {
+    my $self = shift;
+    my @args = @_;
+    for (@args) {
+       # append a slash to each argument unless it has one there
+       $_ .= "\\" if $_ eq '' or substr($_,-1) ne "\\";
+    }
+    my $result = $self->canonpath(join('', @args));
+    $result;
+}
+
+=item catfile
+
+Concatenate one or more directory names and a filename to form a
+complete path ending with a filename
+
+=cut
+
+sub catfile {
+    my $self = shift @_;
+    my $file = pop @_;
+    return $file unless @_;
+    my $dir = $self->catdir(@_);
+    for ($dir) {
+       $_ .= "\\" unless substr($_,length($_)-1,1) eq "\\";
+    }
+    return $dir.$file;
+}
+
+sub init_others
+{
+ my ($self) = @_;
+ &ExtUtils::MM_Unix::init_others;
+ $self->{'TOUCH'}  = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e touch';
+ $self->{'CHMOD'}  = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e chmod'; 
+ $self->{'CP'}     = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e cp';
+ $self->{'RM_F'}   = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e rm_f';
+ $self->{'RM_RF'}  = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e rm_rf';
+ $self->{'MV'}     = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e mv';
+ $self->{'NOOP'}   = 'rem';
+ $self->{'TEST_F'} = '$(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e test_f';
+ $self->{'LD'}     = 'link';
+ $self->{'DEV_NULL'} = '> NUL';
+ # $self->{'NOECHO'} = ''; # till we have it working
+}
+
+sub path {
+    local $^W = 1;
+    my($self) = @_;
+    my $path = $ENV{'PATH'} || $ENV{'Path'} || $ENV{'path'};
+    my @path = split(';',$path);
+    foreach(@path) { $_ = '.' if $_ eq '' }
+    @path;
+}
+
+=item static_lib (o)
+
+Defines how to produce the *.a (or equivalent) files.
+
+=cut
+
+sub static_lib {
+    my($self) = @_;
+# Come to think of it, if there are subdirs with linkcode, we still have no INST_STATIC
+#    return '' unless $self->needs_linking(); #might be because of a subdir
+
+    return '' unless $self->has_link_code;
+
+    my(@m);
+    push(@m, <<'END');
+$(INST_STATIC): $(OBJECT) $(MYEXTLIB) $(INST_ARCHAUTODIR)/.exists
+       $(RM_RF) $@
+END
+    # If this extension has it's own library (eg SDBM_File)
+    # then copy that to $(INST_STATIC) and add $(OBJECT) into it.
+    push(@m, "\t$self->{CP} \$(MYEXTLIB) \$\@\n") if $self->{MYEXTLIB};
+
+    push @m,
+q{     lib -nologo -out:$@ $(OBJECT)
+       }.$self->{NOECHO}.q{echo "$(EXTRALIBS)" > $(INST_ARCHAUTODIR)/extralibs.ld
+       $(CHMOD) 755 $@
+};
+
+# Old mechanism - still available:
+
+    push @m, "\t$self->{NOECHO}".q{echo "$(EXTRALIBS)" >> $(PERL_SRC)/ext.libs}."\n\n"
+       if $self->{PERL_SRC};
+
+    push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
+    join('', "\n",@m);
+}
+
+
+
+=item dynamic_lib (o)
+
+Defines how to produce the *.so (or equivalent) files.
+
+=cut
+
+sub dynamic_lib {
+    my($self, %attribs) = @_;
+    return '' unless $self->needs_linking(); #might be because of a subdir
+
+    return '' unless $self->has_link_code;
+
+    my($otherldflags) = $attribs{OTHERLDFLAGS} || "";
+    my($inst_dynamic_dep) = $attribs{INST_DYNAMIC_DEP} || "";
+    my($ldfrom) = '$(LDFROM)';
+    my(@m);
+    push(@m,'
+# This section creates the dynamically loadable $(INST_DYNAMIC)
+# from $(OBJECT) and possibly $(MYEXTLIB).
+OTHERLDFLAGS = '.$otherldflags.'
+INST_DYNAMIC_DEP = '.$inst_dynamic_dep.'
+
+$(INST_DYNAMIC): $(OBJECT) $(MYEXTLIB) $(BOOTSTRAP) $(INST_ARCHAUTODIR)/.exists $(EXPORT_LIST) $(PERL_ARCHIVE) $(INST_DYNAMIC_DEP)
+');
+
+    push(@m,'  $(LD) -out:$@ $(LDDLFLAGS) '.$ldfrom.
+               ' $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) -def:$(EXPORT_LIST)');
+    push @m, '
+       $(CHMOD) 755 $@
+';
+
+    push @m, $self->dir_target('$(INST_ARCHAUTODIR)');
+    join('',@m);
+}
+
+sub perl_archive
+{
+ return '$(PERL_INC)\perl$(LIB_EXT)';
+}
+
+sub export_list
+{
+ my ($self) = @_;
+ return "$self->{BASEEXT}.def";
+}
+
+=item canonpath
+
+No physical check on the filesystem, but a logical cleanup of a
+path. On UNIX eliminated successive slashes and successive "/.".
+
+=cut
+
+sub canonpath {
+    my($self,$path) = @_;
+    $path =~ s|/|\\|g;
+    $path =~ s|\\+|\\|g ;                          # xx////xx  -> xx/xx
+    $path =~ s|(\\\.)+\\|\\|g ;                    # xx/././xx -> xx/xx
+    $path =~ s|^(\.\\)+|| unless $path eq ".\\";   # ./xx      -> xx
+    $path =~ s|\\$|| 
+             unless $path =~ m#^([a-z]:)?\\#;      # xx/       -> xx
+    $path .= '.' if $path =~ m#\\$#;
+    $path;
+}
+
+=item perl_script
+
+Takes one argument, a file name, and returns the file name, if the
+argument is likely to be a perl script. On MM_Unix this is true for
+any ordinary, readable file.
+
+=cut
+
+sub perl_script {
+    my($self,$file) = @_;
+    return "$file.pl" if -r "$file.pl" && -f _;
+    return;
+}
+
+=item pm_to_blib
+
+Defines target that copies all files in the hash PM to their
+destination and autosplits them. See L<ExtUtils::Install/DESCRIPTION>
+
+=cut
+
+sub pm_to_blib {
+    my $self = shift;
+    my($autodir) = $self->catdir('$(INST_LIB)','auto');
+    return q{
+pm_to_blib: $(TO_INST_PM)
+       }.$self->{NOECHO}.q{$(PERL) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)" \
+       "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MExtUtils::Install \
+        -e "pm_to_blib(qw{ <<pmfiles.dat },'}.$autodir.q{')"
+       }.q{
+$(PM_TO_BLIB)
+<<
+       }.$self->{NOECHO}.q{$(TOUCH) $@
+};
+}
+
+=item test_via_harness (o)
+
+Helper method to write the test targets
+
+=cut
+
+sub test_via_harness {
+    my($self, $perl, $tests) = @_;
+    "\t$perl".q! -Mblib -I$(PERL_ARCHLIB) -I$(PERL_LIB) -e "use Test::Harness qw(&runtests $$verbose); $$verbose=$(TEST_VERBOSE); runtests @ARGV;" !."$tests\n";
+}
+
+=item tool_autosplit (override)
+
+Use Win32 quoting on command line.
+
+=cut
+
+sub tool_autosplit{
+    my($self, %attribs) = @_;
+    my($asl) = "";
+    $asl = "\$AutoSplit::Maxlen=$attribs{MAXLEN};" if $attribs{MAXLEN};
+    q{
+# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
+AUTOSPLITFILE = $(PERL) "-I$(PERL_ARCHLIB)" "-I$(PERL_LIB)" -MAutoSplit }.$asl.q{ -e "autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1);"
+};
+}
+
+=item tools_other (o)
+
+Win32 overrides.
+
+Defines SHELL, LD, TOUCH, CP, MV, RM_F, RM_RF, CHMOD, UMASK_NULL in
+the Makefile. Also defines the perl programs MKPATH,
+WARN_IF_OLD_PACKLIST, MOD_INSTALL. DOC_INSTALL, and UNINSTALL.
+
+=cut
+
+sub tools_other {
+    my($self) = shift;
+    my @m;
+    my $bin_sh = $Config{sh} || 'cmd /c';
+    push @m, qq{
+SHELL = $bin_sh
+};
+
+    for (qw/ CHMOD CP LD MV NOOP RM_F RM_RF TEST_F TOUCH UMASK_NULL DEV_NULL/ ) {
+       push @m, "$_ = $self->{$_}\n";
+    }
+
+    push @m, q{
+# The following is a portable way to say mkdir -p
+# To see which directories are created, change the if 0 to if 1
+MKPATH = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e mkpath
+
+# This helps us to minimize the effect of the .exists files A yet
+# better solution would be to have a stable file in the perl
+# distribution with a timestamp of zero. But this solution doesn't
+# need any changes to the core distribution and works with older perls
+EQUALIZE_TIMESTAMP = $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Command -e eqtime
+};
+
+
+    return join "", @m if $self->{PARENT};
+
+    push @m, q{
+# Here we warn users that an old packlist file was found somewhere,
+# and that they should call some uninstall routine
+WARN_IF_OLD_PACKLIST = $(PERL) -lwe "exit unless -f $$ARGV[0];" \\
+-e "print 'WARNING: I have found an old package in';" \\
+-e "print '    ', $$ARGV[0], '.';" \\
+-e "print 'Please make sure the two installations are not conflicting';"
+
+UNINST=0
+VERBINST=1
+
+MOD_INSTALL = $(PERL) -I$(INST_LIB) -I$(PERL_LIB) -MExtUtils::Install \
+-e "install({@ARGV},'$(VERBINST)',0,'$(UNINST)');"
+
+DOC_INSTALL = $(PERL) -e "$$\=\"\n\n\";" \
+-e "print '=head2 ', scalar(localtime), ': C<', shift, '>', ' L<', shift, '>';" \
+-e "print '=over 4';" \
+-e "while (defined($$key = shift) and defined($$val = shift)){print '=item *';print 'C<', \"$$key: $$val\", '>';}" \
+-e "print '=back';"
+
+UNINSTALL =   $(PERL) -MExtUtils::Install \
+-e "uninstall($$ARGV[0],1,1); print \"\nUninstall is deprecated. Please check the";" \
+-e "print \" packlist above carefully.\n  There may be errors. Remove the\";" \
+-e "print \" appropriate files manually.\n  Sorry for the inconveniences.\n\""
+};
+
+    return join "", @m;
+}
+
+=item manifypods (o)
+
+We don't want manpage process.  XXX add pod2html support later.
+
+=cut
+
+sub manifypods {
+    return "\nmanifypods :\n\t$self->{NOECHO}\$(NOOP)\n";
+}
+
+=item dist_ci (o)
+
+Same as MM_Unix version (changes command-line quoting).
+
+=cut
+
+sub dist_ci {
+    my($self) = shift;
+    my @m;
+    push @m, q{
+ci :
+       $(PERL) -I$(PERL_ARCHLIB) -I$(PERL_LIB) -MExtUtils::Manifest=maniread \\
+               -e "@all = keys %{ maniread() };" \\
+               -e "print(\"Executing $(CI) @all\n\"); system(\"$(CI) @all\");" \\
+               -e "print(\"Executing $(RCS_LABEL) ...\n\"); system(\"$(RCS_LABEL) @all\");"
+};
+    join "", @m;
+}
+
+=item dist_core (o)
+
+Same as MM_Unix version (changes command-line quoting).
+
+=cut
+
+sub dist_core {
+    my($self) = shift;
+    my @m;
+    push @m, q{
+dist : $(DIST_DEFAULT)
+       }.$self->{NOECHO}.q{$(PERL) -le "print \"Warning: Makefile possibly out of date with $$vf\" if " \
+           -e "-e ($$vf=\"$(VERSION_FROM)\") and -M $$vf < -M \"}.$self->{MAKEFILE}.q{\";"
+
+tardist : $(DISTVNAME).tar$(SUFFIX)
+
+zipdist : $(DISTVNAME).zip
+
+$(DISTVNAME).tar$(SUFFIX) : distdir
+       $(PREOP)
+       $(TO_UNIX)
+       $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
+       $(RM_RF) $(DISTVNAME)
+       $(COMPRESS) $(DISTVNAME).tar
+       $(POSTOP)
+
+$(DISTVNAME).zip : distdir
+       $(PREOP)
+       $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)
+       $(RM_RF) $(DISTVNAME)
+       $(POSTOP)
+
+uutardist : $(DISTVNAME).tar$(SUFFIX)
+       uuencode $(DISTVNAME).tar$(SUFFIX) \\
+               $(DISTVNAME).tar$(SUFFIX) > \\
+               $(DISTVNAME).tar$(SUFFIX)_uu
+
+shdist : distdir
+       $(PREOP)
+       $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
+       $(RM_RF) $(DISTVNAME)
+       $(POSTOP)
+};
+    join "", @m;
+}
+
+=item pasthru (o)
+
+Defines the string that is passed to recursive make calls in
+subdirectories.
+
+=cut
+
+sub pasthru {
+    my($self) = shift;
+    return "PASTHRU = /nologo"
+}
+
+
+
+1;
+__END__
+
+=back
+
+=cut 
+
index bf0b0d2..eb49f3e 100644 (file)
@@ -68,9 +68,10 @@ package ExtUtils::MakeMaker;
 #
 # Now we can can pull in the friends
 #
-$Is_VMS = $^O eq 'VMS';
-$Is_OS2 = $^O eq 'os2';
-$Is_Mac = $^O eq 'MacOS';
+$Is_VMS   = $^O eq 'VMS';
+$Is_OS2   = $^O eq 'os2';
+$Is_Mac   = $^O eq 'MacOS';
+$Is_Win32 = $^O eq 'MSWin32';
 
 require ExtUtils::MM_Unix;
 
@@ -84,6 +85,9 @@ if ($Is_OS2) {
 if ($Is_Mac) {
     require ExtUtils::MM_Mac;
 }
+if ($Is_Win32) {
+    require ExtUtils::MM_Win32;
+}
 
 # The SelfLoader would bring a lot of overhead for MakeMaker, because
 # we know for sure we will use most of the autoloaded functions once
@@ -150,7 +154,7 @@ sub ExtUtils::MakeMaker::mksymlists ;
 sub ExtUtils::MakeMaker::neatvalue ;
 sub ExtUtils::MakeMaker::selfdocument ;
 sub ExtUtils::MakeMaker::WriteMakefile ;
-sub ExtUtils::MakeMaker::prompt ;
+sub ExtUtils::MakeMaker::prompt ($;$) ;
 
 1;
 
@@ -449,9 +453,10 @@ sub ExtUtils::MakeMaker::new {
     $self->init_main();
 
     if (! $self->{PERL_SRC} ) {
-       my($pthinks) = $INC{'Config.pm'};
+       my($pthinks) = $self->canonpath($INC{'Config.pm'});
        $pthinks = VMS::Filespec::vmsify($pthinks) if $Is_VMS;
        if ($pthinks ne $self->catfile($Config{archlibexp},'Config.pm')){
+            print "Have $pthinks expected ",$self->catfile($Config{archlibexp},'Config.pm'),"\n";
            $pthinks =~ s!/Config\.pm$!!;
            $pthinks =~ s!.*/!!;
            print STDOUT <<END;
index 4c6814c..fd60915 100644 (file)
@@ -49,6 +49,7 @@ sub Mksymlists {
     if    ($osname eq 'aix') { _write_aix(\%spec); }
     elsif ($osname eq 'VMS') { _write_vms(\%spec) }
     elsif ($osname eq 'os2') { _write_os2(\%spec) }
+    elsif ($osname eq 'MSWin32') { _write_win32(\%spec) }
     else { croak("Don't know how to create linker option file for $osname\n"); }
 }
 
@@ -93,6 +94,33 @@ while (($name, $exp)= each %{$data->{IMPORTS}}) {
     close DEF;
 }
 
+sub _write_win32 {
+    my($data) = @_;
+
+    if (not $data->{DLBASE}) {
+        ($data->{DLBASE} = $data->{NAME}) =~ s/.*:://;
+        $data->{DLBASE} = substr($data->{DLBASE},0,7) . '_';
+    }
+    rename "$data->{FILE}.def", "$data->{FILE}_def.old";
+
+    open(DEF,">$data->{FILE}.def")
+        or croak("Can't create $data->{FILE}.def: $!\n");
+    print DEF "LIBRARY $data->{DLBASE}\n";
+    print DEF "CODE LOADONCALL\n";
+    print DEF "DATA LOADONCALL NONSHARED MULTIPLE\n";
+    print DEF "EXPORTS\n  ";
+    print DEF join("\n  ",@{$data->{DL_VARS}}, "\n") if @{$data->{DL_VARS}};
+    print DEF join("\n  ",@{$data->{FUNCLIST}}, "\n") if @{$data->{FUNCLIST}};
+    if (%{$data->{IMPORTS}}) {
+        print DEF "IMPORTS\n";
+        my ($name, $exp);
+        while (($name, $exp)= each %{$data->{IMPORTS}}) {
+            print DEF "  $name=$exp\n";
+        }
+    }
+    close DEF;
+}
+
 
 sub _write_vms {
     my($data) = @_;
index 6abfcd2..0442aed 100644 (file)
@@ -34,7 +34,7 @@ pieces using the syntax of different operating systems.
 You select the syntax via the routine fileparse_set_fstype().
 
 If the argument passed to it contains one of the substrings
-"VMS", "MSDOS", "MacOS", or "AmigaOS", the file specification 
+"VMS", "MSDOS", "MacOS", "AmigaOS" or "MSWin32", the file specification 
 syntax of that operating system is used in future calls to 
 fileparse(), basename(), and dirname().  If it contains none of
 these substrings, UNIX syntax is used.  This pattern matching is
@@ -44,7 +44,7 @@ they assume you are using UNIX emulation and apply the UNIX syntax
 rules instead, for that function call only.
 
 If the argument passed to it contains one of the substrings "VMS",
-"MSDOS", "MacOS", "AmigaOS", "os2", or "RISCOS", then the pattern
+"MSDOS", "MacOS", "AmigaOS", "os2", "MSWin32" or "RISCOS", then the pattern
 matching for suffix removal is performed without regard for case,
 since those systems are not case-sensitive when opening existing files
 (though some of them preserve case on file creation).
@@ -128,7 +128,7 @@ require Exporter;
 @EXPORT = qw(fileparse fileparse_set_fstype basename dirname);
 #use strict;
 #use vars qw($VERSION $Fileparse_fstype $Fileparse_igncase);
-$VERSION = "2.4";
+$VERSION = "2.5";
 
 
 #   fileparse_set_fstype() - specify OS-based rules used in future
@@ -141,7 +141,7 @@ sub fileparse_set_fstype {
   my @old = ($Fileparse_fstype, $Fileparse_igncase);
   if (@_) {
     $Fileparse_fstype = $_[0];
-    $Fileparse_igncase = ($_[0] =~ /^(?:MacOS|VMS|AmigaOS|os2|RISCOS)/i);
+    $Fileparse_igncase = ($_[0] =~ /^(?:MacOS|VMS|AmigaOS|os2|RISCOS|MSWin32)/i);
   }
   wantarray ? @old : $old[0];
 }
@@ -173,6 +173,10 @@ sub fileparse {
     ($dirpath,$basename) = ($fullname =~ /(.*[:\/])?(.*)/);
     $dirpath = './' unless $dirpath;
   }
+  elsif ($fstype =~ /^MSWin32/i) {
+    ($dirpath,$basename) = ($fullname =~ /^(.*[:\\\/])?(.*)/);
+    $dirpath .= ".\\" unless $dirpath =~ /[\\\/]$/;
+  }
   elsif ($fstype !~ /^VMS/i) {  # default to Unix
     ($dirpath,$basename) = ($fullname =~ m#^(.*/)?(.*)#);
     $dirpath = './' unless $dirpath;
@@ -223,6 +227,13 @@ sub dirname {
            $dirname =~ s/([^:])[\\\/]*$/$1/;
        }
     }
+    elsif ($fstype =~ /MSWin32/i) { 
+        $dirname =~ s/([^:])[\\\/]*$/$1/;
+        unless( length($basename) ) {
+           ($basename,$dirname) = fileparse $dirname;
+           $dirname =~ s/([^:])[\\\/]*$/$1/;
+       }
+    }
     elsif ($fstype =~ /AmigaOS/i) {
         if ( $dirname =~ /:$/) { return $dirname }
         chop $dirname;
index 2e35303..137e7bb 100644 (file)
@@ -83,20 +83,24 @@ Charles Bailey E<lt>F<bailey@genetics.upenn.edu>E<gt>
 
 =head1 REVISION
 
-This module was last revised 14-Feb-1996, for perl 5.002. $VERSION is
-1.01.
+This module was last revised 14-Feb-1996, for perl 5.002.
+$VERSION is 1.0101.
 
 =cut
 
-$VERSION = "1.01"; # That's my hobby-horse, A.K.
-
 require 5.000;
 use Carp;
+use File::Basename;
 require Exporter;
+
+use vars qw( $VERSION @ISA @EXPORT );
+$VERSION = "1.0101";
 @ISA = qw( Exporter );
 @EXPORT = qw( mkpath rmtree );
 
-$Is_VMS = $^O eq 'VMS';
+my $Is_VMS = $^O eq 'VMS';
+my $force_writeable = ($^O eq 'os2' || $^O eq 'msdos' || $^O eq 'MSWin32'
+                      || $^O eq 'amigaos');
 
 sub mkpath {
     my($paths, $verbose, $mode) = @_;
@@ -107,16 +111,13 @@ sub mkpath {
     $mode = 0777 unless defined($mode);
     $paths = [$paths] unless ref $paths;
     my(@created);
-    foreach $path (@$paths){
+    foreach $path (@$paths) {
         next if -d $path;
-        my(@p);
-        foreach(split(/\//, $path)){
-            push(@p, $_);
-            next if -d "@p/";
-            print "mkdir @p\n" if $verbose;
-           mkdir("@p",$mode) || croak "mkdir @p: $!";
-            push(@created, "@p");
-        }
+        my $parent = dirname($path);
+        push(@created,mkpath($parent, $verbose, $mode)) unless (-d $parent);
+        print "mkdir $path\n" if $verbose;
+        mkdir($path,$mode) || croak "mkdir $path: $!";
+        push(@created, $path);
     }
     @created;
 }
@@ -144,6 +145,8 @@ sub rmtree {
                print "skipped $root\n" if $verbose;
                next;
            }
+          chmod 0777, $root or carp "Can't make directory $root writeable: $!"
+              if $force_writeable;
            print "rmdir $root\n" if $verbose;
            (rmdir $root && ++$count) or carp "Can't remove directory $root: $!";
         }
@@ -153,6 +156,8 @@ sub rmtree {
                print "skipped $root\n" if $verbose;
                next;
            }
+          chmod 0666, $root or carp "Can't make file $root writeable: $!"
+              if $force_writeable;
            print "unlink $root\n" if $verbose;
            while (-e $root || -l $root) { # delete all versions under VMS
                (unlink($root) && ++$count)
index ec4ccd9..740b83f 100644 (file)
@@ -535,7 +535,7 @@ BEGIN {
 
 use vars @EXPORT, @EXPORT_OK;
 # User visible variables.
-use vars qw(&config $error $debug $major_version $minor_version);
+use vars qw($error $debug $major_version $minor_version);
 # Deprecated visible variables.
 use vars qw($autoabbrev $getopt_compat $ignorecase $bundling $order
            $passthrough);
index 1bc791b..6979a11 100644 (file)
@@ -11,7 +11,7 @@ use vars qw($VERSION $verbose $switches $have_devel_corestack $curtest
            @ISA @EXPORT @EXPORT_OK);
 $have_devel_corestack = 0;
 
-$VERSION = "1.1501";
+$VERSION = "1.1502";
 
 @ISA=('Exporter');
 @EXPORT= qw(&runtests);
@@ -58,12 +58,13 @@ sub runtests {
     while ($test = shift(@tests)) {
        $te = $test;
        chop($te);
+       if ($^O eq 'VMS') { $te =~ s/^.*\.t\./[.t./; }
        print "$te" . '.' x (20 - length($te));
        my $fh = new FileHandle;
        $fh->open($test) or print "can't open $test. $!\n";
        my $first = <$fh>;
        my $s = $switches;
-       $s .= " -T" if $first =~ /^#!.*\bperl.*-\w*T/;
+       $s .= q[ "-T"] if $first =~ /^#!.*\bperl.*-\w*T/;
        $fh->close or print "can't close $test. $!\n";
        my $cmd = "$^X $s $test|";
        $cmd = "MCR $cmd" if $^O eq 'VMS';
@@ -103,10 +104,13 @@ sub runtests {
        }
        $fh->close; # must close to reap child resource values
        my $wstatus = $?;
-       my $estatus = $^O eq 'VMS' ? $wstatus : $wstatus >> 8;
-       if ($^O eq 'VMS' ? !($wstatus & 1) : $wstatus) {
+       my $estatus = ($^O eq 'VMS'
+                      ? eval 'use vmsish "status"; $estatus = $?'
+                      : $wstatus >> 8);
+       if ($wstatus) {
            my ($failed, $canon, $percent) = ('??', '??');
            print "dubious\n\tTest returned status $estatus (wstat $wstatus)\n";
+           print "\t\t(VMS status is $estatus)\n" if $^O eq 'VMS';
            if (corestatus($wstatus)) { # until we have a wait module
                if ($have_devel_corestack) {
                    Devel::CoreStack::stack($^X);
diff --git a/lib/autouse.pm b/lib/autouse.pm
new file mode 100644 (file)
index 0000000..e2ef580
--- /dev/null
@@ -0,0 +1,165 @@
+package autouse;
+
+#use strict;           # debugging only
+use 5.003_90;          # ->can, for my $var
+
+$autouse::VERSION = '0.03';
+
+my $DEBUG = $ENV{AUTOUSE_DEBUG};
+
+sub vet_import ($);
+
+sub croak {
+    require Carp;
+    Carp::croak(@_);
+}
+
+sub import {
+    shift;
+    my $module = shift;
+
+    (my $pm = $module) =~ s{::}{/}g;
+    $pm .= '.pm';
+    if (exists $INC{$pm}) {
+       vet_import $module;
+       local $Exporter::ExportLevel = $Exporter::ExportLevel + 1;
+       # $Exporter::Verbose = 1;
+       return $module->import(map { (my $f = $_) =~ s/\(.*?\)$// } @_);
+    }
+
+    # It is not loaded: need to do real work.
+    my $callpkg = caller(0);
+    print "autouse called from $callpkg\n" if $DEBUG;
+
+    my $index;
+    for my $f (@_) {
+       my $proto;
+       $proto = $1 if (my $func = $f) =~ s/\((.*)\)$//;
+
+       my $closure_import_func = $func;        # Full name
+       my $closure_func = $func;               # Name inside package
+       my $index = index($func, '::');
+       if ($index == -1) {
+           $closure_import_func = "${callpkg}::$func";
+       } else {
+           $closure_func = substr $func, $index + 2;
+           croak "autouse into different package attempted"
+               unless substr($func, 0, $index) eq $module;
+       }
+
+       my $load_sub = sub {
+           unless ($INC{pm}) {
+               require $pm;
+               die $@ if $@;
+               vet_import $module;
+           }
+           *$closure_import_func = \&{"${module}::$closure_func"};
+           print "autousing $module; "
+                 ."imported $closure_func as $closure_import_func\n"
+               if $DEBUG;
+           goto &$closure_import_func;
+       };
+
+       if (defined $proto) {
+           *$closure_import_func = eval "sub ($proto) { &\$load_sub }";
+       } else {
+           *$closure_import_func = $load_sub;
+       }
+    }
+}
+
+sub vet_import ($) {
+    my $module = shift;
+    if (my $import = $module->can('import')) {
+       croak "autoused module has unique import() method"
+           unless defined(\&Exporter::import)
+                  && $import == \&Exporter::import;
+    }
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+autouse - postpone load of modules until a function is used
+
+=head1 SYNOPSIS
+
+  use autouse 'Carp' => qw(carp croak);
+  carp "this carp was predeclared and autoused ";
+
+=head1 DESCRIPTION
+
+If the module C<Module> is already loaded, then the declaration
+
+  use autouse 'Module' => qw(func1 func2($;$) Module::func3);
+
+is equivalent to
+
+  use Module qw(func1 func2);
+
+if C<Module> defines func2() with prototype C<($;$)>, and func1() and
+func3() have no prototypes.  (At least if C<Module> uses C<Exporter>'s
+C<import>, otherwise it is a fatal error.)
+
+If the module C<Module> is not loaded yet, then the above declaration
+declares functions func1() and func2() in the current package, and
+declares a function Module::func3().  When these functions are called,
+they load the package C<Module> if needed, and substitute themselves
+with the correct definitions.
+
+=head1 WARNING
+
+Using C<autouse> will move important steps of your program's execution
+from compile time to runtime.  This can
+
+=over
+
+=item *
+
+Break the execution of your program if the module you C<autouse>d has
+some initialization which it expects to be done early.
+
+=item *
+
+hide bugs in your code since important checks (like correctness of
+prototypes) is moved from compile time to runtime.  In particular, if
+the prototype you specified on C<autouse> line is wrong, you will not
+find it out until the corresponding function is executed.  This will be
+very unfortunate for functions which are not always called (note that
+for such functions C<autouse>ing gives biggest win, for a workaround
+see below).
+
+=back
+
+To alleviate the second problem (partially) it is advised to write
+your scripts like this:
+
+  use Module;
+  use autouse Module => qw(carp($) croak(&$));
+  carp "this carp was predeclared and autoused ";
+
+The first line ensures that the errors in your argument specification
+are found early.  When you ship your application you should comment
+out the first line, since it makes the second one useless.
+
+=head1 BUGS
+
+If Module::func3() is autoused, and the module is loaded between the
+C<autouse> directive and a call to Module::func3(), warnings about
+redefinition would appear if warnings are enabled.
+
+If Module::func3() is autoused, warnings are disabled when loading the
+module via autoused functions.
+
+=head1 AUTHOR
+
+Ilya Zakharevich (ilya@math.ohio-state.edu)
+
+=head1 SEE ALSO
+
+perl(1).
+
+=cut
index 379861e..e9b200b 100644 (file)
--- a/malloc.c
+++ b/malloc.c
@@ -328,8 +328,8 @@ malloc(nbytes)
        }
 
 #ifdef PERL_CORE
-    DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%lx: (%05d) malloc %ld bytes\n",
-       (unsigned long)(p+1),an++,(long)size));
+    DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%lx: (%05lu) malloc %ld bytes\n",
+       (unsigned long)(p+1),(unsigned long)(an++),(long)size));
 #endif /* PERL_CORE */
 
        /* remove from linked list */
@@ -485,7 +485,7 @@ free(mp)
 #endif 
 
 #ifdef PERL_CORE
-    DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%lx: (%05d) free\n",(unsigned long)cp,an++));
+    DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%lx: (%05lu) free\n",(unsigned long)cp,(unsigned long)(an++)));
 #endif /* PERL_CORE */
 
        if (cp == NULL)
@@ -496,7 +496,7 @@ free(mp)
        bucket = OV_INDEX(op);
 #endif 
        if (OV_MAGIC(op, bucket) != MAGIC) {
-               static bad_free_warn = -1;
+               static int bad_free_warn = -1;
                if (bad_free_warn == -1) {
                    char *pbf = getenv("PERL_BADFREE");
                    bad_free_warn = (pbf) ? atoi(pbf) : 1;
@@ -645,9 +645,9 @@ realloc(mp, nbytes)
 #ifdef PERL_CORE
 #ifdef DEBUGGING
     if (debug & 128) {
-       PerlIO_printf(PerlIO_stderr(), "0x%lx: (%05d) rfree\n",(unsigned long)res,an++);
-       PerlIO_printf(PerlIO_stderr(), "0x%lx: (%05d) realloc %ld bytes\n",
-           (unsigned long)res,an++,(long)size);
+       PerlIO_printf(PerlIO_stderr(), "0x%lx: (%05lu) rfree\n",(unsigned long)res,(unsigned long)(an++));
+       PerlIO_printf(PerlIO_stderr(), "0x%lx: (%05lu) realloc %ld bytes\n",
+           (unsigned long)res,(unsigned long)(an++),(long)size);
     }
 #endif
 #endif /* PERL_CORE */
diff --git a/mg.c b/mg.c
index 7fba763..c3e6153 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -286,7 +286,6 @@ MAGIC *mg;
            }
        }
        return 0;
-       break;
     case '+':
        if (curpm && (rx = curpm->op_pmregexp)) {
            paren = rx->lastparen;
@@ -294,7 +293,6 @@ MAGIC *mg;
                goto getparen;
        }
        return 0;
-       break;
     case '`':
        if (curpm && (rx = curpm->op_pmregexp)) {
            if ((s = rx->subbeg) && rx->startp[0]) {
@@ -607,7 +605,7 @@ MAGIC* mg;
     }
 #endif
 
-#if !defined(OS2) && !defined(AMIGAOS)
+#if !defined(OS2) && !defined(AMIGAOS) && !defined(_WIN32)
                            /* And you'll never guess what the dog had */
                            /*   in its mouth... */
     if (tainting) {
@@ -653,7 +651,7 @@ MAGIC* mg;
            }
        }
     }
-#endif /* neither OS2 nor AMIGAOS */
+#endif /* neither OS2 nor AMIGAOS nor _WIN32 */
 
     return 0;
 }
@@ -1129,15 +1127,32 @@ MAGIC* mg;
 }
 
 int
-magic_getitervar(sv,mg)
+magic_getdefelem(sv,mg)
 SV* sv;
 MAGIC* mg;
 {
     SV *targ = Nullsv;
     if (LvTARGLEN(sv)) {
-       AV* av = (AV*)LvTARG(sv);
-       if (LvTARGOFF(sv) <= AvFILL(av))
-           targ = AvARRAY(av)[LvTARGOFF(sv)];
+       if (mg->mg_obj) {
+           HV* hv = (HV*)LvTARG(sv);
+           HE* he = hv_fetch_ent(hv, mg->mg_obj, FALSE, 0);
+           if (he)
+               targ = HeVAL(he);
+       }
+       else {
+           AV* av = (AV*)LvTARG(sv);
+           if ((I32)LvTARGOFF(sv) <= AvFILL(av))
+               targ = AvARRAY(av)[LvTARGOFF(sv)];
+       }
+       if (targ && targ != &sv_undef) {
+           /* somebody else defined it for us */
+           SvREFCNT_dec(LvTARG(sv));
+           LvTARG(sv) = SvREFCNT_inc(targ);
+           LvTARGLEN(sv) = 0;
+           SvREFCNT_dec(mg->mg_obj);
+           mg->mg_obj = Nullsv;
+           mg->mg_flags &= ~MGf_REFCOUNTED;
+       }
     }
     else
        targ = LvTARG(sv);
@@ -1146,19 +1161,21 @@ MAGIC* mg;
 }
 
 int
-magic_setitervar(sv,mg)
+magic_setdefelem(sv,mg)
 SV* sv;
 MAGIC* mg;
 {
     if (LvTARGLEN(sv))
-       vivify_itervar(sv);
-    if (LvTARG(sv))
+       vivify_defelem(sv);
+    if (LvTARG(sv)) {
        sv_setsv(LvTARG(sv), sv);
+       SvSETMAGIC(LvTARG(sv));
+    }
     return 0;
 }
 
 int
-magic_freeitervar(sv,mg)
+magic_freedefelem(sv,mg)
 SV* sv;
 MAGIC* mg;
 {
@@ -1167,24 +1184,37 @@ MAGIC* mg;
 }
 
 void
-vivify_itervar(sv)
+vivify_defelem(sv)
 SV* sv;
 {
-    AV* av;
+    MAGIC* mg;
+    SV* value;
 
-    if (!LvTARGLEN(sv))
+    if (!LvTARGLEN(sv) || !(mg = mg_find(sv, 'y')))
        return;
-    av = (AV*)LvTARG(sv);
-    if (LvTARGOFF(sv) <= AvFILL(av)) {
-       SV** svp = AvARRAY(av) + LvTARGOFF(sv);
-       LvTARG(sv) = newSVsv(*svp);
-       SvREFCNT_dec(*svp);
-       *svp = SvREFCNT_inc(LvTARG(sv));
+    if (mg->mg_obj) {
+       HV* hv = (HV*)LvTARG(sv);
+       HE* he = hv_fetch_ent(hv, mg->mg_obj, TRUE, 0);
+       if (!he || (value = HeVAL(he)) == &sv_undef)
+           croak(no_helem, SvPV(mg->mg_obj, na));
     }
-    else
-       LvTARG(sv) = Nullsv;
-    SvREFCNT_dec(av);
+    else {
+       AV* av = (AV*)LvTARG(sv);
+       if (LvTARGLEN(sv) < 0 && (I32)LvTARGOFF(sv) > AvFILL(av))
+           LvTARG(sv) = Nullsv;        /* array can't be extended */
+       else {
+           SV** svp = av_fetch(av, LvTARGOFF(sv), TRUE);
+           if (!svp || (value = *svp) == &sv_undef)
+               croak(no_aelem, (I32)LvTARGOFF(sv));
+       }
+    }
+    SvREFCNT_inc(value);
+    SvREFCNT_dec(LvTARG(sv));
+    LvTARG(sv) = value;
     LvTARGLEN(sv) = 0;
+    SvREFCNT_dec(mg->mg_obj);
+    mg->mg_obj = Nullsv;
+    mg->mg_flags &= ~MGf_REFCOUNTED;
 }
 
 int
diff --git a/op.c b/op.c
index 3b05012..55b0422 100644 (file)
--- a/op.c
+++ b/op.c
@@ -389,7 +389,7 @@ pad_sv(PADOFFSET po)
 {
     if (!po)
        croak("panic: pad_sv po");
-    DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad sv %d\n", po));
+    DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad sv %lu\n", (unsigned long)po));
     return curpad[po];         /* eventually we'll turn this into a macro */
 }
 
@@ -407,7 +407,7 @@ pad_free(PADOFFSET po)
        croak("panic: pad_free curpad");
     if (!po)
        croak("panic: pad_free po");
-    DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad free %d\n", po));
+    DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad free %lu\n", (unsigned long)po));
     if (curpad[po] && !SvIMMORTAL(curpad[po]))
        SvPADTMP_off(curpad[po]);
     if ((I32)po < padix)
@@ -426,7 +426,7 @@ pad_swipe(PADOFFSET po)
        croak("panic: pad_swipe curpad");
     if (!po)
        croak("panic: pad_swipe po");
-    DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad swipe %d\n", po));
+    DEBUG_X(PerlIO_printf(Perl_debug_log, "Pad swipe %lu\n", (unsigned long)po));
     SvPADTMP_off(curpad[po]);
     curpad[po] = NEWSV(1107,0);
     SvPADTMP_on(curpad[po]);
@@ -950,6 +950,8 @@ I32 type;
        return op;
 
     switch (op->op_type) {
+    case OP_UNDEF:
+       return op;
     case OP_CONST:
        if (!(op->op_private & (OPpCONST_ARYBASE)))
            goto nomod;
@@ -1045,7 +1047,6 @@ I32 type;
            croak("Can't localize a reference");
        ref(cUNOP->op_first, op->op_type); 
        /* FALL THROUGH */
-    case OP_UNDEF:
     case OP_GV:
     case OP_AV2ARYLEN:
     case OP_SASSIGN:
@@ -1086,6 +1087,9 @@ I32 type;
     case OP_AELEM:
     case OP_HELEM:
        ref(cBINOP->op_first, op->op_type);
+       if (type == OP_ENTERSUB &&
+            !(op->op_private & (OPpLVAL_INTRO | OPpDEREF)))
+           op->op_private |= OPpLVAL_DEFER;
        modcount++;
        break;
 
@@ -2510,16 +2514,20 @@ OP* other;
            break;
 
        case OP_SASSIGN:
-           if (k1->op_type == OP_READDIR || k1->op_type == OP_GLOB)
+           if (k1->op_type == OP_READDIR
+                 || k1->op_type == OP_GLOB
+                 || k1->op_type == OP_EACH)
                warnop = k1->op_type;
            break;
        }
        if (warnop) {
            line_t oldline = curcop->cop_line;
            curcop->cop_line = copline;
-           warn("Value of %s construct can be \"0\"; test with defined()",
-                op_desc[warnop]);
-               curcop->cop_line = oldline;
+           warn("Value of %s%s can be \"0\"; test with defined()",
+                op_desc[warnop],
+                ((warnop == OP_READLINE || warnop == OP_GLOB)
+                 ? " construct" : "() operator"));
+           curcop->cop_line = oldline;
        }
     }
 
@@ -2951,6 +2959,9 @@ CV* outside;
     if (outside)
        CvOUTSIDE(cv)   = (CV*)SvREFCNT_inc(outside);
 
+    if (SvPOK(proto))
+       sv_setpvn((SV*)cv, SvPVX(proto), SvCUR(proto));
+
     comppad = newAV();
 
     comppadlist = newAV();
@@ -3079,37 +3090,33 @@ OP *block;
 
     if (op)
        SAVEFREEOP(op);
-    if (cv = (name ? GvCV(gv) : Nullcv)) {
-       if (GvCVGEN(gv)) {
-           /* just a cached method */
-           SvREFCNT_dec(cv);
-           cv = 0;
+    if (!name || GvCVGEN(gv))
+       cv = Nullcv;
+    else if (cv = GvCV(gv)) {
+       /* prototype mismatch? */
+       char *p = proto ? SvPVx(((SVOP*)proto)->op_sv, na) : Nullch;
+       if ((!proto != !SvPOK(cv)) || (p && strNE(p, SvPVX(cv)))) {
+           warn("Prototype mismatch: (%s) vs (%s)",
+                SvPOK(cv) ? SvPVX(cv) : "none", p ? p : "none");
        }
-       else if (CvROOT(cv) || CvXSUB(cv) || GvASSUMECV(gv)) {
-           /* already defined (or promised) */
-
-           SV* const_sv = cv_const_sv(cv);
-           char *p = proto ? SvPVx(((SVOP*)proto)->op_sv, na) : Nullch;
-
-           if((!proto != !SvPOK(cv)) || (p && strNE(SvPV((SV*)cv,na), p))) {
-               warn("Prototype mismatch: (%s) vs (%s)",
-                       SvPOK(cv) ? SvPV((SV*)cv,na) : "none",
-                       p ? p : "none");
-           }
+       /* already defined (or promised)? */
+       if (CvROOT(cv) || CvXSUB(cv) || GvASSUMECV(gv)) {
+           SV* const_sv;
            if (!block) {
                /* just a "sub foo;" when &foo is already defined */
                SAVEFREESV(compcv);
                goto done;
            }
+           const_sv = cv_const_sv(cv);
            if (const_sv || dowarn) {
                line_t oldline = curcop->cop_line;
                curcop->cop_line = copline;
                warn(const_sv ? "Constant subroutine %s redefined"
-                             : "Subroutine %s redefined",name);
+                    : "Subroutine %s redefined", name);
                curcop->cop_line = oldline;
            }
            SvREFCNT_dec(cv);
-           cv = 0;
+           cv = Nullcv;
        }
     }
     if (cv) {                          /* must reuse cv if autoloaded */
@@ -3144,6 +3151,12 @@ OP *block;
     if (error_count) {
        op_free(block);
        block = Nullop;
+       if (name) {
+           char *s = strrchr(name, ':');
+           s = s ? s+1 : name;
+           if (strEQ(s, "BEGIN"))
+               croak("BEGIN not safe after errors--compilation aborted");
+       }
     }
     if (!block) {
        copline = NOLINE;
@@ -3205,7 +3218,7 @@ OP *block;
            s++;
        else
            s = name;
-       if (strEQ(s, "BEGIN") && !error_count) {
+       if (strEQ(s, "BEGIN")) {
            I32 oldscope = scopestack_ix;
            ENTER;
            SAVESPTR(compiling.cop_filegv);
@@ -3219,7 +3232,7 @@ OP *block;
            DEBUG_x( dump_sub(gv) );
            av_push(beginav, (SV *)cv);
            GvCV(gv) = 0;
-           calllist(oldscope, beginav);
+           call_list(oldscope, beginav);
 
            curcop = &compiling;
            LEAVE;
@@ -4414,6 +4427,7 @@ OP *op;
        }
        else
            list(o);
+       mod(o, OP_ENTERSUB);
        prev = o;
        o = o->op_sibling;
     }
@@ -4520,7 +4534,8 @@ register OP* o;
                if (pop->op_type == OP_CONST &&
                    (op = pop->op_next) &&
                    pop->op_next->op_type == OP_AELEM &&
-                   !(pop->op_next->op_private & (OPpDEREF|OPpLVAL_INTRO)) &&
+                   !(pop->op_next->op_private &
+                     (OPpLVAL_INTRO|OPpLVAL_DEFER|OPpDEREF)) &&
                    (i = SvIV(((SVOP*)pop)->op_sv) - compiling.cop_arybase)
                                <= 255 &&
                    i >= 0)
diff --git a/op.h b/op.h
index 67435f9..630e94a 100644 (file)
--- a/op.h
+++ b/op.h
@@ -83,13 +83,16 @@ typedef U32 PADOFFSET;
 #define OPpREPEAT_DOLIST       64      /* List replication. */
 
 /* Private for OP_ENTERSUB, OP_RV2?V, OP_?ELEM */
-  /* (lower bits carry hints) */
-#define OPpENTERSUB_AMPER      8       /* Used & form to call. */
-#define OPpENTERSUB_DB         16      /* Debug subroutine. */
 #define OPpDEREF               (32|64) /* Want ref to something: */
 #define OPpDEREF_AV            32      /*   Want ref to AV. */
 #define OPpDEREF_HV            64      /*   Want ref to HV. */
 #define OPpDEREF_SV            (32|64) /*   Want ref to SV. */
+  /* OP_ENTERSUB only */
+#define OPpENTERSUB_DB         16      /* Debug subroutine. */
+#define OPpENTERSUB_AMPER      8       /* Used & form to call. */
+  /* OP_?ELEM only */
+#define OPpLVAL_DEFER          16      /* Defer creation of array/hash elem */
+  /* for OP_RV2?V, lower bits carry hints */
 
 /* Private for OP_CONST */
 #define OPpCONST_ENTERED       16      /* Has been entered as symbol. */
index 15e2194..f7cc9dd 100644 (file)
@@ -1,5 +1,5 @@
 #define PATCHLEVEL 3
-#define SUBVERSION 93
+#define SUBVERSION 94
 
 /*
        local_patches -- list of locally applied less-than-subversion patches.
diff --git a/perl.c b/perl.c
index 06534ff..dfda39f 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -510,7 +510,7 @@ setuid perl scripts securely.\n");
            LEAVE;
        curstash = defstash;
        if (endav)
-           calllist(oldscope, endav);
+           call_list(oldscope, endav);
        return STATUS_NATIVE_EXPORT;
     case 3:
        mustcatch = FALSE;
@@ -685,8 +685,12 @@ setuid perl scripts securely.\n");
     if (!scriptname)
        scriptname = argv[0];
     if (e_fp) {
-       if (PerlIO_flush(e_fp) || PerlIO_error(e_fp) || PerlIO_close(e_fp))
+       if (PerlIO_flush(e_fp) || PerlIO_error(e_fp) || PerlIO_close(e_fp)) {
+#ifndef MULTIPLICITY
+           warn("Did you forget to compile with -DMULTIPLICITY?");
+#endif     
            croak("Can't write to temp file for -e: %s", Strerror(errno));
+       }
        e_fp = Nullfp;
        argc++,argv--;
        scriptname = e_tmpname;
@@ -804,7 +808,7 @@ PerlInterpreter *sv_interp;
            LEAVE;
        curstash = defstash;
        if (endav)
-           calllist(oldscope, endav);
+           call_list(oldscope, endav);
        FREETMPS;
 #ifdef DEBUGGING_MSTATS
        if (getenv("PERL_DEBUG_MSTATS"))
@@ -2437,7 +2441,7 @@ int addsubdirs;
 }
 
 void
-calllist(oldscope, list)
+call_list(oldscope, list)
 I32 oldscope;
 AV* list;
 {
@@ -2481,7 +2485,7 @@ AV* list;
                LEAVE;
            curstash = defstash;
            if (endav)
-               calllist(oldscope, endav);
+               call_list(oldscope, endav);
            FREETMPS;
            Copy(oldtop, top_env, 1, Sigjmp_buf);
            curcop = &compiling;
diff --git a/perl.h b/perl.h
index dace51d..42740ba 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -80,7 +80,7 @@
  */
 
 /* define this once if either system, instead of cluttering up the src */
-#if defined(MSDOS) || defined(atarist)
+#if defined(MSDOS) || defined(atarist) || defined(WIN32)
 #define DOSISH 1
 #endif
 
 # define STANDARD_C 1
 #endif
 
+#if defined(__cplusplus) || defined(WIN32)
+# define DONT_DECLARE_STD 1
+#endif
+
 #if defined(HASVOLATILE) || defined(STANDARD_C)
 #   ifdef __cplusplus
 #      define VOL              // to temporarily suppress warnings
 #       ifdef VMS
        char *strerror _((int,...));
 #       else
+#ifndef DONT_DECLARE_STD
        char *strerror _((int));
+#endif
 #       endif
 #       ifndef Strerror
 #           define Strerror strerror
 #   endif
 #endif
 
-#ifdef VMS
-#   define STATUS_NATIVE       statusvalue_vms
-#   define STATUS_NATIVE_EXPORT \
-       ((I32)statusvalue_vms == -1 ? 44 : statusvalue_vms)
-#   define STATUS_NATIVE_SET(n)                                                \
-       STMT_START {                                                    \
-           statusvalue_vms = (n);                                      \
-           if ((I32)statusvalue_vms == -1)                             \
-               statusvalue = -1;                                       \
-           else if (statusvalue_vms & STS$M_SUCCESS)                   \
-               statusvalue = 0;                                        \
-           else if ((statusvalue_vms & STS$M_SEVERITY) == 0)           \
-               statusvalue = 1 << 8;                                   \
-           else                                                        \
-               statusvalue = (statusvalue_vms & STS$M_SEVERITY) << 8;  \
-       } STMT_END
-#   define STATUS_POSIX        statusvalue
-#   ifdef VMSISH_STATUS
-#      define STATUS_CURRENT   (VMSISH_STATUS ? STATUS_NATIVE : STATUS_POSIX)
-#   else
-#      define STATUS_CURRENT   STATUS_POSIX
-#   endif
-#   define STATUS_POSIX_SET(n)                         \
-       STMT_START {                                    \
-           statusvalue = (n);                          \
-           if (statusvalue != -1) {                    \
-               statusvalue &= 0xFFFF;                  \
-               statusvalue_vms = statusvalue ? 44 : 1; \
-           }                                           \
-           else statusvalue_vms = -1;                  \
-       } STMT_END
-#   define STATUS_ALL_SUCCESS  (statusvalue = 0, statusvalue_vms = 1)
-#   define STATUS_ALL_FAILURE  (statusvalue = 1, statusvalue_vms = 44)
-#else
-#   define STATUS_NATIVE       STATUS_POSIX
-#   define STATUS_NATIVE_EXPORT        STATUS_POSIX
-#   define STATUS_NATIVE_SET   STATUS_POSIX_SET
-#   define STATUS_POSIX                statusvalue
-#   define STATUS_POSIX_SET(n)         \
-       STMT_START {                    \
-           statusvalue = (n);          \
-           if (statusvalue != -1)      \
-               statusvalue &= 0xFFFF;  \
-       } STMT_END
-#   define STATUS_CURRENT STATUS_POSIX
-#   define STATUS_ALL_SUCCESS  (statusvalue = 0)
-#   define STATUS_ALL_FAILURE  (statusvalue = 1)
-#endif
-
 #ifdef I_SYS_IOCTL
 #   ifndef _IOCTL_
 #      include <sys/ioctl.h>
@@ -955,6 +912,55 @@ typedef I32 (*filter_t) _((int, SV *, int));
 # endif
 #endif
   
+#ifdef VMS
+#   define STATUS_NATIVE       statusvalue_vms
+#   define STATUS_NATIVE_EXPORT \
+       ((I32)statusvalue_vms == -1 ? 44 : statusvalue_vms)
+#   define STATUS_NATIVE_SET(n)                                                \
+       STMT_START {                                                    \
+           statusvalue_vms = (n);                                      \
+           if ((I32)statusvalue_vms == -1)                             \
+               statusvalue = -1;                                       \
+           else if (statusvalue_vms & STS$M_SUCCESS)                   \
+               statusvalue = 0;                                        \
+           else if ((statusvalue_vms & STS$M_SEVERITY) == 0)           \
+               statusvalue = 1 << 8;                                   \
+           else                                                        \
+               statusvalue = (statusvalue_vms & STS$M_SEVERITY) << 8;  \
+       } STMT_END
+#   define STATUS_POSIX        statusvalue
+#   ifdef VMSISH_STATUS
+#      define STATUS_CURRENT   (VMSISH_STATUS ? STATUS_NATIVE : STATUS_POSIX)
+#   else
+#      define STATUS_CURRENT   STATUS_POSIX
+#   endif
+#   define STATUS_POSIX_SET(n)                         \
+       STMT_START {                                    \
+           statusvalue = (n);                          \
+           if (statusvalue != -1) {                    \
+               statusvalue &= 0xFFFF;                  \
+               statusvalue_vms = statusvalue ? 44 : 1; \
+           }                                           \
+           else statusvalue_vms = -1;                  \
+       } STMT_END
+#   define STATUS_ALL_SUCCESS  (statusvalue = 0, statusvalue_vms = 1)
+#   define STATUS_ALL_FAILURE  (statusvalue = 1, statusvalue_vms = 44)
+#else
+#   define STATUS_NATIVE       STATUS_POSIX
+#   define STATUS_NATIVE_EXPORT        STATUS_POSIX
+#   define STATUS_NATIVE_SET   STATUS_POSIX_SET
+#   define STATUS_POSIX                statusvalue
+#   define STATUS_POSIX_SET(n)         \
+       STMT_START {                    \
+           statusvalue = (n);          \
+           if (statusvalue != -1)      \
+               statusvalue &= 0xFFFF;  \
+       } STMT_END
+#   define STATUS_CURRENT STATUS_POSIX
+#   define STATUS_ALL_SUCCESS  (statusvalue = 0)
+#   define STATUS_ALL_FAILURE  (statusvalue = 1)
+#endif
+
 /* Some unistd.h's give a prototype for pause() even though
    HAS_PAUSE ends up undefined.  This causes the #define
    below to be rejected by the compmiler.  Sigh.
@@ -1178,7 +1184,7 @@ struct ufuncs {
 };
 
 /* Fix these up for __STDC__ */
-#ifndef __cplusplus
+#ifndef DONT_DECLARE_STD
 char *mktemp _((char*));
 double atof _((const char*));
 #endif
@@ -1217,10 +1223,12 @@ char *crypt ();       /* Maybe more hosts will need the unprototyped version */
 #else
 char *crypt _((const char*, const char*));
 #endif
+#ifndef DONT_DECLARE_STD
 #ifndef getenv
 char *getenv _((const char*));
 #endif
 Off_t lseek _((int,Off_t,int));
+#endif
 char *getlogin _((void));
 #endif
 
@@ -1278,7 +1286,9 @@ typedef Sighandler_t Sigsave_t;
 EXT PerlInterpreter *  curinterp;      /* currently running interpreter */
 /* VMS doesn't use environ array and NeXT has problems with crt0.o globals */
 #if !defined(VMS) && !(defined(NeXT) && defined(__DYNAMIC__))
+#ifndef DONT_DECLARE_STD
 extern char ** environ;        /* environment variables supplied via exec */
+#endif
 #else
 #  if defined(NeXT) && defined(__DYNAMIC__)
 
@@ -1957,8 +1967,8 @@ EXT MGVTBL vtbl_fm =      {0,     magic_setfm,
 EXT MGVTBL vtbl_uvar = {magic_getuvar,
                                magic_setuvar,
                                        0,      0,      0};
-EXT MGVTBL vtbl_itervar = {magic_getitervar,magic_setitervar,
-                                       0,      0,      magic_freeitervar};
+EXT MGVTBL vtbl_defelem = {magic_getdefelem,magic_setdefelem,
+                                       0,      0,      magic_freedefelem};
 
 #ifdef USE_LOCALE_COLLATE
 EXT MGVTBL vtbl_collxfrm = {0,
@@ -1996,7 +2006,7 @@ EXT MGVTBL vtbl_pos;
 EXT MGVTBL vtbl_bm;
 EXT MGVTBL vtbl_fm;
 EXT MGVTBL vtbl_uvar;
-EXT MGVTBL vtbl_itervar;
+EXT MGVTBL vtbl_defelem;
 
 #ifdef USE_LOCALE_COLLATE
 EXT MGVTBL vtbl_collxfrm;
index 97d00f4..49489ad 100644 (file)
@@ -1 +1 @@
-p9pvers = 5.003_93
+p9pvers = 5.003_94
index cf1e7a4..0ec08f9 100644 (file)
@@ -38,6 +38,16 @@ POD = \
        perlxstut.pod   \
        perlguts.pod    \
        perlcall.pod    \
+       perlfaq.pod     \
+       perlfaq1.pod    \
+       perlfaq2.pod    \
+       perlfaq3.pod    \
+       perlfaq4.pod    \
+       perlfaq5.pod    \
+       perlfaq6.pod    \
+       perlfaq7.pod    \
+       perlfaq8.pod    \
+       perlfaq9.pod    \
        perltoc.pod
 
 MAN = \
@@ -75,6 +85,16 @@ MAN = \
        perlxstut.man   \
        perlguts.man    \
        perlcall.man    \
+       perlfaq.man     \
+       perlfaq1.man    \
+       perlfaq2.man    \
+       perlfaq3.man    \
+       perlfaq4.man    \
+       perlfaq5.man    \
+       perlfaq6.man    \
+       perlfaq7.man    \
+       perlfaq8.man    \
+       perlfaq9.man    \
        perltoc.man
 
 HTML = \
@@ -112,6 +132,16 @@ HTML = \
        perlxstut.html  \
        perlguts.html   \
        perlcall.html   \
+       perlfaq.html    \
+       perlfaq1.html   \
+       perlfaq2.html   \
+       perlfaq3.html   \
+       perlfaq4.html   \
+       perlfaq5.html   \
+       perlfaq6.html   \
+       perlfaq7.html   \
+       perlfaq8.html   \
+       perlfaq9.html   \
        perltoc.html
 
 TEX = \
@@ -149,6 +179,16 @@ TEX = \
        perlxstut.tex   \
        perlguts.tex    \
        perlcall.tex    \
+       perlfaq.tex     \
+       perlfaq1.tex    \
+       perlfaq2.tex    \
+       perlfaq3.tex    \
+       perlfaq4.tex    \
+       perlfaq5.tex    \
+       perlfaq6.tex    \
+       perlfaq7.tex    \
+       perlfaq8.tex    \
+       perlfaq9.tex    \
        perltoc.tex
 
 man:  pod2man $(MAN)
index e8557c7..31712e2 100644 (file)
@@ -5,11 +5,13 @@ use Text::Wrap;
 sub output ($);
 
 @pods = qw(
-           perl perldelta perldata perlsyn perlop perlre perlrun perlfunc
-           perlvar perlsub perlmod perlform perllocale perlref perldsc
-           perllol perltoot perlobj perltie perlbot perlipc perldebug
-           perldiag perlsec perltrap perlstyle perlpod perlbook perlembed
-           perlapio perlxs perlxstut perlguts perlcall
+          perl perlfaq perlfaq1 perlfaq2 perlfaq3 perlfaq4 perlfaq5
+          perlfaq6 perlfaq7 perlfaq8 perlfaq9 perldelta perldata
+          perlsyn perlop perlre perlrun perlfunc perlvar perlsub
+          perlmod perlform perllocale perlref perldsc perllol perltoot
+          perlobj perltie perlbot perlipc perldebug perldiag perlsec
+          perltrap perlstyle perlpod perlbook perlembed perlapio perlxs
+          perlxstut perlguts perlcall
          );
 
 for (@pods) { s/$/.pod/ }
index f3ddc3c..2c1dde2 100644 (file)
@@ -20,6 +20,7 @@ of sections:
 
     perl       Perl overview (this section)
     perldelta  Perl changes since previous version
+    perlfaq    Perl frequently asked questions
 
     perldata   Perl data structures
     perlsyn    Perl syntax
@@ -219,7 +220,7 @@ optimized C code.
 
 =back
 
-Ok, that's I<definitely> enough hype.
+Okay, that's I<definitely> enough hype.
 
 =head1 ENVIRONMENT
 
index 9a4a886..1ff71fc 100644 (file)
@@ -565,7 +565,7 @@ Next, we come to XPUSHs. This is where the parameters actually get
 pushed onto the stack. In this case we are pushing a string and an
 integer.
 
-See the L<perlguts/"XSUB's and the Argument Stack"> for details
+See the L<perlguts/"XSUBs and the Argument Stack"> for details
 on how the XPUSH macros work.
 
 =item 6.
@@ -668,7 +668,7 @@ an alternative to using these macros.
 
 The purpose of the macro C<SPAGAIN> is to refresh the local copy of the
 stack pointer. This is necessary because it is possible that the memory
-allocated to the Perl stack has been re-allocated whilst in the
+allocated to the Perl stack has been reallocated whilst in the
 I<perl_call_pv> call.
 
 If you are making use of the Perl stack pointer in your code you must
index 1878f4a..f0837b3 100644 (file)
@@ -247,6 +247,11 @@ The usual Unix backslash rules apply for making characters such as
 newline, tab, etc., as well as some more exotic forms.  See
 L<perlop/Quote and Quotelike Operators> for a list.
 
+Octal or hex representations in string literals (e.g. '0xffff') are not
+automatically converted to their integer representation.  The hex() and
+oct() functions make these conversions for you.  See L<perlfunc/hex> and
+L<perlfunc/oct> for more details.
+
 You can also embed newlines directly in your strings, i.e., they can end
 on a different line than they begin.  This is nice, but if you forget
 your trailing quote, the error will not be reported until Perl finds
@@ -279,16 +284,19 @@ single-quoted string must be separated from a preceding word by a
 space, because single quote is a valid (though deprecated) character in
 a variable name (see L<perlmod/Packages>).
 
-Two special literals are __LINE__ and __FILE__, which represent the
-current line number and filename at that point in your program.  They
-may be used only as separate tokens; they will not be interpolated into
-strings.  In addition, the token __END__ may be used to indicate the
-logical end of the script before the actual end of file.  Any following
-text is ignored, but may be read via the DATA filehandle.  (The DATA
-filehandle may read data from only the main script, but not from any
-required file or evaluated string.)  The two control characters ^D and
-^Z are synonyms for __END__ (or __DATA__ in a module; see L<SelfLoader> for 
-details on __DATA__).
+Three special literals are __FILE__, __LINE__, and __PACKAGE__, which
+represent the current filename, line number, and package name at that
+point in your program.  They may be used only as separate tokens; they
+will not be interpolated into strings.  If there is no current package
+(due to a C<package;> directive), __PACKAGE__ is the undefined value.
+
+The tokens __END__ and __DATA__ may be used to indicate the logical end
+of the script before the actual end of file.  Any following text is
+ignored, but may be read via a DATA filehandle: main::DATA for __END__,
+or PACKNAME::DATA (where PACKNAME is the current package) for __DATA__.
+The two control characters ^D and ^Z are synonyms for __END__ (or
+__DATA__ in a module).  See L<SelfLoader> for more description of
+__DATA__, and an example of its use.
 
 A word that has no other interpretation in the grammar will
 be treated as if it were a quoted string.  These are known as
@@ -440,6 +448,11 @@ put the list in parentheses to avoid ambiguity.  Examples:
     # A "reverse comma operator".
     return (pop(@foo),pop(@foo))[0];
 
+You may assign to C<undef> in a list.  This is useful for throwing
+away some of the return values of a function:
+
+    ($dev, $ino, undef, undef, $uid, $gid) = stat($file);
+
 Lists may be assigned to if and only if each element of the list
 is legal to assign to:
 
index a682de1..61263b6 100644 (file)
@@ -11,7 +11,7 @@ First of all, have you tried using the B<-w> switch?
 If you invoke Perl with the B<-d> switch, your script runs under the
 Perl source debugger.  This works like an interactive Perl
 environment, prompting for debugger commands that let you examine
-source code, set breakpoints, get stack back-traces, change the values of
+source code, set breakpoints, get stack backtraces, change the values of
 variables, etc.  This is so convenient that you often fire up
 the debugger all by itself just to test out Perl constructs 
 interactively to see what they do.  For example:
@@ -102,7 +102,7 @@ Same as C<V currentpackage [vars]>.
 
 =item T
 
-Produce a stack back-trace.  See below for details on its output.
+Produce a stack backtrace.  See below for details on its output.
 
 =item s [expr]
 
@@ -620,7 +620,7 @@ commands typed into the debugger.
 
 =item Stack backtrace
 
-Here's an example of what a stack back-trace via C<T> command might
+Here's an example of what a stack backtrace via C<T> command might
 look like:
 
     $ = main::infested called from file `Ambulation.pm' line 10
@@ -1056,4 +1056,4 @@ You cannot get the stack frame information or otherwise debug functions
 that were not compiled by Perl, such as C or C++ extensions.
 
 If you alter your @_ arguments in a subroutine (such as with B<shift>
-or B<pop>, the stack back-trace will not show the original values.
+or B<pop>, the stack backtrace will not show the original values.
index cf6036f..958bee3 100644 (file)
@@ -27,7 +27,7 @@ might have symbol conflicts if you embed Perl in another application,
 just as in the 5.003 release.  By default, binary compatibility
 is preserved at the expense of symbol table pollution.
 
-=head2 Subroutine Parameters Are Not Autovivified
+=head2 No Autovivification of Subroutine Parameters
 
 In Perl versions 5.002 and 5.003, array and hash elements used as
 subroutine parameters were "autovivified"; that is, they were brought
@@ -47,6 +47,13 @@ fixed.  As a result, the string "$$0" is no longer equivalent to
 C<$$."0">, but rather to C<${$0}>.  To get the old behavior, change
 "$$" followed by a digit to "${$}".
 
+=head2 No Resetting of $. on Implicit Close
+
+The documentation for Perl 5.0 has always stated that C<$.> is I<not>
+reset when an already-open file handle is re-opened with no intervening
+call to C<close>.  Due to a bug, perl versions 5.000 through 5.0003
+I<did> reset C<$.> under that circumstance; Perl 5.004 does not.
+
 =head2 Changes to Tainting Checks
 
 A bug in previous versions may have failed to detect some insecure
@@ -64,6 +71,15 @@ application of opcode masks.  The revised Safe module has a new API
 and is implemented using the new Opcode module.  Please read the new
 Opcode and Safe documentation.
 
+=head2 Embedding Improvements
+
+In older versions of Perl it was not possible to create more than one
+Perl interpreter instance inside a single process without leaking like a
+sieve and/or crashing.  The bugs that caused this behavior have all been
+fixed.  However, you still must take care when embedding Perl in a C
+program.  See the updated perlembed manpage for tips on how to manage
+your interpreters.
+
 =head2 Internal Change: FileHandle Class Based on IO::* Classes
 
 File handles are now stored internally as type IO::Handle.  The
@@ -124,8 +140,8 @@ This now works.  (e.g. C<delete @ENV{'PATH', 'MANPATH'}>)
 
 =item flock
 
-is now supported on more platforms, and prefers fcntl
-to lockf when emulating.
+is now supported on more platforms, prefers fcntl to lockf when
+emulating, and always flushes before (un)locking.
 
 =item printf and sprintf
 
@@ -283,7 +299,7 @@ are inherited by all other classes:
 
 =item isa(CLASS)
 
-C<isa> returns I<true> if its object is blessed into a sub-class of C<CLASS>
+C<isa> returns I<true> if its object is blessed into a subclass of C<CLASS>
 
 C<isa> is also exportable and can be called as a sub with two arguments. This
 allows the ability to check what a reference points to. Example:
@@ -459,7 +475,7 @@ a fixed value are now inlined (e.g. C<sub PI () { 3.14159 }>).
 
 Each unique hash key is only allocated once, no matter how many hashes
 have an entry with that key.  So even if you have 100 copies of the
-same hash, the hash keys never have to be re-allocated.
+same hash, the hash keys never have to be reallocated.
 
 =head1 Pragmata
 
index 24b1612..e0a23b0 100644 (file)
@@ -16,8 +16,8 @@ desperation):
     (A) An alien error message (not generated by Perl).
 
 Optional warnings are enabled by using the B<-w> switch.  Warnings may
-be captured by setting C<$SIG{__WARN__}> to a reference to a routine that will be
-called on each warning instead of printing it.  See L<perlvar>.
+be captured by setting C<$SIG{__WARN__}> to a reference to a routine that
+will be called on each warning instead of printing it.  See L<perlvar>.
 Trappable errors may be trapped using the eval operator.  See
 L<perlfunc/eval>.
 
@@ -339,6 +339,14 @@ Perl yourself.
 (F) An untrapped exception was raised while executing a BEGIN subroutine.
 Compilation stops immediately and the interpreter is exited.
 
+=item BEGIN not safe after errors--compilation aborted
+
+(F) Perl found a C<BEGIN {}> subroutine (or a C<use> directive, which
+implies a C<BEGIN {}>) after one or more compilation errors had
+already occurred.  Since the intended environment for the C<BEGIN {}>
+could not be guaranteed (due to the errors), and since subsequent code
+likely depends on its correct operation, Perl just gave up.
+
 =item bind() on closed fd
 
 (W) You tried to do a bind on a closed socket.  Did you forget to check
@@ -646,7 +654,7 @@ buffer.
 
 =item Can't open %s: %s
 
-(S) An inplace edit couldn't open the original file for the indicated reason.
+(S) An in-place edit couldn't open the original file for the indicated reason.
 Usually this is because you don't have read permission for the file.
 
 =item Can't open bidirectional pipe
@@ -1066,8 +1074,8 @@ the line, and you really meant a "less than".
 
 =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"), or explicitly qualified to
+(F) You've said "use strict vars", which indicates that all variables
+must either be lexically scoped (using "my"), or explicitly qualified to
 say which package the global variable is in (using "::").
 
 =item goto must have label
@@ -1099,8 +1107,20 @@ or it may indicate that a logical name table has been corrupted.
 
 (F) A carriage return character was found in the input.  This is an
 error, and not a warning, because carriage return characters can break
-here documents (e.g. C<print E<lt>E<lt>EOF;>).  Note that Perl always
-opens scripts in text mode, so this error should only occur in C<eval>.
+here documents (e.g., C<print E<lt>E<lt>EOF;>).
+  
+Under UNIX, this error is usually caused by executing Perl code --
+either the main program, a module, or an eval'd string -- that was
+transferred over a network connection from a non-UNIX system without
+properly converting the text file format.
+
+Under systems that use something other than '\n' to delimit lines of
+text, this error can also be caused by reading Perl code from a file
+handle that is in binary mode (as set by the C<binmode> operator).
+
+In either case, the Perl code in question will probably need to be
+converted with something like C<s/\x0D\x0A?/\n/g> before it can be
+executed.
 
 =item Illegal division by zero
 
@@ -1301,10 +1321,10 @@ like C<$foo[1][2][3]>, as in C.
 
 =item Name "%s::%s" used only once: possible typo
 
-(W) Typographical errors often show up as unique variable names.  If you
-had a good reason for having a unique name, then just mention it
-again somehow to suppress the message (the C<use vars> pragma is
-provided for just this purpose).
+(W) Typographical errors often show up as unique variable names.
+If you had a good reason for having a unique name, then just mention
+it again somehow to suppress the message.  The C<use vars> pragma is
+provided for just this purpose.
 
 =item Negative length
 
@@ -1796,7 +1816,7 @@ old-fashioned way, with quotes and commas:
 =item Possible attempt to separate words with commas
 
 (W) qw() lists contain items separated by whitespace; therefore commas
-aren't needed to separate the items. (You may have used different
+aren't needed to separate the items.  (You may have used different
 delimiters than the parentheses shown here; braces are also frequently
 used.)
 
@@ -1826,9 +1846,10 @@ is now misinterpreted as
 
     open(FOO || die);
 
-because of the strict regularization of Perl 5's grammar into unary and
-list operators.  (The old open was a little of both.) You must put
-parentheses around the filehandle, or use the new "or" operator instead of "||".
+because of the strict regularization of Perl 5's grammar into unary
+and list operators.  (The old open was a little of both.)  You must
+put parentheses around the filehandle, or use the new "or" operator
+instead of "||".
 
 =item print on closed filehandle %s
 
@@ -2104,7 +2125,7 @@ may break this.
 
 (P) The substitution was looping infinitely.  (Obviously, a
 substitution shouldn't iterate more times than there are characters of
-input, which is what happened.) See the discussion of substitution in
+input, which is what happened.)  See the discussion of substitution in
 L<perlop/"Quote and Quote-like Operators">.
 
 =item Substitution pattern not terminated
@@ -2490,13 +2511,13 @@ L<perlref> for more on this.
 (W) A copy of the object returned from C<tie> (or C<tied>) was still
 valid when C<untie> was called.
 
-=item Value of %s construct can be "0"; test with defined()
+=item Value of %s can be "0"; test with defined()
 
-(W) In a conditional expression, you used <HANDLE>, <*> (glob), or
-C<readdir> as a boolean value.  Each of these constructs can return a
-value of "0"; that would make the conditional expression false, which
-is probably not what you intended.  When using these constructs in
-conditional expressions, test their values with the C<defined> operator.
+(W) In a conditional expression, you used <HANDLE>, <*> (glob), C<each()>,
+or C<readdir()> as a boolean value.  Each of these constructs can return a
+value of "0"; that would make the conditional expression false, which is
+probably not what you intended.  When using these constructs in conditional
+expressions, test their values with the C<defined> operator.
 
 =item Variable "%s" is not imported%s
 
index fad539c..61c45b9 100644 (file)
@@ -324,7 +324,7 @@ example, given the assignment to $LoL above, here's the debugger output:
          2  'elroy'
          3  'judy'
 
-There's also a lower-case B<x> command which is nearly the same.
+There's also a lowercase B<x> command which is nearly the same.
 
 =head1 CODE EXAMPLES
 
diff --git a/pod/perlfaq.pod b/pod/perlfaq.pod
new file mode 100644 (file)
index 0000000..8db316c
--- /dev/null
@@ -0,0 +1,138 @@
+=head1 NAME
+
+perlfaq - frequently asked questions about Perl ($Date: 1997/03/17 22:17:56 $)
+
+=head1 DESCRIPTION
+
+This document is structured into the following sections:
+
+=over
+
+=item perlfaq: Structural overview of the FAQ.
+
+This document.
+
+=item L<perlfaq1>: General Questions About Perl
+
+Very general, high-level information about Perl.
+
+=item L<perlfaq2>: Obtaining and Learning about Perl
+
+Where to find source and documentation to Perl, support and training,
+and related matters.
+
+=item L<perlfaq3>: Programming Tools
+
+Programmer tools and programming support.
+
+=item L<perlfaq4>: Data Manipulation
+
+Manipulating numbers, dates, strings, arrays, hashes, and
+miscellaneous data issues.
+
+=item L<perlfaq5>: Files and Formats
+
+I/O and the "f" issues: filehandles, flushing, formats and footers.
+
+=item L<perlfaq6>: Regexps
+
+Pattern matching and regular expressions.
+
+=item L<perlfaq7>: General Perl Language Issues
+
+General Perl language issues that don't clearly fit into any of the
+other sections.
+
+=item L<perlfaq8>: System Interaction
+
+Interprocess communication (IPC), control over the user-interface
+(keyboard, screen and pointing devices).
+
+=item L<perlfaq9>: Networking
+
+Networking, the Internet, and a few on the web.
+
+=back
+
+=head2 Where to get this document
+
+This document is posted regularly to comp.lang.perl.announce and
+several other related newsgroups.  It is available in a variety of
+formats from CPAN in the /CPAN/doc/FAQs/FAQ/ directory, or on the web
+at http://www.perl.com/perl/faq/ .
+
+=head2 How to contribute to this document
+
+You may mail corrections, additions, and suggestions to
+perlfaq-suggestions@perl.com.  Mail sent to the old perlfaq alias will
+merely cause the FAQ to be sent to you.
+
+=head2 What will happen if you mail your Perl programming problems to the authors
+
+Your questions will probably go unread, unless they're suggestions of
+new questions to add to the FAQ, in which case they should have gone
+to the perlfaq-suggestions@perl.com instead.
+
+You should have read section 2 of this faq.  There you would have
+learned that comp.lang.perl.misc is the appropriate place to go for
+free advice.  If your question is really important and you require a
+prompt and correct answer, you should hire a consultant.
+
+=head1 Credits
+
+When I first began the Perl FAQ in the late 80s, I never realized it
+would have grown to over a hundred pages, nor that Perl would ever become
+so popular and widespread.  This document could not have been written
+without the tremendous help provided by Larry Wall and the rest of the
+Perl Porters.
+
+=head1 Author and Copyright Information
+
+Copyright (c) 1997 Tom Christiansen and Nathan Torkington.
+All rights reserved.
+
+=head2 Non-commercial Reproduction
+
+Permission is granted to distribute this document, in part or in full,
+via electronic means or printed copy providing that (1) that all credits
+and copyright notices be retained, (2) that no charges beyond reproduction
+be involved, and (3) that a reasonable attempt be made to use the most
+current version available.
+
+Furthermore, you may include this document in any distribution of the
+full Perl source or binaries, in its verbatim documentation, or on a
+complete dump of the CPAN archive, providing that the three stipulations
+given above continue to be met.
+
+=head2 Commercial Reproduction
+
+Requests for all other distribution rights, including the incorporation
+in part or in full of this text or its code into commercial products
+such as but not limited to books, magazine articles, or CD-ROMs, must
+be made to perlfaq-legal@perl.com.  Any commercial use of any portion
+of this document without prior written authorization by its authors
+will be subject to appropriate action.
+
+=head2 Disclaimer
+
+This information is offered in good faith and in the hope that it may
+be of use, but is not guaranteed to be correct, up to date, or suitable
+for any particular purpose whatsoever.  The authors accept no liability
+in respect of this information or its use.
+
+=head1 Changes
+
+=over 4
+
+=item 17/March/97 Version
+
+Various typos fixed throughout.
+
+Added new question on Perl BNF on L<perlfaq7>.
+
+=item Initial Release: 11/March/97
+
+This is the initial release of version 3 of the FAQ; consequently there
+have been no changes since its initial release.
+
+=back
diff --git a/pod/perlfaq1.pod b/pod/perlfaq1.pod
new file mode 100644 (file)
index 0000000..2510a4b
--- /dev/null
@@ -0,0 +1,248 @@
+=head1 NAME
+
+perlfaq1 - General Questions About Perl ($Revision: 1.10 $)
+
+=head1 DESCRIPTION
+
+This section of the FAQ answers very general, high-level questions
+about Perl.
+
+=head2 What is Perl?
+
+Perl is a high-level programming language with an eclectic heritage
+written by Larry Wall and a cast of thousands.  It derives from the
+ubiquitous C programming language and to a lesser extent from sed,
+awk, the Unix shell, and at least a dozen other tools and languages.
+Perl's process, file, and text manipulation facilities make it
+particularly well-suited for tasks involving quick prototyping, system
+utilities, software tools, system management tasks, database access,
+graphical programming, networking, and world wide web programming.
+These strengths make it especially popular with system administrators
+and CGI script authors, but mathematicians, geneticists, journalists,
+and even managers also use Perl.  Maybe you should, too.
+
+=head2 Who supports Perl?  Who develops it?  Why is it free?
+
+The original culture of the pre-populist Internet and the deeply-held
+beliefs of Perl's author, Larry Wall, gave rise to the free and open
+distribution policy of perl.  Perl is supported by its users.  The
+core, the standard Perl library, the optional modules, and the
+documentation you're reading now were all written by volunteers.  See
+the personal note at the end of the README file in the perl source
+distribution for more details.
+
+In particular, the core development team (known as the Perl
+Porters) are a rag-tag band of highly altruistic individuals
+committed to producing better software for free than you
+could hope to purchase for money.  You may snoop on pending
+developments via news://genetics.upenn.edu/perl.porters-gw/ and
+http://www.frii.com/~gnat/perl/porters/summary.html.
+
+While the GNU project includes Perl in its distributions, there's no
+such thing as "GNU Perl".  Perl is not produced nor maintained by the
+Free Software Foundation.  Perl's licensing terms are also more open
+than GNU software's tend to be.
+
+You can get commercial support of Perl if you wish, although for most
+users the informal support will more than suffice.  See the answer to
+"Where can I buy a commercial version of perl?" for more information.
+
+=head2 Which version of Perl should I use?
+
+You should definitely use version 5.  Version 4 is old, limited, and
+no longer maintained.  Its last patch (4.036) was in 1992.  The last
+production release was 5.003, and the current experimental release for
+those at the bleeding edge (as of 27/03/97) is 5.003_92, considered a beta
+for production release 5.004, which will probably be out by the time
+you read this.  Further references to the Perl language in this document
+refer to the current production release unless otherwise specified.
+
+=head2 What are perl4 and perl5?
+
+Perl4 and perl5 are informal names for different versions of the Perl
+programming language.  It's easier to say "perl5" than it is to say
+"the 5(.004) release of Perl", but some people have interpreted this
+to mean there's a language called "perl5", which isn't the case.
+Perl5 is merely the popular name for the fifth major release (October 1994),
+while perl4 was the fourth major release (March 1991).  There was also a
+perl1 (in January 1988), a perl2 (June 1988), and a perl3 (October 1989).
+
+The 5.0 release is, essentially, a complete rewrite of the perl source
+code from the ground up.  It has been modularized, object-oriented,
+tweaked, trimmed, and optimized until it almost doesn't look like the
+old code.  However, the interface is mostly the same, and compatibility
+with previous releases is very high.
+
+To avoid the "what language is perl5?" confusion, some people prefer to
+simply use "perl" to refer to the latest version of perl and avoid using
+"perl5" altogether.  It's not really that big a deal, though.
+
+=head2 How stable is Perl?
+
+Production releases, which incorporate bug fixes and new functionality,
+are widely tested before release.  Since the 5.000 release, we have
+averaged only about one production release per year.
+
+Larry and the Perl development team occasionally make changes to the
+internal core of the language, but all possible efforts are made toward
+backward compatibility.  While not quite all perl4 scripts run flawlessly
+under perl5, an update to perl should nearly never invalidate a program
+written for an earlier version of perl (barring accidental bug fixes
+and the rare new keyword).
+
+=head2 Is Perl difficult to learn?
+
+Perl is easy to start learning -- and easy to keep learning.  It looks
+like most programming languages you're likely to have had experience
+with, so if you've ever written an C program, an awk script, a shell
+script, or even an Excel macro, you're already part way there.
+
+Most tasks only require a small subset of the Perl language.  One of
+the guiding mottos for Perl development is "there's more than one way
+to do it" (TMTOWTDI, sometimes pronounced "tim toady").  Perl's
+learning curve is therefore shallow (easy to learn) and long (there's
+a whole lot you can do if you really want).
+
+Finally, Perl is (frequently) an interpreted language.  This means
+that you can write your programs and test them without an intermediate
+compilation step, allowing you to experiment and test/debug quickly
+and easily.  This ease of experimentation flattens the learning curve
+even more.
+
+Things that make Perl easier to learn: Unix experience, almost any kind
+of programming experience, an understanding of regular expressions, and
+the ability to understand other people's code.  If there's something you
+need to do, then it's probably already been done, and a working example is
+usually available for free.  Don't forget the new perl modules, either.
+They're discussed in Part 3 of this FAQ, along with the CPAN, which is
+discussed in Part 2.
+
+=head2 How does Perl compare with other languages like Java, Python, REXX, Scheme, or Tcl?
+
+Favorably in some areas, unfavorably in others.  Precisely which areas
+are good and bad is often a personal choice, so asking this question
+on Usenet runs a strong risk of starting an unproductive Holy War.
+
+Probably the best thing to do is try to write equivalent code to do a
+set of tasks.  These languages have their own newsgroups in which you
+can learn about (but hopefully not argue about) them.
+
+=head2 Can I do [task] in Perl?
+
+Perl is flexible and extensible enough for you to use on almost any
+task, from one-line file-processing tasks to complex systems.  For
+many people, Perl serves as a great replacement for shell scripting.
+For others, it serves as a convenient, high-level replacement for most
+of what they'd program in low-level languages like C or C++.  It's
+ultimately up to you (and possibly your management ...) which tasks
+you'll use Perl for and which you won't.
+
+If you have a library that provides an API, you can make any component
+of it available as just another Perl function or variable using a Perl
+extension written in C or C++ and dynamically linked into your main
+perl interpreter.  You can also go the other direction, and write your
+main program in C or C++, and then link in some Perl code on the fly,
+to create a powerful application.
+
+That said, there will always be small, focused, special-purpose
+languages dedicated to a specific problem domain that are simply more
+convenient for certain kinds of problems.  Perl tries to be all things
+to all people, but nothing special to anyone.  Examples of specialized
+languages that come to mind include prolog and matlab.
+
+=head2 When shouldn't I program in Perl?
+
+When your manager forbids it -- but do consider replacing them :-).
+
+Actually, one good reason is when you already have an existing
+application written in another language that's all done (and done
+well), or you have an application language specifically designed for a
+certain task (e.g. prolog, make).
+
+For various reasons, Perl is probably not well-suited for real-time
+embedded systems, low-level operating systems development work like
+device drivers or context-switching code, complex multithreaded
+shared-memory applications, or extremely large applications.  You'll
+notice that perl is not itself written in Perl.
+
+The new native-code compiler for Perl may reduce the limitations given
+in the previous statement to some degree, but understand that Perl
+remains fundamentally a dynamically typed language, and not a
+statically typed one.  You certainly won't be chastized if you don't
+trust nuclear-plant or brain-surgery monitoring code to it.  And
+Larry will sleep easier, too -- Wall Street programs not
+withstanding. :-)
+
+=head2 What's the difference between "perl" and "Perl"?
+
+One bit.  Oh, you weren't talking ASCII? :-) Larry now uses "Perl" to
+signify the language proper and "perl" the implementation of it,
+i.e. the current interpreter.  Hence Tom's quip that "Nothing but perl
+can parse Perl."  You may or may not choose to follow this usage.  For
+example, parallelism means "awk and perl" and "Python and Perl" look
+ok, while "awk and Perl" and "Python and perl" do not.
+
+=head2 Is it a Perl program or a Perl script?
+
+It doesn't matter.
+
+In "standard terminology" a I<program> has been compiled to physical
+machine code once, and can then be be run multiple times, whereas a
+I<script> must be translated by a program each time it's used.  Perl
+programs, however, are usually neither strictly compiled nor strictly
+interpreted.  They can be compiled to a bytecode form (something of a Perl
+virtual machine) or to completely different languages, like C or assembly
+language.  You can't tell just by looking whether the source is destined
+for a pure interpreter, a parse-tree interpreter, a byte-code interpreter,
+or a native-code compiler, so it's hard to give a definitive answer here.
+
+=head2 What is a JAPH?
+
+These are the "just another perl hacker" signatures that some people
+sign their postings with.  About 100 of the of the earlier ones are
+available from http://www.perl.com/CPAN/misc/japh .
+
+=head2 Where can I get a list of Larry Wall witticisms?
+
+Over a hundred quips by Larry, from postings of his or source code,
+can be found at http://www.perl.com/CPAN/misc/lwall-quotes .
+
+=head2 How can I convince my sysadmin/supervisor/employees to use version (5/5.004/Perl instead of some other language)?
+
+If your manager or employees are wary of unsupported software, or
+software which doesn't officially ship with your Operating System, you
+might try to appeal to their self-interest.  If programmers can be
+more productive using and utilizing Perl constructs, functionality,
+simplicity, and power, then the typical manager/supervisor/employee
+may be persuaded.  Regarding using Perl in general, it's also
+sometimes helpful to point out that delivery times may be reduced
+using Perl, as compared to other languages.
+
+If you have a project which has a bottleneck, especially in terms of
+translation, or testing, Perl almost certainly will provide a viable,
+and quick solution.  In conjunction with any persuasion effort, you
+should not fail to point out that Perl is used, quite extensively, and
+with extremely reliable and valuable results, at many large computer
+software and/or hardware companies throughout the world.  In fact,
+many Unix vendors now ship Perl by default, and support is usually
+just a news-posting away, if you can't find the answer in the
+I<comprehensive> documentation, including this FAQ.
+
+If you face reluctance to upgrading from an older version of perl,
+then point out that version 4 is utterly unmaintained and unsupported
+by the Perl Development Team.  Another big sell for Perl5 is the large
+number of modules and extensions which greatly reduce development time
+for any given task.  Also mention that the difference between version
+4 and version 5 of Perl is like the difference between awk and C++.
+(Well, ok, maybe not quite that distinct, but you get the idea.)  If
+you want support and a reasonable guarantee that what you're
+developing will continue to work in the future, then you have to run
+the supported version.  That probably means running the 5.004 release,
+although 5.003 isn't that bad (it's just one year and one release
+behind).  Several important bugs were fixed from the 5.000 through
+5.002 versions, though, so try upgrading past them if possible.
+
+=head1 AUTHOR AND COPYRIGHT
+
+Copyright (c) 1997 Tom Christiansen and Nathan Torkington.
+All rights reserved.  See L<perlfaq> for distribution information.
diff --git a/pod/perlfaq2.pod b/pod/perlfaq2.pod
new file mode 100644 (file)
index 0000000..b4c3e9f
--- /dev/null
@@ -0,0 +1,419 @@
+=head1 NAME
+
+perlfaq2 - Obtaining and Learning about Perl ($Revision: 1.13 $)
+
+=head1 DESCRIPTION
+
+This section of the FAQ answers questions about where to find
+source and documentation for Perl, support and training, and
+related matters.
+
+=head2 What machines support Perl?  Where do I get it?
+
+The standard release of Perl (the one maintained by the perl
+development team) is distributed only in source code form.  You can
+find this at http://www.perl.com/CPAN/src/latest.tar.gz, which is a
+gzipped archive in POSIX tar format.  This source builds with no
+porting whatsoever on most Unix systems (Perl's native environment),
+as well as Plan 9, VMS, QNX, OS/2, and the Amiga.
+
+Although it's rumored that the (imminent) 5.004 release may build
+on Windows NT, this is yet to be proven.  Binary distributions
+for 32-bit Microsoft systems and for Apple systems can be found
+http://www.perl.com/CPAN/ports/ directory.  Because these are not part of
+the standard distribution, they may and in fact do differ from the base
+Perl port in a variety of ways.  You'll have to check their respective
+release notes to see just what the differences are.  These differences
+can be either positive (e.g. extensions for the features of the particular
+platform that are not supported in the source release of perl) or negative
+(e.g. might be based upon a less current source release of perl).
+
+A useful FAQ for Win32 Perl users is
+http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ.html
+
+=head2 How can I get a binary version of Perl?
+
+If you don't have a C compiler because for whatever reasons your
+vendor did not include one with your system, the best thing to do is
+grab a binary version of gcc from the net and use that to compile perl
+with.  CPAN only has binaries for systems that are terribly hard to
+get free compilers for, not for Unix systems.
+
+=head2 I copied the Perl binary from one machine to another, but scripts don't work.
+
+That's probably because you forgot libraries, or library paths differ.
+You really should build the whole distribution on the machine it will
+eventually live on, and then type C<make install>.  Most other
+approaches are doomed to failure.
+
+One simple way to check that things are in the right place is to print out
+the hard-coded @INC which perl is looking for.
+
+       perl -e 'print join("\n",@INC)'
+
+If this command lists any paths which don't exist on your system, then you
+may need to move the appropriate libraries to these locations, or create
+symlinks, aliases, or shortcuts appropriately.
+
+=head2 I grabbed the sources and tried to compile but gdbm/dynamic loading/malloc/linking/... failed.  How do I make it work?
+
+Read the F<INSTALL> file, which is part of the source distribution.
+It describes in detail how to cope with most idiosyncracies that the
+Configure script can't work around for any given system or
+architecture.
+
+=head2 What modules and extensions are available for Perl?  What is CPAN?  What does CPAN/src/... mean?
+
+CPAN stands for Comprehensive Perl Archive Network, a huge archive
+replicated on dozens of machines all over the world.  CPAN contains
+source code, non-native ports, documentation, scripts, and many
+third-party modules and extensions, designed for everything from
+commercial database interfaces to keyboard/screen control to web
+walking and CGI scripts.  The master machine for CPAN is
+ftp://ftp.funet.fi/pub/languages/perl/CPAN/, but you can use the
+address http://www.perl.com/CPAN/CPAN.html to fetch a copy from a
+"site near you".  See http://www.perl.com/CPAN (without a slash at the
+end) for how this process works.
+
+CPAN/path/... is a naming convention for files available on CPAN
+sites.  CPAN indicates the base directory of a CPAN mirror, and the
+rest of the path is the path from that directory to the file.  For
+instance, if you're using ftp://ftp.funet.fi/pub/languages/perl/CPAN
+as your CPAN site, the file CPAN/misc/japh file is downloadable as
+ftp://ftp.funet.fi/pub/languages/perl/CPAN/misc/japh .
+
+Considering that there are hundreds of existing modules in the
+archive, one probably exists to do nearly anything you can think of.
+Current categories under CPAN/modules/by-category/ include perl core
+modules; development support; operating system interfaces; networking,
+devices, and interprocess communication; data type utilities; database
+interfaces; user interfaces; interfaces to other languages; filenames,
+file systems, and file locking; internationalization and locale; world
+wide web support; server and daemon utilities; archiving and
+compression; image manipulation; mail and news; control flow
+utilities; filehandle and I/O; Microsoft Windows modules; and
+miscellaneous modules.
+
+=head2 Is there an ISO or ANSI certified version of Perl?
+
+Certainly not.  Larry expects that he'll be certified before Perl is.
+
+=head2 Where can I get information on Perl?
+
+The complete Perl documentation is available with the perl
+distribution.  If you have perl installed locally, you probably have
+the documentation installed as well: type C<man perl> if you're on a
+system resembling Unix.  This will lead you to other important man
+pages.  If you're not on a Unix system, access to the documentation
+will be different; for example, it might be only in HTML format.  But
+all proper perl installations have fully-accessible documentation.
+
+You might also try C<perldoc perl> in case your system doesn't
+have a proper man command, or it's been misinstalled.  If that doesn't
+work, try looking in /usr/local/lib/perl5/pod for documentation.
+
+If all else fails, consult the CPAN/doc directory, which contains the
+complete documentation in various formats, including native pod,
+troff, html, and plain text.  There's also a web page at
+http://www.perl.com/perl/info/documentation.html that might help.
+
+It's also worth noting that there's a PDF version of the complete
+documentation for perl available in the CPAN/authors/id/BMIDD
+directory.
+
+Many good books have been written about Perl -- see the section below
+for more details.
+
+=head2 What are the Perl newsgroups on USENET?  Where do I post questions?
+
+The now defunct comp.lang.perl newsgroup has been superseded by the
+following groups:
+
+    comp.lang.perl.announce            Moderated announcement group
+    comp.lang.perl.misc                Very busy group about Perl in general
+    comp.lang.perl.modules             Use and development of Perl modules
+    comp.lang.perl.tk                  Using Tk (and X) from Perl
+
+    comp.infosystems.www.authoring.cgi         Writing CGI scripts for the Web.
+
+There is also USENET gateway to the mailing list used by the crack
+Perl development team (perl5-porters) at
+news://genetics.upenn.edu/perl.porters-gw/ .
+
+=head2 Where should I post source code?
+
+You should post source code to whichever group is most appropriate,
+but feel free to cross-post to comp.lang.perl.misc.  If you want to
+cross-post to alt.sources, please make sure it follows their posting
+standards, including setting the Followup-To header line to NOT
+include alt.sources; see their FAQ for details.
+
+=head2 Perl Books
+
+A number books on Perl and/or CGI programming are available.  A few of
+these are good, some are ok, but many aren't worth your money.  Tom
+Christiansen maintains a list of these books, some with extensive
+reviews, at http://www.perl.com/perl/critiques/index.html.
+
+The incontestably definitive reference book on Perl, written by the
+creator of Perl and his apostles, is now in its second edition and
+fourth printing.
+
+    Programming Perl (the "Camel Book"):
+       Authors: Larry Wall, Tom Christiansen, and Randal Schwartz
+        ISBN 1-56592-149-6      (English)
+        ISBN 4-89052-384-7      (Japanese)
+       (French and German translations in progress)
+
+Note that O'Reilly books are color-coded: turquoise (some would call
+it teal) covers indicate perl5 coverage, while magenta (some would
+call it pink) covers indicate perl4 only.  Check the cover color
+before you buy!
+
+What follows is a list of the books that the FAQ authors found personally
+useful.  Your mileage may (but, we hope, probably won't) vary.
+
+If you're already a hard-core systems programmer, then the Camel Book
+just might suffice for you to learn Perl from.  But if you're not,
+check out the "Llama Book".  It currently doesn't cover perl5, but the
+2nd edition is nearly done and should be out by summer 97:
+
+    Learning Perl (the Llama Book):
+       Author: Randal Schwartz, with intro by Larry Wall
+        ISBN 1-56592-042-2      (English)
+        ISBN 4-89502-678-1      (Japanese)
+        ISBN 2-84177-005-2      (French)
+        ISBN 3-930673-08-8      (German)
+
+Another stand-out book in the turquoise O'Reilly Perl line is the "Hip
+Owls" book.  It covers regular expressions inside and out, with quite a
+bit devoted exclusively to Perl:
+
+    Mastering Regular Expressions (the Cute Owls Book):
+       Author: Jeffrey Friedl
+       ISBN 1-56592-257-3
+
+You can order any of these books from O'Reilly & Associates,
+1-800-998-9938.  Local/overseas is 1-707-829-0515.  If you can locate
+an O'Reilly order form, you can also fax to 1-707-829-0104.  See
+http://www.ora.com/ on the Web.
+
+Recommended Perl books that are not from O'Reilly are the following:
+
+   Cross-Platform Perl, (for Unix and Windows NT)
+       Author: Eric F. Johnson
+       ISBN: 1-55851-483-X
+
+   How to Set up and Maintain a World Wide Web Site, (2nd edition)
+       Author: Lincoln Stein, M.D., Ph.D.
+       ISBN: 0-201-63462-7
+
+   CGI Programming in C & Perl,
+       Author: Thomas Boutell
+       ISBN: 0-201-42219-0
+
+Note that some of these address specific application areas (e.g. the
+Web) and are not general-purpose programming books.
+
+=head2 Perl in Magazines
+
+The Perl Journal is the first and only magazine dedicated to Perl.
+It is published (on paper, not online) quarterly by Jon Orwant
+(orwant@tpj.com), editor.  Subscription information is at http://tpj.com
+or via email to subscriptions@tpj.com.
+
+Beyond this, two other magazines that frequently carry high-quality articles
+on Perl are Web Techniques (see http://www.webtechniques.com/) and
+Unix Review (http://www.unixreview.com/).
+
+=head2 Perl on the Net: FTP and WWW Access
+
+To get the best (and possibly cheapest) performance, pick a site from
+the list below and use it to grab the complete list of mirror sites.
+>From there you can find the quickest site for you.  Remember, the
+following list is I<not> the complete list of CPAN mirrors.
+
+  http://www.perl.com/CPAN     (redirects to another mirror)
+  http://www.perl.org/CPAN
+  ftp://ftp.funet.fi/pub/languages/perl/CPAN/
+  http://www.cs.ruu.nl/pub/PERL/CPAN/
+  ftp://ftp.cs.colorado.edu/pub/perl/CPAN/
+
+=head2 What mailing lists are there for perl?
+
+Most of the major modules (tk, CGI, libwww-perl) have their own
+mailing lists.  Consult the documentation that came with the module for
+subscription information.  The following are a list of mailing lists
+related to perl itself.
+
+If you subscribe to a mailing list, it behooves you to know how to
+unsubscribe from it.  Strident pleas to the list itself to get you off
+will not be favorably received.
+
+=over 4
+
+=item MacPerl
+
+There is a mailing list for discussing Macintosh Perl.  Contact
+"mac-perl-request@iis.ee.ethz.ch".
+
+Also see Matthias Neeracher's (the creator and maintainer of MacPerl)
+webpage at http://www.iis.ee.ethz.ch/~neeri/macintosh/perl.html for
+many links to interesting MacPerl sites, and the applications/MPW
+tools, precompiled.
+
+=item Perl5-Porters
+
+The core development team have a mailing list for discussing fixes and
+changes to the language.  Send mail to
+"perl5-porters-request@perl.org" with help in the body of the message
+for information on subscribing.
+
+=item NTPerl
+
+This list is used to discuss issues involving Win32 Perl 5 (Windows NT
+and Win95). Subscribe by emailing ListManager@ActiveWare.com with the
+message body:
+
+    subscribe Perl-Win32-Users
+
+The list software, also written in perl, will automatically determine
+your address, and subscribe you automatically.  To unsubscribe, email
+the following in the message body to the same address like so:
+
+    unsubscribe Perl-Win32-Users
+
+You can also check http://www.activeware.com/ and select "Mailing Lists"
+to join or leave this list.
+
+=item Perl-Packrats
+
+Discussion related to archiving of perl materials, particularly the
+Comprehensive PerlArchive Network (CPAN). Subscribe by emailing
+majordomo@cis.ufl.edu:
+
+    subscribe perl-packrats
+
+The list software, also written in perl, will automatically determine
+your address, and subscribe you automatically.  To unsubscribe, simple
+prepend the same command with an "un", and mail to the same address
+like so:
+
+    unsubscribe perl-packrats
+
+=back
+
+=head2 Archives of comp.lang.perl.misc
+
+Have you tried Deja News or Alta Vista?
+
+ftp.cis.ufl.edu:/pub/perl/comp.lang.perl.*/monthly has an almost
+complete collection dating back to 12/89 (missing 08/91 through
+12/93).  They are kept as one large file for each month.
+
+You'll probably want more a sophisticated query and retrieval mechanism
+than a file listing, preferably one that allows you to retrieve
+articles using a fast-access indices, keyed on at least author, date,
+subject, thread (as in "trn") and probably keywords.  The best
+solution the FAQ authors know of is the MH pick command, but it is
+very slow to select on 18000 articles.
+
+If you have, or know where can be found, the missing sections, please
+let perlfaq-suggestions@perl.com know.
+
+=head2 Perl Training
+
+While some large training companies offer their own courses on Perl,
+you may prefer to contact individuals near and dear to the heart of
+Perl development.  Two well-known members of the Perl development team
+who offer such things are Tom Christiansen <perl-classes@perl.com>
+and Randal Schwartz <perl-training-info@stonehenge.com>, plus their
+respective minions, who offer a variety of professional tutorials
+and seminars on Perl.  These courses include large public seminars,
+private corporate training, and fly-ins to Colorado and Oregon.
+See http://www.perl.com/perl/info/training.html for more details.
+
+=head2 Where can I buy a commercial version of Perl?
+
+In a sense, Perl already I<is> commercial software: It has a licence
+that you can grab and carefully read to your manager. It is
+distributed in releases and comes in well-defined packages. There is a
+very large user community and an extensive literature.  The
+comp.lang.perl.* newsgroups and several of the mailing lists provide
+free answers to your questions in near real-time.  Perl has
+traditionally been supported by Larry, dozens of software designers
+and developers, and thousands of programmers, all working for free
+to create a useful thing to make life better for everyone.
+
+However, these answers may not suffice for managers who require a
+purchase order from a company whom they can sue should anything go
+wrong.  Or maybe they need very serious hand-holding and contractual
+obligations.  Shrink-wrapped CDs with perl on them are available from
+several sources if that will help.
+
+Or you can purchase a real support contract.  Although Cygnus historically
+provided this service, they no longer sell support contracts for Perl.
+Instead, the Paul Ingram Group will be taking up the slack through The
+Perl Clinic.  The following is a commercial from them:
+
+"Do you need professional support for Perl and/or Oraperl?  Do you need
+a support contract with defined levels of service?  Do you want to pay
+only for what you need?
+
+"The Paul Ingram Group has provided quality software development and
+support services to some of the world's largest corporations for ten
+years.  We are now offering the same quality support services for Perl
+at The Perl Clinic.  This service is led by Tim Bunce, an active perl
+porter since 1994 and well known as the author and maintainer of the
+DBI, DBD::Oracle, and Oraperl modules and author/co-maintainer of The
+Perl 5 Module List.  We also offer Oracle users support for Perl5
+Oraperl and related modules (which Oracle is planning to ship as part
+of Oracle Web Server 3).  20% of the profit from our Perl support work
+will be donated to The Perl Institute."
+
+For more information, contact the The Perl Clinic:
+
+    Tel:    +44 1483 424424
+    Fax:    +44 1483 419419
+    Web:    http://www.perl.co.uk/
+    Email:  perl-support-info@perl.co.uk or Tim.Bunce@ig.co.uk
+
+=head2 Where do I send bug reports?
+
+If you are reporting a bug in the perl interpreter or the modules
+shipped with perl, use the perlbug program in the perl distribution or
+email your report to perlbug@perl.com.
+
+If you are posting a bug with a non-standard port (see the answer to
+"What platforms is Perl available for?"), a binary distribution, or a
+non-standard module (such as Tk, CGI, etc), then please see the
+documentation that came with it to determine the correct place to post
+bugs.
+
+Read the perlbug man page (perl5.004 or later) for more information.
+
+=head2 What is perl.com?  perl.org?  The Perl Institute?
+
+perl.org is the official vehicle for The Perl Institute.  The motto of
+TPI is "helping people help Perl help people" (or something like
+that).  It's a non-profit organization supporting development,
+documentation, and dissemination of perl.  Current directors of TPI
+include Larry Wall, Tom Christiansen, and Randal Schwartz, whom you
+may have heard of somewhere else around here.
+
+The perl.com domain is Tom Christiansen's domain.  He created it as a
+public service long before perl.org came about.  It's the original PBS
+of the Perl world, a clearinghouse for information about all things
+Perlian, accepting no paid advertisements, glossy gifs, or (gasp!)
+java applets on its pages.
+
+=head2 How do I learn about object-oriented Perl programming?
+
+L<perltoot> (distributed with 5.004 or later) is a good place to start.
+Also, L<perlobj>, L<perlref>, and L<perlmod> are useful references,
+while L<perlbot> has some excellent tips and tricks.
+
+=head1 AUTHOR AND COPYRIGHT
+
+Copyright (c) 1997 Tom Christiansen and Nathan Torkington.
+All rights reserved.  See L<perlfaq> for distribution information.
diff --git a/pod/perlfaq3.pod b/pod/perlfaq3.pod
new file mode 100644 (file)
index 0000000..121743d
--- /dev/null
@@ -0,0 +1,503 @@
+=head1 NAME
+
+perlfaq3 - Programming Tools ($Revision: 1.19 $)
+
+=head1 DESCRIPTION
+
+This section of the FAQ answers questions related to programmer tools
+and programming support.
+
+=head2 How do I do (anything)?
+
+Have you looked at CPAN (see L<perlfaq2>)?  The chances are that
+someone has already written a module that can solve your problem.
+Have you read the appropriate man pages?  Here's a brief index:
+
+       Objects         perlref, perlmod, perlobj, perltie
+       Data Structures perlref, perllol, perldsc
+       Modules         perlmod, perlsub
+       Regexps         perlre, perlfunc, perlop
+       Moving to perl5 perltrap, perl
+       Linking w/C     perlxstut, perlxs, perlcall, perlguts, perlembed
+       Various         http://www.perl.com/CPAN/doc/FMTEYEWTK/index.html
+                       (not a man-page but still useful)
+
+L<perltoc> provides a crude table of contents for the perl man page set.
+
+=head2 How can I use Perl interactively?
+
+The typical approach uses the Perl debugger, described in the
+perldebug(1) man page, on an "empty" program, like this:
+
+    perl -de 42
+
+Now just type in any legal Perl code, and it will be immediately
+evaluated.  You can also examine the symbol table, get stack
+backtraces, check variable values, set breakpoints, and other
+operations typically found in symbolic debuggers
+
+=head2 Is there a Perl shell?
+
+In general, no.  The Shell.pm module (distributed with perl) makes
+perl try commands which aren't part of the Perl language as shell
+commands.  perlsh from the source distribution is simplistic and
+uninteresting, but may still be what you want.
+
+=head2 How do I debug my Perl programs?
+
+Have you used C<-w>?
+
+Have you tried C<use strict>?
+
+Did you check the returns of each and every system call?
+
+Did you read L<perltrap>?
+
+Have you tried the Perl debugger, described in L<perldebug>?
+
+=head2 How do I profile my Perl programs?
+
+You should get the Devel::DProf module from CPAN, and also use
+Benchmark.pm from the standard distribution.  Benchmark lets you time
+specific portions of your code, while Devel::DProf gives detailed
+breakdowns of where your code spends its time.
+
+=head2 How do I cross-reference my Perl programs?
+
+The B::Xref module, shipped with the new, alpha-release Perl compiler
+(not the general distribution), can be used to generate
+cross-reference reports for Perl programs.
+
+    perl -MO=Xref[,OPTIONS] foo.pl
+
+=head2 Is there a pretty-printer (formatter) for Perl?
+
+There is no program that will reformat Perl as much as indent(1) will
+do for C.  The complex feedback between the scanner and the parser
+(this feedback is what confuses the vgrind and emacs programs) makes it
+challenging at best to write a stand-alone Perl parser.
+
+Of course, if you simply follow the guidelines in L<perlstyle>, you
+shouldn't need to reformat.
+
+Your editor can and should help you with source formatting.  The
+perl-mode for emacs can provide a remarkable amount of help with most
+(but not all) code, and even less programmable editors can provide
+significant assistance.
+
+If you are using to using vgrind program for printing out nice code to
+a laser printer, you can take a stab at this using
+http://www.perl.com/CPAN/doc/misc/tips/working.vgrind.entry, but the
+results are not particularly satisfying for sophisticated code.
+
+=head2 Is there a ctags for Perl?
+
+There's a simple one at
+http://www.perl.com/CPAN/authors/id/TOMC/scripts/ptags.gz which may do
+the trick.
+
+=head2 Where can I get Perl macros for vi?
+
+For a complete version of Tom Christiansen's vi configuration file,
+see ftp://ftp.perl.com/pub/vi/toms.exrc, the standard benchmark file
+for vi emulators.  This runs best with nvi, the current version of vi
+out of Berkeley, which incidentally can be built with an embedded Perl
+interpreter -- see http://www.perl.com/CPAN/src/misc .
+
+=head2 Where can I get perl-mode for emacs?
+
+Since Emacs version 19 patchlevel 22 or so, there have been both a
+perl-mode.el and support for the perl debugger built in.  These should
+come with the standard Emacs 19 distribution.
+
+In the perl source directory, you'll find a directory called "emacs",
+which contains a cperl-mode that color-codes keywords, provides
+context-sensitive help, and other nifty things.
+
+Note that the perl-mode of emacs will have fits with "main'foo"
+(single quote), and mess up the indentation and hilighting.  You
+should be using "main::foo", anyway.
+
+=head2 How can I use curses with Perl?
+
+The Curses module from CPAN provides a dynamically loadable object
+module interface to a curses library.
+
+=head2 How can I use X or Tk with Perl?
+
+Tk is a completely Perl-based, object-oriented interface to the Tk
+toolkit that doesn't force you to use Tcl just to get at Tk.  Sx is an
+interface to the Athena Widget set.  Both are available from CPAN.
+
+=head2 How can I generate simple menus without using CGI or Tk?
+
+The http://www.perl.com/CPAN/authors/id/SKUNZ/perlmenu.v4.0.tar.gz
+module, which is curses-based, can help with this.
+
+=head2 Can I dynamically load C routines into Perl?
+
+If your system architecture supports it, then the standard perl
+on your system should also provide you with this via the
+DynaLoader module.  Read L<perlxstut> for details.
+
+=head2 What is undump?
+
+See the next questions.
+
+=head2 How can I make my Perl program run faster?
+
+The best way to do this is to come up with a better algorithm.
+This can often make a dramatic difference.  Chapter 8 in the Camel
+has some efficiency tips in it you might want to look at.
+
+Other approaches include autoloading seldom-used Perl code.  See the
+AutoSplit and AutoLoader modules in the standard distribution for
+that.  Or you could locate the bottleneck and think about writing just
+that part in C, the way we used to take bottlenecks in C code and
+write them in assembler.  Similar to rewriting in C is the use of
+modules that have critical sections written in C (for instance, the
+PDL module from CPAN).
+
+In some cases, it may be worth it to use the backend compiler to
+produce byte code (saving compilation time) or compile into C, which
+will certainly save compilation time and sometimes a small amount (but
+not much) execution time.  See the question about compiling your Perl
+programs.
+
+If you're currently linking your perl executable to a shared libc.so,
+you can often gain a 10-25% performance benefit by rebuilding it to
+link with a static libc.a instead.  This will make a bigger perl
+executable, but your Perl programs (and programmers) may thank you for
+it.  See the F<INSTALL> file in the source distribution for more
+information.
+
+Unsubstantiated reports allege that Perl interpreters that use sfio
+outperform those that don't (for IO intensive applications).  To try
+this, see the F<INSTALL> file in the source distribution, especially
+the "Selecting File IO mechanisms" section.
+
+The undump program was an old attempt to speed up your Perl program
+by storing the already-compiled form to disk.  This is no longer
+a viable option, as it only worked on a few architectures, and
+wasn't a good solution anyway.
+
+=head2 How can I make my Perl program take less memory?
+
+When it comes to time-space tradeoffs, Perl nearly always prefers to
+throw memory at a problem.  Scalars in Perl use more memory than
+strings in C, arrays take more that, and hashes use even more.  While
+there's still a lot to be done, recent releases have been addressing
+these issues.  For example, as of 5.004, duplicate hash keys are
+shared amongst all hashes using them, so require no reallocation.
+
+In some cases, using substr() or vec() to simulate arrays can be
+highly beneficial.  For example, an array of a thousand booleans will
+take at least 20,000 bytes of space, but it can be turned into one
+125-byte bit vector for a considerable memory savings.  The standard
+Tie::SubstrHash module can also help for certain types of data
+structure.  If you're working with specialist data structures
+(matrices, for instance) modules that implement these in C may use
+less memory than equivalent Perl modules.
+
+Another thing to try is learning whether your Perl was compiled with
+the system malloc or with Perl's built-in malloc.  Whichever one it
+is, try using the other one and see whether this makes a difference.
+Information about malloc is in the F<INSTALL> file in the source
+distribution.  You can find out whether you are using perl's malloc by
+typing C<perl -V:usemymalloc>.
+
+=head2 Is it unsafe to return a pointer to local data?
+
+No, Perl's garbage collection system takes care of this.
+
+    sub makeone {
+       my @a = ( 1 .. 10 );
+       return \@a;
+    }
+
+    for $i ( 1 .. 10 ) {
+        push @many, makeone();
+    }
+
+    print $many[4][5], "\n";
+
+    print "@many\n";
+
+=head2 How can I free an array or hash so my program shrinks?
+
+You can't.  Memory the system allocates to a program will never be
+returned to the system.  That's why long-running programs sometimes
+re-exec themselves.
+
+However, judicious use of my() on your variables will help make sure
+that they go out of scope so that Perl can free up their storage for
+use in other parts of your program.  (NB: my() variables also execute
+about 10% faster than globals.)  A global variable, of course, never
+goes out of scope, so you can't get its space automatically reclaimed,
+although undef()ing and/or delete()ing it will achieve the same effect.
+In general, memory allocation and de-allocation isn't something you can
+or should be worrying about much in Perl, but even this capability
+(preallocation of data types) is in the works.
+
+=head2 How can I make my CGI script more efficient?
+
+Beyond the normal measures described to make general Perl programs
+faster or smaller, a CGI program has additional issues.  It may be run
+several times per second.  Given that each time it runs it will need
+to be re-compiled and will often allocate a megabyte or more of system
+memory, this can be a killer.  Compiling into C B<isn't going to help
+you> because the process start-up overhead is where the bottleneck is.
+
+There are at least two popular ways to avoid this overhead.  One
+solution involves running the Apache HTTP server (available from
+http://www.apache.org/) with either of the mod_perl or mod_fastcgi
+plugin modules.  With mod_perl and the Apache::* modules (from CPAN),
+httpd will run with an embedded Perl interpreter which pre-compiles
+your script and then executes it within the same address space without
+forking.  The Apache extension also gives Perl access to the internal
+server API, so modules written in Perl can do just about anything a
+module written in C can.  With the FCGI module (from CPAN), a Perl
+executable compiled with sfio (see the F<INSTALL> file in the
+distribution) and the mod_fastcgi module (available from
+http://www.fastcgi.com/) each of your perl scripts becomes a permanent
+CGI daemon processes.
+
+Both of these solutions can have far-reaching effects on your system
+and on the way you write your CGI scripts, so investigate them with
+care.
+
+=head2 How can I hide the source for my Perl program?
+
+Delete it. :-) Seriously, there are a number of (mostly
+unsatisfactory) solutions with varying levels of "security".
+
+First of all, however, you I<can't> take away read permission, because
+the source code has to be readable in order to be compiled and
+interpreted.  (That doesn't mean that a CGI script's source is
+readable by people on the web, though.)  So you have to leave the
+permissions at the socially friendly 0755 level.
+
+Some people regard this as a security problem.  If your program does
+insecure things, and relies on people not knowing how to exploit those
+insecurities, it is not secure.  It is often possible for someone to
+determine the insecure things and exploit them without viewing the
+source.  Security through obscurity, the name for hiding your bugs
+instead of fixing them, is little security indeed.
+
+You can try using encryption via source filters (Filter::* from CPAN).
+But crackers might be able to decrypt it.  You can try using the
+byte-code compiler and interpreter described below, but crackers might
+be able to de-compile it.  You can try using the native-code compiler
+described below, but crackers might be able to disassemble it.  These
+pose varying degrees of difficulty to people wanting to get at your
+code, but none can definitively conceal it (this is true of every
+language, not just Perl).
+
+If you're concerned about people profiting from your code, then the
+bottom line is that nothing but a restrictive licence will give you
+legal security.  License your software and pepper it with threatening
+statements like "This is unpublished proprietary software of XYZ Corp.
+Your access to it does not give you permission to use it blah blah
+blah."  We are not lawyers, of course, so you should see a lawyer if
+you want to be sure your licence's wording will stand up in court.
+
+=head2 How can I compile my Perl program into byte-code or C?
+
+Malcolm Beattie has written a multifunction backend compiler,
+available from CPAN, that can do both these things.  It is as of
+Feb-1997 in late alpha release, which means it's fun to play with if
+you're a programmer but not really for people looking for turn-key
+solutions.
+
+I<Please> understand that merely compiling into C does not in and of
+itself guarantee that your code will run very much faster.  That's
+because except for lucky cases where a lot of native type inferencing
+is possible, the normal Perl run time system is still present and thus
+will still take just as long to run and be just as big.  Most programs
+save little more than compilation time, leaving execution no more than
+10-30% faster.  A few rare programs actually benefit significantly
+(like several times faster), but this takes some tweaking of your
+code.
+
+Malcolm will be in charge of the 5.005 release of Perl itself
+to try to unify and merge his compiler and multithreading work into
+the main release.
+
+You'll probably be astonished to learn that the current version of the
+compiler generates a compiled form of your script whose executable is
+just as big as the original perl executable, and then some.  That's
+because as currently written, all programs are prepared for a full
+eval() statement.  You can tremendously reduce this cost by building a
+shared libperl.so library and linking against that.  See the
+F<INSTALL> podfile in the perl source distribution for details.  If
+you link your main perl binary with this, it will make it miniscule.
+For example, on one author's system, /usr/bin/perl is only 11k in
+size!
+
+=head2 How can I get '#!perl' to work on [MSDOS,NT,...]?
+
+For OS/2 just use
+
+    extproc perl -S -your_switches
+
+as the first line in C<*.cmd> file (C<-S> due to a bug in cmd.exe's
+`extproc' handling).  For DOS one should first invent a corresponding
+batch file, and codify it in C<ALTERNATIVE_SHEBANG> (see the
+F<INSTALL> file in the source distribution for more information).
+
+The Win95/NT installation, when using the Activeware port of Perl,
+will modify the Registry to associate the .pl extension with the perl
+interpreter.  If you install another port, or (eventually) build your
+own Win95/NT Perl using WinGCC, then you'll have to modify the
+Registry yourself.
+
+Macintosh perl scripts will have the the appropriate Creator and
+Type, so that double-clicking them will invoke the perl application.
+
+I<IMPORTANT!>: Whatever you do, PLEASE don't get frustrated, and just
+throw the perl interpreter into your cgi-bin directory, in order to
+get your scripts working for a web server.  This is an EXTREMELY big
+security risk.  Take the time to figure out how to do it correctly.
+
+=head2 Can I write useful perl programs on the command line?
+
+Yes.  Read L<perlrun> for more information.  Some examples follow.
+(These assume standard Unix shell quoting rules.)
+
+    # sum first and last fields
+    perl -lane 'print $F[0] + $F[-1]'
+
+    # identify text files
+    perl -le 'for(@ARGV) {print if -f && -T _}' *
+
+    # remove comments from C program
+    perl -0777 -pe 's{/\*.*?\*/}{}gs' foo.c
+
+    # make file a month younger than today, defeating reaper daemons
+    perl -e '$X=24*60*60; utime(time(),time() + 30 * $X,@ARGV)' *
+
+    # find first unused uid
+    perl -le '$i++ while getpwuid($i); print $i'
+
+    # display reasonable manpath
+    echo $PATH | perl -nl -072 -e '
+       s![^/+]*$!man!&&-d&&!$s{$_}++&&push@m,$_;END{print"@m"}'
+
+Ok, the last one was actually an obfuscated perl entry. :-)
+
+=head2 Why don't perl one-liners work on my DOS/Mac/VMS system?
+
+The problem is usually that the command interpreters on those systems
+have rather different ideas about quoting than the Unix shells under
+which the one-liners were created.  On some systems, you may have to
+change single-quotes to double ones, which you must I<NOT> do on Unix
+or Plan9 systems.  You might also have to change a single % to a %%.
+
+For example:
+
+    # Unix
+    perl -e 'print "Hello world\n"'
+
+    # DOS, etc.
+    perl -e "print \"Hello world\n\""
+
+    # Mac
+    print "Hello world\n"
+     (then Run "Myscript" or Shift-Command-R)
+
+    # VMS
+    perl -e "print ""Hello world\n"""
+
+The problem is that none of this is reliable: it depends on the command
+interpreter.  Under Unix, the first two often work. Under DOS, it's
+entirely possible neither works.  If 4DOS was the command shell, I'd
+probably have better luck like this:
+
+  perl -e "print <Ctrl-x>"Hello world\n<Ctrl-x>""
+
+Under the Mac, it depends which environment you are using.  The MacPerl
+shell, or MPW, is much like Unix shells in its support for several
+quoting variants, except that it makes free use of the Mac's non-ASCII
+characters as control characters.
+
+I'm afraid that there is no general solution to all of this.  It is a
+mess, pure and simple.
+
+[Some of this answer was contributed by Kenneth Albanowski.]
+
+=head2 Where can I learn about CGI or Web programming in Perl?
+
+For modules, get the CGI or LWP modules from CPAN.  For textbooks,
+see the two especially dedicated to web stuff in the question on
+books.  For problems and questions related to the web, like "Why
+do I get 500 Errors" or "Why doesn't it run from the browser right
+when it runs fine on the command line", see these sources:
+
+    The Idiot's Guide to Solving Perl/CGI Problems, by Tom Christiansen
+       http://www.perl.com/perl/faq/idiots-guide.html
+
+    Frequently Asked Questions about CGI Programming, by Nick Kew
+       ftp://rtfm.mit.edu/pub/usenet/news.answers/www/cgi-faq
+       http://www3.pair.com/webthing/docs/cgi/faqs/cgifaq.shtml
+
+    Perl/CGI programming FAQ, by Shishir Gundavaram and Tom Christiansen
+       http://www.perl.com/perl/faq/perl-cgi-faq.html
+
+    The WWW Security FAQ, by Lincoln Stein
+       http://www-genome.wi.mit.edu/WWW/faqs/www-security-faq.html
+
+    World Wide Web FAQ, by Thomas Boutell
+       http://www.boutell.com/faq/
+
+=head2 Where can I learn about object-oriented Perl programming?
+
+L<perltoot> is a good place to start, and you can use L<perlobj> and
+L<perlbot> for reference.  Perltoot didn't come out until the 5.004
+release, but you can get a copy (in pod, html, or postscript) from
+http://www.perl.com/CPAN/doc/FMTEYEWTK/ .
+
+=head2 Where can I learn about linking C with Perl? [h2xs, xsubpp]
+
+If you want to call C from Perl, start with L<perlxstut>,
+moving on to L<perlxs>, L<xsubpp>, and L<perlguts>.  If you want to
+call Perl from C, then read L<perlembed>, L<perlcall>, and
+L<perlguts>.  Don't forget that you can learn a lot from looking at
+how the authors of existing extension modules wrote their code and
+solved their problems.
+
+=head2 I've read perlembed, perlguts, etc., but I can't embed perl in
+my C program, what am I doing wrong?
+
+Download the ExtUtils::Embed kit from CPAN and run `make test'.  If
+the tests pass, read the pods again and again and again.  If they
+fail, see L<perlbug> and send a bugreport with the output of 
+C<make test TEST_VERBOSE=1> along with C<perl -V>.
+
+=head2 When I tried to run my script, I got this message. What does it
+mean?
+
+L<perldiag> has a complete list of perl's error messages and warnings,
+with explanatory text.  You can also use the splain program (distributed
+with perl) to explain the error messages:
+
+    perl program 2>diag.out
+    splain [-v] [-p] diag.out
+
+or change your program to explain the messages for you:
+
+    use diagnostics;
+
+or
+
+    use diagnostics -verbose;
+
+=head2 What's MakeMaker?
+
+This module (part of the standard perl distribution) is designed to
+write a Makefile for an extension module from a Makefile.PL.  For more
+information, see L<ExtUtils::MakeMaker>.
+
+=head1 AUTHOR AND COPYRIGHT
+
+Copyright (c) 1997 Tom Christiansen and Nathan Torkington.
+All rights reserved.  See L<perlfaq> for distribution information.
diff --git a/pod/perlfaq4.pod b/pod/perlfaq4.pod
new file mode 100644 (file)
index 0000000..1c1edfa
--- /dev/null
@@ -0,0 +1,1034 @@
+=head1 NAME
+
+perlfaq4 - Data Manipulation ($Revision: 1.15 $)
+
+=head1 DESCRIPTION
+
+The section of the FAQ answers question related to the manipulation
+of data as numbers, dates, strings, arrays, hashes, and miscellaneous
+data issues.
+
+=head1 Data: Numbers
+
+=head2 Why isn't my octal data interpreted correctly?
+
+Perl only understands octal and hex numbers as such when they occur
+as literals in your program.  If they are read in from somewhere and
+assigned, no automatic conversion takes place.  You must explicitly
+use oct() or hex() if you want the values converted.  oct() interprets
+both hex ("0x350") numbers and octal ones ("0350" or even without the
+leading "0", like "377"), while hex() only converts hexadecimal ones,
+with or without a leading "0x", like "0x255", "3A", "ff", or "deadbeef".
+
+This problem shows up most often when people try using chmod(), mkdir(),
+umask(), or sysopen(), which all want permissions in octal.
+
+    chmod(644,  $file);        # WRONG -- perl -w catches this
+    chmod(0644, $file);        # right
+
+=head2 Does perl have a round function?  What about ceil() and floor()?
+Trig functions?
+
+For rounding to a certain number of digits, sprintf() or printf() is
+usually the easiest route.
+
+The POSIX module (part of the standard perl distribution) implements
+ceil(), floor(), and a number of other mathematical and trigonometric
+functions.
+
+The Math::Complex module (part of the standard perl distribution)
+defines a number of mathematical functions that can also work on real
+numbers.  It's not as efficient as the POSIX library, but the POSIX
+library can't work with complex numbers.
+
+Rounding in financial applications can have serious implications, and
+the rounding method used should be specified precisely.  In these
+cases, it probably pays not to trust whichever system rounding is
+being used by Perl, but to instead implement the rounding function you
+need yourself.
+
+=head2 How do I convert bits into ints?
+
+To turn a string of 1s and 0s like '10110110' into a scalar containing
+its binary value, use the pack() function (documented in
+L<perlfunc/"pack">):
+
+    $decimal = pack('B8', '10110110');
+
+Here's an example of going the other way:
+
+    $binary_string = join('', unpack('B*', "\x29"));
+
+=head2 How do I multiply matrices?
+
+Use the Math::Matrix or Math::MatrixReal modules (available from CPAN)
+or the PDL extension (also available from CPAN).
+
+=head2 How do I perform an operation on a series of integers?
+
+To call a function on each element in an array, and collect the
+results, use:
+
+    @results = map { my_func($_) } @array;
+
+For example:
+
+    @triple = map { 3 * $_ } @single;
+
+To call a function on each element of an array, but ignore the
+results:
+
+    foreach $iterator (@array) {
+        &my_func($iterator);
+    }
+
+To call a function on each integer in a (small) range, you B<can> use:
+
+    @results = map { &my_func($_) } (5 .. 25);
+
+but you should be aware that the C<..> operator creates an array of
+all integers in the range.  This can take a lot of memory for large
+ranges.  Instead use:
+
+    @results = ();
+    for ($i=5; $i < 500_005; $i++) {
+        push(@results, &my_func($i));
+    }
+
+=head2 How can I output Roman numerals?
+
+Get the http://www.perl.com/CPAN/modules/by-module/Roman module.
+
+=head2 Why aren't my random numbers random?
+
+The short explanation is that you're getting pseudorandom numbers, not
+random ones, because that's how these things work.  A longer
+explanation is available on
+http://www.perl.com/CPAN/doc/FMTEYEWTK/random, courtesy of Tom
+Phoenix.
+
+You should also check out the Math::TrulyRandom module from CPAN.
+
+=head1 Data: Dates
+
+=head2 How do I find the week-of-the-year/day-of-the-year?
+
+The day of the year is in the array returned by localtime() (see
+L<perlfunc/"localtime">):
+
+    $day_of_year = (localtime(time()))[7];
+
+or more legibly (in 5.004 or higher):
+
+    use Time::localtime;
+    $day_of_year = localtime(time())->yday;
+
+You can find the week of the year by dividing this by 7:
+
+    $week_of_year = int($day_of_year / 7);
+
+Of course, this believes that weeks start at zero.
+
+=head2 How can I compare two date strings?
+
+Use the Date::Manip or Date::DateCalc modules from CPAN.
+
+=head2 How can I take a string and turn it into epoch seconds?
+
+If it's a regular enough string that it always has the same format,
+you can split it up and pass the parts to timelocal in the standard
+Time::Local module.  Otherwise, you should look into one of the
+Date modules from CPAN.
+
+=head2 How can I find the Julian Day?
+
+Neither Date::Manip nor Date::DateCalc deal with Julian days.
+Instead, there is an example of Julian date calculation in
+http://www.perl.com/CPAN/authors/David_Muir_Sharnoff/modules/Time/JulianDay.pm.gz,
+which should help.
+
+=head2 Does Perl have a year 2000 problem?
+
+Not unless you use Perl to create one. The date and time functions
+supplied with perl (gmtime and localtime) supply adequate information
+to determine the year well beyond 2000 (2038 is when trouble strikes).
+The year returned by these functions when used in an array context is
+the year minus 1900. For years between 1910 and 1999 this I<happens>
+to be a 2-digit decimal number. To avoid the year 2000 problem simply
+do not treat the year as a 2-digit number.  It isn't.
+
+When gmtime() and localtime() are used in a scalar context they return
+a timestamp string that contains a fully-expanded year.  For example,
+C<$timestamp = gmtime(1005613200)> sets $timestamp to "Tue Nov 13 01:00:00
+2001".  There's no year 2000 problem here.
+
+=head1 Data: Strings
+
+=head2 How do I validate input?
+
+The answer to this question is usually a regular expression, perhaps
+with auxiliary logic.  See the more specific questions (numbers, email
+addresses, etc.) for details.
+
+=head2 How do I unescape a string?
+
+It depends just what you mean by "escape".  URL escapes are dealt with
+in L<perlfaq9>.  Shell escapes with the backslash (\)
+character are removed with:
+
+    s/\\(.)/$1/g;
+
+Note that this won't expand \n or \t or any other special escapes.
+
+=head2 How do I remove consecutive pairs of characters?
+
+To turn "abbcccd" into "abccd":
+
+    s/(.)\1/$1/g;
+
+=head2 How do I expand function calls in a string?
+
+This is documented in L<perlref>.  In general, this is fraught with
+quoting and readability problems, but it is possible.  To interpolate
+a subroutine call (in a list context) into a string:
+
+    print "My sub returned @{[mysub(1,2,3)]} that time.\n";
+
+If you prefer scalar context, similar chicanery is also useful for
+arbitrary expressions:
+
+    print "That yields ${\($n + 5)} widgets\n";
+
+=head2 How do I find matching/nesting anything?
+
+This isn't something that can be tackled in one regular expression, no
+matter how complicated.  To find something between two single characters,
+a pattern like C</x([^x]*)x/> will get the intervening bits in $1. For
+multiple ones, then something more like C</alpha(.*?)omega/> would
+be needed.  But none of these deals with nested patterns, nor can they.
+For that you'll have to write a parser.
+
+=head2 How do I reverse a string?
+
+Use reverse() in a scalar context, as documented in
+L<perlfunc/reverse>.
+
+    $reversed = reverse $string;
+
+=head2 How do I expand tabs in a string?
+
+You can do it the old-fashioned way:
+
+    1 while $string =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e;
+
+Or you can just use the Text::Tabs module (part of the standard perl
+distribution).
+
+    use Text::Tabs;
+    @expanded_lines = expand(@lines_with_tabs);
+
+=head2 How do I reformat a paragraph?
+
+Use Text::Wrap (part of the standard perl distribution):
+
+    use Text::Wrap;
+    print wrap("\t", '  ', @paragraphs);
+
+=head2 How can I access/change the first N letters of a string?
+
+There are many ways.  If you just want to grab a copy, use
+substr:
+
+    $first_byte = substr($a, 0, 1);
+
+If you want to modify part of a string, the simplest way is often to
+use substr() as an lvalue:
+
+    substr($a, 0, 3) = "Tom";
+
+Although those with a regexp kind of thought process will likely prefer
+
+    $a =~ s/^.../Tom/;
+
+=head2 How do I change the Nth occurrence of something?
+
+You have to keep track.  For example, let's say you want
+to change the fifth occurrence of "whoever" or "whomever"
+into "whosoever", case insensitively.
+
+    $count = 0;
+    s{((whom?)ever)}{
+       ++$count == 5           # is it the 5th?
+           ? "${2}soever"      # yes, swap
+           : $1                # renege and leave it there
+    }igex;
+
+=head2 How can I count the number of occurrences of a substring within a string?
+
+There are a number of ways, with varying efficiency: If you want a
+count of a certain single character (X) within a string, you can use the
+C<tr///> function like so:
+
+    $string = "ThisXlineXhasXsomeXx'sXinXit":
+    $count = ($string =~ tr/X//);
+    print "There are $count X charcters in the string";
+
+This is fine if you are just looking for a single character.  However,
+if you are trying to count multiple character substrings within a
+larger string, C<tr///> won't work.  What you can do is wrap a while()
+loop around a global pattern match.  For example, let's count negative
+integers:
+
+    $string = "-9 55 48 -2 23 -76 4 14 -44";
+    while ($string =~ /-\d+/g) { $count++ }
+    print "There are $count negative numbers in the string";
+
+=head2 How do I capitalize all the words on one line?
+
+To make the first letter of each word upper case:
+        $line =~ s/\b(\w)/\U$1/g;
+
+To make the whole line upper case:
+        $line = uc($line);
+
+To force each word to be lower case, with the first letter upper case:
+        $line =~ s/(\w+)/\u\L$1/g;
+
+=head2 How can I split a [character] delimited string except when inside
+[character]? (Comma-separated files)
+
+Take the example case of trying to split a string that is comma-separated
+into its different fields.  (We'll pretend you said comma-separated, not
+comma-delimited, which is different and almost never what you mean.) You
+can't use C<split(/,/)> because you shouldn't split if the comma is inside
+quotes.  For example, take a data line like this:
+
+    SAR001,"","Cimetrix, Inc","Bob Smith","CAM",N,8,1,0,7,"Error, Core Dumped"
+
+Due to the restriction of the quotes, this is a fairly complex
+problem.  Thankfully, we have Jeffrey Friedl, author of a highly
+recommended book on regular expressions, to handle these for us.  He
+suggests (assuming your string is contained in $text):
+
+     @new = ();
+     push(@new, $+) while $text =~ m{
+         "([^\"\\]*(?:\\.[^\"\\]*)*)",?  # groups the phrase inside the quotes
+       | ([^,]+),?
+       | ,
+     }gx;
+     push(@new, undef) if substr($text,-1,1) eq ',';
+
+Alternatively, the Text::ParseWords module (part of the standard perl
+distribution) lets you say:
+
+    use Text::ParseWords;
+    @new = quotewords(",", 0, $text);
+
+=head2 How do I strip blank space from the beginning/end of a string?
+
+The simplest approach, albeit not the fastest, is probably like this:
+
+    $string =~ s/^\s*(.*?)\s*$/$1/;
+
+It would be faster to do this in two steps:
+
+    $string =~ s/^\s+//;
+    $string =~ s/\s+$//;
+
+Or more nicely written as:
+
+    for ($string) {
+       s/^\s+//;
+       s/\s+$//;
+    }
+
+=head2 How do I extract selected columns from a string?
+
+Use substr() or unpack(), both documented in L<perlfunc>.
+
+=head2 How do I find the soundex value of a string?
+
+Use the standard Text::Soundex module distributed with perl.
+
+=head2 How can I expand variables in text strings?
+
+Let's assume that you have a string like:
+
+    $text = 'this has a $foo in it and a $bar';
+    $text =~ s/\$(\w+)/${$1}/g;
+
+Before version 5 of perl, this had to be done with a double-eval
+substitution:
+
+    $text =~ s/(\$\w+)/$1/eeg;
+
+Which is bizarre enough that you'll probably actually need an EEG
+afterwards. :-)
+
+=head2 What's wrong with always quoting "$vars"?
+
+The problem is that those double-quotes force stringification,
+coercing numbers and references into strings, even when you
+don't want them to be.
+
+If you get used to writing odd things like these:
+
+    print "$var";      # BAD
+    $new = "$old";     # BAD
+    somefunc("$var");  # BAD
+
+You'll be in trouble.  Those should (in 99.8% of the cases) be
+the simpler and more direct:
+
+    print $var;
+    $new = $old;
+    somefunc($var);
+
+Otherwise, besides slowing you down, you're going to break code when
+the thing in the scalar is actually neither a string nor a number, but
+a reference:
+
+    func(\@array);
+    sub func {
+       my $aref = shift;
+       my $oref = "$aref";  # WRONG
+    }
+
+You can also get into subtle problems on those few operations in Perl
+that actually do care about the difference between a string and a
+number, such as the magical C<++> autoincrement operator or the
+syscall() function.
+
+=head2 Why don't my <<HERE documents work?
+
+Check for these three things:
+
+=over 4
+
+=item 1. There must be no space after the << part.
+
+=item 2. There (probably) should be a semicolon at the end.
+
+=item 3. You can't (easily) have any space in front of the tag.
+
+=back
+
+=head1 Data: Arrays
+
+=head2 What is the difference between $array[1] and @array[1]?
+
+The former is a scalar value, the latter an array slice, which makes
+it a list with one (scalar) value.  You should use $ when you want a
+scalar value (most of the time) and @ when you want a list with one
+scalar value in it (very, very rarely; nearly never, in fact).
+
+Sometimes it doesn't make a difference, but sometimes it does.
+For example, compare:
+
+    $good[0] = `some program that outputs several lines`;
+
+with
+
+    @bad[0]  = `same program that outputs several lines`;
+
+The B<-w> flag will warn you about these matters.
+
+=head2 How can I extract just the unique elements of an array?
+
+There are several possible ways, depending on whether the array is
+ordered and whether you wish to preserve the ordering.
+
+=over 4
+
+=item a) If @in is sorted, and you want @out to be sorted:
+
+    $prev = 'nonesuch';
+    @out = grep($_ ne $prev && ($prev = $_), @in);
+
+This is nice in that it doesn't use much extra memory,
+simulating uniq(1)'s behavior of removing only adjacent
+duplicates.
+
+=item b) If you don't know whether @in is sorted:
+
+    undef %saw;
+    @out = grep(!$saw{$_}++, @in);
+
+=item c) Like (b), but @in contains only small integers:
+
+    @out = grep(!$saw[$_]++, @in);
+
+=item d) A way to do (b) without any loops or greps:
+
+    undef %saw;
+    @saw{@in} = ();
+    @out = sort keys %saw;  # remove sort if undesired
+
+=item e) Like (d), but @in contains only small positive integers:
+
+    undef @ary;
+    @ary[@in] = @in;
+    @out = @ary;
+
+=back
+
+=head2 How can I tell whether an array contains a certain element?
+
+There are several ways to approach this.  If you are going to make
+this query many times and the values are arbitrary strings, the
+fastest way is probably to invert the original array and keep an
+associative array lying about whose keys are the first array's values.
+
+    @blues = qw/azure cerulean teal turquoise lapis-lazuli/;
+    undef %is_blue;
+    for (@blues) { $is_blue{$_} = 1 }
+
+Now you can check whether $is_blue{$some_color}.  It might have been a
+good idea to keep the blues all in a hash in the first place.
+
+If the values are all small integers, you could use a simple indexed
+array.  This kind of an array will take up less space:
+
+    @primes = (2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31);
+    undef @is_tiny_prime;
+    for (@primes) { $is_tiny_prime[$_] = 1; }
+
+Now you check whether $is_tiny_prime[$some_number].
+
+If the values in question are integers instead of strings, you can save
+quite a lot of space by using bit strings instead:
+
+    @articles = ( 1..10, 150..2000, 2017 );
+    undef $read;
+    grep (vec($read,$_,1) = 1, @articles);
+
+Now check whether C<vec($read,$n,1)> is true for some C<$n>.
+
+Please do not use
+
+    $is_there = grep $_ eq $whatever, @array;
+
+or worse yet
+
+    $is_there = grep /$whatever/, @array;
+
+These are slow (checks every element even if the first matches),
+inefficient (same reason), and potentially buggy (what if there are
+regexp characters in $whatever?).
+
+=head2 How do I compute the difference of two arrays?  How do I compute the intersection of two arrays?
+
+Use a hash.  Here's code to do both and more.  It assumes that
+each element is unique in a given array:
+
+    @union = @intersection = @difference = ();
+    %count = ();
+    foreach $element (@array1, @array2) { $count{$element}++ }
+    foreach $element (keys %count) {
+       push @union, $element;
+       push @{ $count{$element} > 1 ? \@intersection : \@difference }, $element;
+    }
+
+=head2 How do I find the first array element for which a condition is true?
+
+You can use this if you care about the index:
+
+    for ($i=0; $i < @array; $i++) {
+        if ($array[$i] eq "Waldo") {
+           $found_index = $i;
+            last;
+        }
+    }
+
+Now C<$found_index> has what you want.
+
+=head2 How do I handle linked lists?
+
+In general, you usually don't need a linked list in Perl, since with
+regular arrays, you can push and pop or shift and unshift at either end,
+or you can use splice to add and/or remove arbitrary number of elements
+at arbitrary points.
+
+If you really, really wanted, you could use structures as described in
+L<perldsc> or L<perltoot> and do just what the algorithm book tells you
+to do.
+
+=head2 How do I handle circular lists?
+
+Circular lists could be handled in the traditional fashion with linked
+lists, or you could just do something like this with an array:
+
+    unshift(@array, pop(@array));  # the last shall be first
+    push(@array, shift(@array));   # and vice versa
+
+=head2 How do I shuffle an array randomly?
+
+Here's a shuffling algorithm which works its way through the list,
+randomly picking another element to swap the current element with:
+
+    srand;
+    @new = ();
+    @old = 1 .. 10;  # just a demo
+    while (@old) {
+       push(@new, splice(@old, rand @old, 1));
+    }
+
+For large arrays, this avoids a lot of the reshuffling:
+
+    srand;
+    @new = ();
+    @old = 1 .. 10000;  # just a demo
+    for( @old ){
+        my $r = rand @new+1;
+        push(@new,$new[$r]);
+        $new[$r] = $_;
+    }
+
+=head2 How do I process/modify each element of an array?
+
+Use C<for>/C<foreach>:
+
+    for (@lines) {
+       s/foo/bar/;
+       tr[a-z][A-Z];
+    }
+
+Here's another; let's compute spherical volumes:
+
+    for (@radii) {
+       $_ **= 3;
+       $_ *= (4/3) * 3.14159;  # this will be constant folded
+    }
+
+=head2 How do I select a random element from an array?
+
+Use the rand() function (see L<perlfunc/rand>):
+
+    srand;                     # not needed for 5.004 and later
+    $index   = rand @array;
+    $element = $array[$index];
+
+=head2 How do I permute N elements of a list?
+
+Here's a little program that generates all permutations
+of all the words on each line of input.  The algorithm embodied
+in the permut() function should work on any list:
+
+    #!/usr/bin/perl -n
+    # permute - tchrist@perl.com
+    permut([split], []);
+    sub permut {
+       my @head = @{ $_[0] };
+       my @tail = @{ $_[1] };
+       unless (@head) {
+           # stop recursing when there are no elements in the head
+           print "@tail\n";
+       } else {
+           # for all elements in @head, move one from @head to @tail
+           # and call permut() on the new @head and @tail
+           my(@newhead,@newtail,$i);
+           foreach $i (0 .. $#head) {
+               @newhead = @head;
+               @newtail = @tail;
+               unshift(@newtail, splice(@newhead, $i, 1));
+               permut([@newhead], [@newtail]);
+           }
+       }
+    }
+
+=head2 How do I sort an array by (anything)?
+
+Supply a comparison function to sort() (described in L<perlfunc/sort>):
+
+    @list = sort { $a <=> $b } @list;
+
+The default sort function is cmp, string comparison, which would
+sort C<(1, 2, 10)> into C<(1, 10, 2)>.  C<E<lt>=E<gt>>, used above, is
+the numerical comparison operator.
+
+If you have a complicated function needed to pull out the part you
+want to sort on, then don't do it inside the sort function.  Pull it
+out first, because the sort BLOCK can be called many times for the
+same element.  Here's an example of how to pull out the first word
+after the first number on each item, and then sort those words
+case-insensitively.
+
+    @idx = ();
+    for (@data) {
+       ($item) = /\d+\s*(\S+)/;
+       push @idx, uc($item);
+    }
+    @sorted = @data[ sort { $idx[$a] cmp $idx[$b] } 0 .. $#idx ];
+
+Which could also be written this way, using a trick
+that's come to be known as the Schwartzian Transform:
+
+    @sorted = map  { $_->[0] }
+             sort { $a->[1] cmp $b->[1] }
+             map  { [ $_, uc((/\d+\s*(\S+) )[0] ] } @data;
+
+If you need to sort on several fields, the following paradigm is useful.
+
+    @sorted = sort { field1($a) <=> field1($b) ||
+                     field2($a) cmp field2($b) ||
+                     field3($a) cmp field3($b)
+                   }     @data;
+
+This can be conveniently combined with precalculation of keys as given
+above.
+
+See http://www.perl.com/CPAN/doc/FMTEYEWTK/sort.html for more about
+this approach.
+
+See also the question below on sorting hashes.
+
+=head2 How do I manipulate arrays of bits?
+
+Use pack() and unpack(), or else vec() and the bitwise operations.
+
+For example, this sets $vec to have bit N set if $ints[N] was set:
+
+    $vec = '';
+    foreach(@ints) { vec($vec,$_,1) = 1 }
+
+And here's how, given a vector in $vec, you can
+get those bits into your @ints array:
+
+    sub bitvec_to_list {
+       my $vec = shift;
+       my @ints;
+       # Find null-byte density then select best algorithm
+       if ($vec =~ tr/\0// / length $vec > 0.95) {
+           use integer;
+           my $i;
+           # This method is faster with mostly null-bytes
+           while($vec =~ /[^\0]/g ) {
+               $i = -9 + 8 * pos $vec;
+           &n