From 68dc074516a6859e3424b48d1647bcb08b1a1a7d Mon Sep 17 00:00:00 2001 From: Perl 5 Porters Date: Sun, 9 Mar 1997 11:57:19 +1200 Subject: [inseparable changes from match from perl-5.003_93 to perl-5.003_94] BUILD PROCESS Subject: Don't use db 2.x, we're not yet ready for it From: Paul Marquess Files: Configure Subject: Warn if #! command is longer than 32 chars From: Chip Salzenberg Files: Configure Subject: patches re perl -wc install{perl,man} Date: Tue, 11 Mar 97 13:13:16 GMT From: Robin Barker 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 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 Files: installperl Subject: Make hint files' warnings more visible Date: Thu, 20 Mar 1997 23:18:03 +0100 (MET) From: Hallvard B Furuseth 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 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 Files: keywords.pl pod/perldata.pod toke.c Subject: Abort compilation at C or C after errors From: Chip Salzenberg Files: op.c pod/perldiag.pod t/pragma/subs.t Subject: allow C Date: Mon, 10 Mar 1997 15:55:44 -0800 From: David Dyck Files: pp.c Msg-ID: 97Mar10.155517pst.35716-2@gateway.fluke.com (applied based on p5p patch as commit 77f720bf92f3d0100352416caeedd57936807ff2) Subject: Regularize C, esp. when y is negative From: Chip Salzenberg Files: pp.c Subject: Flush before C From: Chip Salzenberg Files: pod/perldelta.pod pod/perlfunc.pod pp_sys.c Subject: Close loopholes in prototype mismatch warning From: Chip Salzenberg Files: op.c sv.c toke.c Subject: Warn on C From: Chip Salzenberg Files: op.c pod/perldiag.pod Subject: Don't warn on C From: Chip Salzenberg 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 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 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 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 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 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 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 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 Files: pod/perldelta.pod Subject: Re: Embedding success with _93 Date: Tue, 11 Mar 1997 17:55:05 -0500 From: Doug MacEachern 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 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 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 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 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 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" 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 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 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 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 Files: pod/perlfunc.pod private-msgid: 199703201746.TAA25195@alpha.hut.fi Subject: Regularize headings in DB_File documentation From: Chip Salzenberg 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 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 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 Files: lib/File/Path.pm Subject: Fix bugs revealed by prototype warnings From: Chip Salzenberg 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 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 at file scope From: Chip Salzenberg Files: lib/Exporter.pm Subject: fix for Exporter's $SIG{__WARN__} handler Date: Thu, 13 Mar 1997 18:40:51 -0500 From: Roderick Schertler 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 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" 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 Files: toke.c Subject: 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 Subject: Fix C on tied default handle From: Chip Salzenberg Files: pp_hot.c Subject: Fix C From: Chip Salzenberg Files: op.c Subject: Improve diagnostic on C<@a++>, C<--%a>, @a =~ s/a/b/ From: Chip Salzenberg Files: pp.c pp_hot.c Subject: Don't warn on C<$x{y} .= "z"> when %x is tied From: Chip Salzenberg Files: pp_hot.c Subject: Eliminate 'unreachable code' warnings From: Chip Salzenberg 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 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 Files: perl.c Msg-ID: 199703192345.SAA15070@postman.osf.org (applied based on p5p patch as commit 71aeea1753924e6e19c2461e241e3f7d8a570e90) --- Changes | 390 ++++++++ Configure | 74 +- MANIFEST | 28 +- README.win32 | 275 ++++++ doop.c | 6 +- dump.c | 20 +- embed.h | 18 +- ext/DB_File/DB_File.pm | 37 +- ext/DB_File/DB_File.xs | 5 +- ext/Opcode/Opcode.pm | 7 +- ext/POSIX/POSIX.xs | 6 +- global.sym | 18 +- hints/3b1.sh | 4 +- hints/apollo.sh | 2 +- hints/cxux.sh | 31 +- hints/dcosx.sh | 16 +- hints/dgux.sh | 2 +- hints/esix4.sh | 4 +- hints/freebsd.sh | 2 +- hints/hpux.sh | 16 +- hints/irix_4.sh | 2 +- hints/mips.sh | 2 +- hints/next_3_0.sh | 18 +- hints/os2.sh | 2 +- hints/qnx.sh | 6 +- hints/sco_2_3_3.sh | 4 +- hints/sco_2_3_4.sh | 4 +- hints/solaris_2.sh | 16 +- hints/ultrix_4.sh | 2 +- hints/utekv.sh | 8 +- hv.c | 70 +- installman | 2 +- installperl | 151 +-- keywords.h | 489 +++++----- keywords.pl | 3 +- lib/AutoSplit.pm | 29 +- lib/Carp.pm | 22 +- lib/Cwd.pm | 4 + lib/Exporter.pm | 42 +- lib/ExtUtils/Command.pm | 212 +++++ lib/ExtUtils/Install.pm | 11 + lib/ExtUtils/MM_OS2.pm | 11 + lib/ExtUtils/MM_Unix.pm | 125 ++- lib/ExtUtils/MM_VMS.pm | 5 +- lib/ExtUtils/MM_Win32.pm | 493 ++++++++++ lib/ExtUtils/MakeMaker.pm | 15 +- lib/ExtUtils/Mksymlists.pm | 28 + lib/File/Basename.pm | 19 +- lib/File/Path.pm | 33 +- lib/Getopt/Long.pm | 2 +- lib/Test/Harness.pm | 12 +- lib/autouse.pm | 165 ++++ malloc.c | 14 +- mg.c | 78 +- op.c | 73 +- op.h | 9 +- patchlevel.h | 2 +- perl.c | 14 +- perl.h | 118 +-- plan9/buildinfo | 2 +- pod/Makefile | 40 + pod/buildtoc | 12 +- pod/perl.pod | 3 +- pod/perlcall.pod | 4 +- pod/perldata.pod | 33 +- pod/perldebug.pod | 8 +- pod/perldelta.pod | 26 +- pod/perldiag.pod | 65 +- pod/perldsc.pod | 2 +- pod/perlfaq.pod | 138 +++ pod/perlfaq1.pod | 248 +++++ pod/perlfaq2.pod | 419 +++++++++ pod/perlfaq3.pod | 503 ++++++++++ pod/perlfaq4.pod | 1034 +++++++++++++++++++++ pod/perlfaq5.pod | 788 ++++++++++++++++ pod/perlfaq6.pod | 580 ++++++++++++ pod/perlfaq7.pod | 675 ++++++++++++++ pod/perlfaq8.pod | 749 +++++++++++++++ pod/perlfaq9.pod | 277 ++++++ pod/perlform.pod | 8 +- pod/perlfunc.pod | 51 +- pod/perlguts.pod | 51 +- pod/perlipc.pod | 59 ++ pod/perllocale.pod | 4 +- pod/perlobj.pod | 2 +- pod/perlop.pod | 28 +- pod/perlre.pod | 22 +- pod/perlrun.pod | 78 ++ pod/perlsec.pod | 35 + pod/perltoc.pod | 859 ++++++++++++++++- pod/perltoot.pod | 10 +- pod/perltrap.pod | 38 +- pod/perlvar.pod | 17 + pod/perlxs.pod | 2 +- pod/perlxstut.pod | 2 +- pod/roffitall | 10 + pp.c | 57 +- pp_ctl.c | 18 +- pp_hot.c | 94 +- pp_sys.c | 1 + proto.h | 18 +- regexec.c | 4 +- sv.c | 65 +- t/comp/cpp.t | 3 +- t/comp/script.t | 7 +- t/harness | 2 +- t/io/argv.t | 24 +- t/io/dup.t | 13 +- t/io/fs.t | 8 +- t/io/inplace.t | 15 +- t/lib/filehand.t | 2 +- t/lib/io_dup.t | 13 +- t/lib/io_sel.t | 8 + t/lib/io_taint.t | 2 +- t/op/closure.t | 8 +- t/op/exec.t | 7 + t/op/glob.t | 7 +- t/op/goto.t | 3 +- t/op/magic.t | 73 +- t/op/misc.t | 13 +- t/op/rand.t | 10 +- t/op/split.t | 3 +- t/op/stat.t | 40 +- t/op/sysio.t | 2 +- t/op/taint.t | 10 +- t/pragma/strict.t | 3 + t/pragma/subs.t | 5 +- t/pragma/warning.t | 3 + toke.c | 88 +- util.c | 31 + utils/perlbug.PL | 6 +- vms/config.vms | 2 +- vms/descrip.mms | 19 +- vms/ext/vmsish.t | 122 +++ vms/vms.c | 10 + win32/Fcntl.mak | 12 +- win32/IO.mak | 12 +- win32/Makefile | 308 ++++-- win32/Opcode.mak | 12 +- win32/SDBM_File.mak | 16 +- win32/Socket.mak | 12 +- win32/TEST | 4 +- win32/VC-2.0/SDBM_File.mak | 361 ++++++++ win32/VC-2.0/Socket.mak | 276 ++++++ win32/VC-2.0/libperl.mak | 2217 ++++++++++++++++++++++++++++++++++++++++++++ win32/VC-2.0/miniperl.mak | 393 ++++++++ win32/VC-2.0/modules.mak | 828 +++++++++++++++++ win32/VC-2.0/perl.mak | 228 +++++ win32/VC-2.0/perldll.mak | 436 +++++++++ win32/VC-2.0/vc2.patch | 16 + win32/config.H | 482 +++++++--- win32/config.w32 | 340 +++---- win32/dl_win32.xs | 22 +- win32/dosish.h | 10 +- win32/libperl.mak | 12 +- win32/makedef.pl | 48 + win32/miniperl.mak | 16 +- win32/modules.mak | 48 +- win32/perl.mak | 14 +- win32/perldll.mak | 16 +- win32/perlglob.c | 2 +- win32/perlglob.mak | 12 +- win32/perllib.c | 109 +-- win32/splittree.pl | 2 +- win32/win32.c | 1314 +++++++++++++------------- win32/win32.h | 57 +- win32/win32aux.c | 40 + win32/win32io.c | 238 +++++ win32/win32io.h | 60 +- win32/win32iop.h | 64 +- win32/win32sck.c | 864 +++++++++-------- x2p/str.c | 4 +- x2p/util.c | 9 +- 173 files changed, 17117 insertions(+), 2774 deletions(-) create mode 100644 README.win32 create mode 100644 lib/ExtUtils/Command.pm create mode 100644 lib/ExtUtils/MM_Win32.pm create mode 100644 lib/autouse.pm create mode 100644 pod/perlfaq.pod create mode 100644 pod/perlfaq1.pod create mode 100644 pod/perlfaq2.pod create mode 100644 pod/perlfaq3.pod create mode 100644 pod/perlfaq4.pod create mode 100644 pod/perlfaq5.pod create mode 100644 pod/perlfaq6.pod create mode 100644 pod/perlfaq7.pod create mode 100644 pod/perlfaq8.pod create mode 100644 pod/perlfaq9.pod create mode 100644 vms/ext/vmsish.t create mode 100644 win32/VC-2.0/SDBM_File.mak create mode 100644 win32/VC-2.0/Socket.mak create mode 100644 win32/VC-2.0/libperl.mak create mode 100644 win32/VC-2.0/miniperl.mak create mode 100644 win32/VC-2.0/modules.mak create mode 100644 win32/VC-2.0/perl.mak create mode 100644 win32/VC-2.0/perldll.mak create mode 100644 win32/VC-2.0/vc2.patch create mode 100644 win32/win32aux.c create mode 100644 win32/win32io.c diff --git a/Changes b/Changes index 701c87109c..b7f1ad5f70 100644 --- a/Changes +++ b/Changes @@ -8,6 +8,396 @@ or in the .../src/5/0/unsupported directory for sub-version 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 or C after errors" + From: Chip Salzenberg + Files: op.c pod/perldiag.pod t/pragma/subs.t + + Title: "allow C" + From: David Dyck + Msg-ID: <97Mar10.155517pst.35716-2@gateway.fluke.com> + Date: Mon, 10 Mar 1997 15:55:44 -0800 + Files: pp.c + + Title: "Regularize C, esp. when y is negative" + From: Chip Salzenberg + Files: pp.c + + Title: "Flush before C" + 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" + From: Chip Salzenberg + Files: op.c pod/perldiag.pod + + Title: "Don't warn on C" + From: Chip Salzenberg + Files: toke.c + + CORE PORTABILITY + + Title: "Don't say 'static var = 1'" + From: Jarkko Hietaniemi + 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 + Msg-ID: + Date: 14 Mar 1997 16:20:46 -0500 + Files: hints/bsdos.sh + + Title: "More MachTen hints" + From: Tom Phoenix + Msg-ID: + Msg-ID: + 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 + 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 and + Nick Ing-Simmons + 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 on tied default handle" + From: Chip Salzenberg + Files: pp_hot.c + + Title: "Fix C" + 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 + 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 + 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 + 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 + 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 + 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 + 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 + Msg-ID: + 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 + 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 + 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 at file scope" + From: Chip Salzenberg + Files: lib/Exporter.pm + + Title: "fix for Exporter's $SIG{__WARN__} handler" + From: Roderick Schertler + 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" + Msg-ID: + 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" + Msg-ID: + 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 + Msg-ID: + Date: 11 Mar 1997 19:09:31 -0500 + Files: pod/pod2man.PL + + DOCUMENTATION + + Title: "perlfaq.pod" + From: Tom Christiansen + 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 + Msg-ID: + 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 + Msg-ID: + 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 + 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 + Msg-ID: + Msg-ID: + Msg-ID: + Date: Wed, 19 Mar 1997 07:28:57 -0800 (PST) + Files: pod/perlop.pod + + Title: "XSUB's doc fix" + From: Roderick Schertler + 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" + Msg-ID: + Date: Tue, 18 Mar 1997 14:50:10 +0000 + Files: pod/perlfunc.pod + + Title: "Document $^M in perlvar" + From: Robin Barker + 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 + Msg-ID: + 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 + 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 ---------------- diff --git a/Configure b/Configure index 5eacc6c4c4..43fb081143 100755 --- 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 <&4 + $cat >try.c < +#include +#include +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 @@ -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 diff --git a/MANIFEST b/MANIFEST index 8b0b49709b..987d22c10a 100644 --- 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 index 0000000000..36953ec0da --- /dev/null +++ b/README.win32 @@ -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 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 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 and C 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, C, +C, C, C, C, C, C, +C, C, C, C, +C, C, C. This list is possibly incomplete. + +=item * + +Various C related calls are supported, but they may not +behave as on Unix platforms. + +=item * + +The four-argument C call is only supported on sockets. + +=item * + +The behavior of C or the C 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, C 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 >, along with the output produced +by C. + +=head1 AUTHORS + +=over 4 + +=item Gary Ng > + +=item Gurusamy Sarathy > + +=item Nick Ing-Simmons > + +=back + +=head1 SEE ALSO + +L + +=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 7086a7bf4d..a87f7ef7ac 100644 --- 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 0b2084e1c5..af75cf7bd5 100644 --- 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 faa9225c37..3beabb649c 100644 --- 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 @@ -232,19 +232,19 @@ #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 @@ -307,11 +307,11 @@ #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 @@ -325,11 +325,11 @@ #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 @@ -845,7 +845,6 @@ #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 @@ -1064,20 +1063,21 @@ #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 diff --git a/ext/DB_File/DB_File.pm b/ext/DB_File/DB_File.pm index d962b88b2e..c2609a074b 100644 --- a/ext/DB_File/DB_File.pm +++ b/ext/DB_File/DB_File.pm @@ -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 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 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 allows access to Berkeley DB files using the tie() mechanism in Perl 5 (for full details, see L). This facility @@ -533,7 +537,7 @@ The DB_HASH file format is probably the most commonly used of the three file formats that B 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. -=head2 The get_dup method. +=head2 The get_dup() Method B comes with a utility method, called C, 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 for more details. +See L for more details. All the functions defined in L are available except for close() and dbopen() itself. The B 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). untie %hist_db ; -=head2 The untie gotcha +=head2 The untie() Gotcha If you make use of the Berkeley DB API, it is is I strongly -recommended that you read L. +recommended that you read L. 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 comes with the standard Perl source distribution. Look in the directory F. -Berkeley DB is available at your nearest CPAN archive (see +This version of B will only work with version 1.x of Berkeley +DB. It is I yet compatible with version 2. + +Version 1 of Berkeley DB is available at your nearest CPAN archive (see L for a list) in F, or via the host F in F. Alternatively, check out the Berkeley DB home page at F. It diff --git a/ext/DB_File/DB_File.xs b/ext/DB_File/DB_File.xs index 796c5c669c..93cf44aa3a 100644 --- a/ext/DB_File/DB_File.xs +++ b/ext/DB_File/DB_File.xs @@ -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 */ diff --git a/ext/Opcode/Opcode.pm b/ext/Opcode/Opcode.pm index 1675d469b1..5db658d601 100644 --- a/ext/Opcode/Opcode.pm +++ b/ext/Opcode/Opcode.pm @@ -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]); diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index 2575ca19cb..f723db796a 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -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 diff --git a/global.sym b/global.sym index f1d0573b22..ddfe93130c 100644 --- a/global.sym +++ b/global.sym @@ -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 diff --git a/hints/3b1.sh b/hints/3b1.sh index 2ed65c591b..991348af3e 100644 --- a/hints/3b1.sh +++ b/hints/3b1.sh @@ -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 diff --git a/hints/apollo.sh b/hints/apollo.sh index 2618039634..8c361aa051 100644 --- a/hints/apollo.sh +++ b/hints/apollo.sh @@ -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 diff --git a/hints/cxux.sh b/hints/cxux.sh index f2e8c17c10..42bfe5d579 100644 --- a/hints/cxux.sh +++ b/hints/cxux.sh @@ -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 diff --git a/hints/dcosx.sh b/hints/dcosx.sh index 36afd3b921..c1b0d0ac42 100644 --- a/hints/dcosx.sh +++ b/hints/dcosx.sh @@ -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 <&2 NOTE: /usr/ucb/cc does not function properly. Remove /usr/ucb from your PATH. @@ -37,7 +37,7 @@ esac case $? in 0) ;; *) - cat <&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 <&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 <&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 <&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 <&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 <&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 <&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 diff --git a/hints/dgux.sh b/hints/dgux.sh index 0b9dd11766..d751e63a64 100644 --- a/hints/dgux.sh +++ b/hints/dgux.sh @@ -104,7 +104,7 @@ do do [ -d "$sde_path/$sde" ] && break 2 done - cat <&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 diff --git a/hints/esix4.sh b/hints/esix4.sh index c8dec8a8b8..3d3145d255 100644 --- a/hints/esix4.sh +++ b/hints/esix4.sh @@ -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 <&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 diff --git a/hints/freebsd.sh b/hints/freebsd.sh index 4d2ba22b10..4b7653a784 100644 --- a/hints/freebsd.sh +++ b/hints/freebsd.sh @@ -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 diff --git a/hints/hpux.sh b/hints/hpux.sh index 695ae6e08f..2e8b16cd21 100644 --- a/hints/hpux.sh +++ b/hints/hpux.sh @@ -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 -# This version: December 27, 1996 +# This version: March 21, 1997 # Current maintainer: Jeff Okamoto +#-------------------------------------------------------------------- # 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 diff --git a/hints/irix_4.sh b/hints/irix_4.sh index a5d08e05b6..f5883f38cb 100644 --- a/hints/irix_4.sh +++ b/hints/irix_4.sh @@ -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. diff --git a/hints/mips.sh b/hints/mips.sh index 7ed058e4ad..bc0b7e8073 100644 --- a/hints/mips.sh +++ b/hints/mips.sh @@ -6,7 +6,7 @@ glibpth="/usr/lib/cmplrs/cc $glibpth" groupstype=int nm_opt='-B' case $PATH in -*bsd*:/bin:*) cat <&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 diff --git a/hints/next_3_0.sh b/hints/next_3_0.sh index 080829bd27..b8cc2c2d90 100644 --- a/hints/next_3_0.sh +++ b/hints/next_3_0.sh @@ -6,15 +6,15 @@ # , 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"' diff --git a/hints/os2.sh b/hints/os2.sh index 70e478b96f..c442a08086 100644 --- a/hints/os2.sh +++ b/hints/os2.sh @@ -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 ';\\\' ' /'`" diff --git a/hints/qnx.sh b/hints/qnx.sh index e0ce55c249..9334c94339 100644 --- a/hints/qnx.sh +++ b/hints/qnx.sh @@ -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 diff --git a/hints/sco_2_3_3.sh b/hints/sco_2_3_3.sh index 10baafd6a3..6d398fccf2 100644 --- a/hints/sco_2_3_3.sh +++ b/hints/sco_2_3_3.sh @@ -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 diff --git a/hints/sco_2_3_4.sh b/hints/sco_2_3_4.sh index 84f58172b3..34bcadae5f 100644 --- a/hints/sco_2_3_4.sh +++ b/hints/sco_2_3_4.sh @@ -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 diff --git a/hints/solaris_2.sh b/hints/solaris_2.sh index 255811f2a6..89dde018de 100644 --- a/hints/solaris_2.sh +++ b/hints/solaris_2.sh @@ -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 <&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 <&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 <&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 <&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 <&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 <&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 <&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 <&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 diff --git a/hints/ultrix_4.sh b/hints/ultrix_4.sh index d3c4a39880..d8d2063b22 100644 --- a/hints/ultrix_4.sh +++ b/hints/ultrix_4.sh @@ -22,7 +22,7 @@ esac # Then run "sh5 Configure.sh5 [your options]" case "$myuname" in -*risc*) cat <&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. diff --git a/hints/utekv.sh b/hints/utekv.sh index ebc7809c60..95a31fdedf 100644 --- a/hints/utekv.sh +++ b/hints/utekv.sh @@ -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 cb2b8fea67..f63dff871a 100644 --- 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; diff --git a/installman b/installman index 600a68180e..c97febac2a 100755 --- a/installman +++ b/installman @@ -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; } diff --git a/installperl b/installperl index 1267f49efc..764a6f917b 100755 --- a/installperl +++ b/installperl @@ -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; diff --git a/keywords.h b/keywords.h index 8cb2748d75..cd08665563 100644 --- a/keywords.h +++ b/keywords.h @@ -1,245 +1,246 @@ #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 diff --git a/keywords.pl b/keywords.pl index 595e875bc4..8920a3b5bc 100755 --- a/keywords.pl +++ b/keywords.pl @@ -25,8 +25,9 @@ sub tab { __END__ NULL -__LINE__ __FILE__ +__LINE__ +__PACKAGE__ __DATA__ __END__ AUTOLOAD diff --git a/lib/AutoSplit.pm b/lib/AutoSplit.pm index f7b8eee76d..ab634b2330 100644 --- a/lib/AutoSplit.pm +++ b/lib/AutoSplit.pm @@ -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 diff --git a/lib/Carp.pm b/lib/Carp.pm index ec08d30c19..c0cfe08d44 100644 --- a/lib/Carp.pm +++ b/lib/Carp.pm @@ -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 { diff --git a/lib/Cwd.pm b/lib/Cwd.pm index e93cf1a0a9..f924a59647 100644 --- a/lib/Cwd.pm +++ b/lib/Cwd.pm @@ -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; diff --git a/lib/Exporter.pm b/lib/Exporter.pm index abdb1e788b..7b03732790 100644 --- a/lib/Exporter.pm +++ b/lib/Exporter.pm @@ -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 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 method when processing a C statement for a module. Modules and C are documented diff --git a/lib/ExtUtils/Command.pm b/lib/ExtUtils/Command.pm new file mode 100644 index 0000000000..8c4fd7a916 --- /dev/null +++ b/lib/ExtUtils/Command.pm @@ -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 >. + +=cut + diff --git a/lib/ExtUtils/Install.pm b/lib/ExtUtils/Install.pm index a88bd9975e..71f553bcbf 100644 --- a/lib/ExtUtils/Install.pm +++ b/lib/ExtUtils/Install.pm @@ -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('',).'}}'; + eval $str; + close(FROMTO); + } + my $umask = umask 0022 unless $Is_VMS; mkpath($autodir,0,0755); foreach (keys %$fromto) { diff --git a/lib/ExtUtils/MM_OS2.pm b/lib/ExtUtils/MM_OS2.pm index 1a1f8b16a0..65abfc2d99 100644 --- a/lib/ExtUtils/MM_OS2.pm +++ b/lib/ExtUtils/MM_OS2.pm @@ -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__ diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm index 465a075132..f4ee44f4b9 100644 --- a/lib/ExtUtils/MM_Unix.pm +++ b/lib/ExtUtils/MM_Unix.pm @@ -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 diff --git a/lib/ExtUtils/MM_VMS.pm b/lib/ExtUtils/MM_VMS.pm index 0e2897c1ad..23e8fdbe7d 100644 --- a/lib/ExtUtils/MM_VMS.pm +++ b/lib/ExtUtils/MM_VMS.pm @@ -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 index 0000000000..d001901f37 --- /dev/null +++ b/lib/ExtUtils/MM_Win32.pm @@ -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 + +=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{ <{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 + diff --git a/lib/ExtUtils/MakeMaker.pm b/lib/ExtUtils/MakeMaker.pm index bf0b0d202e..eb49f3e55f 100644 --- a/lib/ExtUtils/MakeMaker.pm +++ b/lib/ExtUtils/MakeMaker.pm @@ -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 <{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) = @_; diff --git a/lib/File/Basename.pm b/lib/File/Basename.pm index 6abfcd2cb4..0442aed8c5 100644 --- a/lib/File/Basename.pm +++ b/lib/File/Basename.pm @@ -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; diff --git a/lib/File/Path.pm b/lib/File/Path.pm index 2e35303bb3..137e7bb1ce 100644 --- a/lib/File/Path.pm +++ b/lib/File/Path.pm @@ -83,20 +83,24 @@ Charles Bailey EFE =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) diff --git a/lib/Getopt/Long.pm b/lib/Getopt/Long.pm index ec4ccd98e9..740b83fe54 100644 --- a/lib/Getopt/Long.pm +++ b/lib/Getopt/Long.pm @@ -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); diff --git a/lib/Test/Harness.pm b/lib/Test/Harness.pm index 1bc791be3e..6979a11549 100644 --- a/lib/Test/Harness.pm +++ b/lib/Test/Harness.pm @@ -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 index 0000000000..e2ef580392 --- /dev/null +++ b/lib/autouse.pm @@ -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 is already loaded, then the declaration + + use autouse 'Module' => qw(func1 func2($;$) Module::func3); + +is equivalent to + + use Module qw(func1 func2); + +if C defines func2() with prototype C<($;$)>, and func1() and +func3() have no prototypes. (At least if C uses C's +C, otherwise it is a fatal error.) + +If the module C 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 if needed, and substitute themselves +with the correct definitions. + +=head1 WARNING + +Using C 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 Cd 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 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 Cing 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 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 diff --git a/malloc.c b/malloc.c index 379861ebe9..e9b200ba69 100644 --- 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 7fba763920..c3e6153b4e 100644 --- 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 3b05012774..55b0422b4f 100644 --- 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 67435f9299..630e94a56e 100644 --- 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. */ diff --git a/patchlevel.h b/patchlevel.h index 15e2194ec8..f7cc9dda21 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -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 06534ff7b2..dfda39fb68 100644 --- 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 dace51df27..42740bab4b 100644 --- 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 @@ -88,6 +88,10 @@ # 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 @@ -433,7 +437,9 @@ # ifdef VMS char *strerror _((int,...)); # else +#ifndef DONT_DECLARE_STD char *strerror _((int)); +#endif # endif # ifndef Strerror # define Strerror strerror @@ -449,55 +455,6 @@ # 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 @@ -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; diff --git a/plan9/buildinfo b/plan9/buildinfo index 97d00f43be..49489adae9 100644 --- a/plan9/buildinfo +++ b/plan9/buildinfo @@ -1 +1 @@ -p9pvers = 5.003_93 +p9pvers = 5.003_94 diff --git a/pod/Makefile b/pod/Makefile index cf1e7a49d5..0ec08f992a 100644 --- a/pod/Makefile +++ b/pod/Makefile @@ -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) diff --git a/pod/buildtoc b/pod/buildtoc index e8557c764f..31712e290c 100644 --- a/pod/buildtoc +++ b/pod/buildtoc @@ -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/ } diff --git a/pod/perl.pod b/pod/perl.pod index f3ddc3c2c7..2c1dde2039 100644 --- a/pod/perl.pod +++ b/pod/perl.pod @@ -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 enough hype. +Okay, that's I enough hype. =head1 ENVIRONMENT diff --git a/pod/perlcall.pod b/pod/perlcall.pod index 9a4a886a59..1ff71fc581 100644 --- a/pod/perlcall.pod +++ b/pod/perlcall.pod @@ -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 for details +See the L 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 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 call. If you are making use of the Perl stack pointer in your code you must diff --git a/pod/perldata.pod b/pod/perldata.pod index 1878f4a5fa..f0837b3854 100644 --- a/pod/perldata.pod +++ b/pod/perldata.pod @@ -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 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 and +L 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). -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 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 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 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 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: diff --git a/pod/perldebug.pod b/pod/perldebug.pod index a682de1ade..61263b6664 100644 --- a/pod/perldebug.pod +++ b/pod/perldebug.pod @@ -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. =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 command might +Here's an example of what a stack backtrace via C 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 -or B, the stack back-trace will not show the original values. +or B, the stack backtrace will not show the original values. diff --git a/pod/perldelta.pod b/pod/perldelta.pod index cf6036ff02..958bee38ed 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -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 +reset when an already-open file handle is re-opened with no intervening +call to C. Due to a bug, perl versions 5.000 through 5.0003 +I 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) =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 returns I if its object is blessed into a sub-class of C +C returns I if its object is blessed into a subclass of C C 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). 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 diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 24b16128dd..e0a23b0162 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -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. +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. Trappable errors may be trapped using the eval operator. See L. @@ -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 subroutine (or a C directive, which +implies a C) after one or more compilation errors had +already occurred. Since the intended environment for the C +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. CEEOF;>). Note that Perl always -opens scripts in text mode, so this error should only occur in C. +here documents (e.g., CEEOF;>). + +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 operator). + +In either case, the Perl code in question will probably need to be +converted with something like C 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 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 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. =item Substitution pattern not terminated @@ -2490,13 +2511,13 @@ L for more on this. (W) A copy of the object returned from C (or C) was still valid when C 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 , <*> (glob), or -C 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 operator. +(W) In a conditional expression, you used , <*> (glob), C, +or C 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 operator. =item Variable "%s" is not imported%s diff --git a/pod/perldsc.pod b/pod/perldsc.pod index fad539c0ec..61c45b970c 100644 --- a/pod/perldsc.pod +++ b/pod/perldsc.pod @@ -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 command which is nearly the same. +There's also a lowercase B command which is nearly the same. =head1 CODE EXAMPLES diff --git a/pod/perlfaq.pod b/pod/perlfaq.pod new file mode 100644 index 0000000000..8db316c24b --- /dev/null +++ b/pod/perlfaq.pod @@ -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: General Questions About Perl + +Very general, high-level information about Perl. + +=item L: Obtaining and Learning about Perl + +Where to find source and documentation to Perl, support and training, +and related matters. + +=item L: Programming Tools + +Programmer tools and programming support. + +=item L: Data Manipulation + +Manipulating numbers, dates, strings, arrays, hashes, and +miscellaneous data issues. + +=item L: Files and Formats + +I/O and the "f" issues: filehandles, flushing, formats and footers. + +=item L: Regexps + +Pattern matching and regular expressions. + +=item L: General Perl Language Issues + +General Perl language issues that don't clearly fit into any of the +other sections. + +=item L: System Interaction + +Interprocess communication (IPC), control over the user-interface +(keyboard, screen and pointing devices). + +=item L: 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. + +=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 index 0000000000..2510a4b1f1 --- /dev/null +++ b/pod/perlfaq1.pod @@ -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 has been compiled to physical +machine code once, and can then be be run multiple times, whereas a +I