summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes179
-rw-r--r--INSTALL61
-rw-r--r--MANIFEST6
-rw-r--r--Porting/pumpkin.pod1122
-rw-r--r--doop.c3
-rw-r--r--dosish.h2
-rw-r--r--gv.h2
-rw-r--r--hints/solaris_2.sh1
-rw-r--r--hv.c20
-rw-r--r--lib/Env.pm7
-rw-r--r--lib/ExtUtils/MM_VMS.pm9
-rwxr-xr-xlib/ExtUtils/xsubpp23
-rw-r--r--lib/Test/Harness.pm2
-rw-r--r--lib/overload.pm6
-rw-r--r--op.c31
-rw-r--r--opcode.h6
-rwxr-xr-xopcode.pl8
-rw-r--r--os2/perl2cmd.pl2
-rw-r--r--patchlevel.h2
-rw-r--r--perl.c50
-rw-r--r--perlsdio.h6
-rw-r--r--pod/perl.pod38
-rw-r--r--pod/perldelta.pod102
-rw-r--r--pod/perldiag.pod8
-rw-r--r--pod/perlfunc.pod132
-rw-r--r--pod/perlguts.pod12
-rw-r--r--pod/perlmod.pod18
-rw-r--r--pod/perlop.pod23
-rw-r--r--pod/perlsec.pod25
-rw-r--r--pod/perltie.pod25
-rw-r--r--pod/perltoc.pod62
-rw-r--r--pod/perltrap.pod5
-rw-r--r--pod/perlvar.pod5
-rw-r--r--pp_sys.c10
-rwxr-xr-xt/harness4
-rwxr-xr-xt/op/closure.t27
-rwxr-xr-xt/op/magic.t11
-rw-r--r--unixish.h2
-rw-r--r--vms/descrip.mms17
-rw-r--r--vms/ext/filespec.t2
-rw-r--r--vms/genconfig.pl17
-rw-r--r--vms/vms.c59
-rw-r--r--vms/vmsish.h42
-rw-r--r--x2p/a2p.pod14
44 files changed, 1825 insertions, 383 deletions
diff --git a/Changes b/Changes
index a5eb30f7fe..2d9fb8e67f 100644
--- a/Changes
+++ b/Changes
@@ -9,6 +9,185 @@ releases.)
----------------
+Version 5.003_28
+----------------
+
+This release is beta candidate #6. If this isn't good enough to go beta,
+I'll eat a floppy disk. (Okay, it's a chocolate floppy, but still....)
+
+ CORE LANGUAGE CHANGES
+
+ Title: "Don't let C<sub foo;> undefine &foo"
+ From: Chip Salzenberg
+ Files: op.c
+
+ Title: "Make code, doc agree on $ENV{PATH} and `cmd`"
+ From: Chip Salzenberg
+ Files: pod/perlsec.pod pp_sys.c
+
+ Title: "Don't taint $x in C<$x = ($tainted =~ /(\w+)/)>"
+ From: Chip Salzenberg
+ Files: pp_ctl.c pp_hot.c
+
+ Title: "Turn off 'expression tainted' flag at end of runops()"
+ From: Chip Salzenberg
+ Files: run.c
+
+ Title: "When overloading, don't throw away nomethod's value"
+ From: Ilya Zakharevich <ilya@math.ohio-state.edu>
+ Files: gv.c
+
+ Title: "Optimize keys() and values() in void context"
+ From: Chip Salzenberg
+ Files: doop.c op.c
+
+ CORE PORTABILITY
+
+ Title: "New hints for Digital UNIX"
+ From: Jarkko Hietaniemi <jhi@iki.fi>
+ Files: hints/dec_osf.sh
+
+ Title: "No version of AIX has working setre[ug]id()"
+ From: neufeld@fast.pvi.org (Keith Neufeld)
+ Files: hints/aix.sh
+
+ Title: "VMS patches post _27"
+ From: Charles Bailey <bailey@HMIVAX.HUMGEN.UPENN.EDU>
+ Msg-ID: <01IFMEMPN1IU0057E2@hmivax.humgen.upenn.edu>
+ Date: Thu, 20 Feb 1997 01:58:46 -0500 (EST)
+ Files: MANIFEST dosish.h hv.c lib/ExtUtils/MM_VMS.pm
+ lib/ExtUtils/xsubpp perl.c perlsdio.h pod/perldelta.pod
+ pod/perlvar.pod t/op/closure.t unixish.h vms/Makefile
+ vms/descrip.mms vms/ext/filespec.t vms/genconfig.pl
+ vms/vms.c vms/vmsish.h
+
+ Title: "Re: OS/2 patch for _27"
+ From: Ilya Zakharevich <ilya@math.ohio-state.edu>
+ Msg-ID: <199702210024.TAA03174@monk.mps.ohio-state.edu>
+ Date: Thu, 20 Feb 1997 19:24:16 -0500 (EST)
+ Files: INSTALL README.os2 lib/Test/Harness.pm os2/Changes
+ os2/OS2/PrfDB/t/os2_prfdb.t os2/os2.c os2/os2ish.h
+ os2/perl2cmd.pl perl.c pod/perldelta.pod t/TEST t/harness
+ t/op/magic.t
+
+ OTHER CORE CHANGES
+
+ Title: "Fix a typo"
+ From: Chip Salzenberg
+ Files: pp_sys.c
+
+ Title: "Undo signal patch -- it broke die() in signal"
+ From: Chip Salzenberg
+ Files: mg.c
+
+ Title: "Fix perl_call_sv(..., G_NOARGS)"
+ From: Chip Salzenberg
+ Files: perl.c
+
+ Title: "Fix SIGSEGV when cloning sub with complex expression"
+ From: Chip Salzenberg
+ Files: op.c
+
+ Title: "Minor update to malloc.c"
+ From: Ilya Zakharevich <ilya@math.ohio-state.edu>
+ Msg-ID: <199702210244.VAA03676@monk.mps.ohio-state.edu>
+ Date: Thu, 20 Feb 1997 21:44:13 -0500 (EST)
+ Files: malloc.c
+
+ Title: "Fix the Tolkein quote"
+ From: Chip Salzenberg
+ Files: perly.y
+
+ BUILD PROCESS
+
+ (no changes)
+
+ LIBRARY AND EXTENSIONS
+
+ Title: "Debugger patch"
+ From: Ilya Zakharevich <ilya@math.ohio-state.edu>
+ Msg-ID: <199702210737.CAA03951@monk.mps.ohio-state.edu>
+ Date: Fri, 21 Feb 1997 02:37:59 -0500 (EST)
+ Files: lib/perl5db.pl
+
+ Title: "Avoid $` $& $' in libraries"
+ From: Ilya Zakharevich <ilya@math.ohio-state.edu>
+ Msg-ID: <199702210207.VAA03560@monk.mps.ohio-state.edu>
+ Date: Thu, 20 Feb 1997 21:07:30 -0500 (EST)
+ Files: lib/Getopt/Long.pm lib/Pod/Text.pm lib/diagnostics.pm
+ os2/OS2/REXX/REXX.pm
+
+ Title: "Remove redundant clearerr() from IO::Seekable"
+ From: Chip Salzenberg
+ Files: ext/IO/lib/IO/Handle.pm ext/IO/lib/IO/Seekable.pm
+
+ Title: "prototype error in File::stat"
+ From: Graham.Barr@tiuk.ti.com
+ Msg-ID: <199702180748.HAA14151@ultra-boy>
+ Date: Tue, 18 Feb 1997 07:48:40 GMT
+ Files: lib/File/stat.pm
+
+ TESTS
+
+ Title: "Include 'study' in regexp.t"
+ From: Chip Salzenberg
+ Files: t/op/regexp.t
+
+ Title: "Don't run locale test if -DNO_LOCALE"
+ From: Chip Salzenberg
+ Files: t/pragma/locale.t
+
+ Title: "Tweak tests to notice $dont_use_nlink"
+ From: Chip Salzenberg
+ Files: t/io/fs.t t/op/stat.t
+
+ Title: "Add test for grep() and wantarray"
+ From: Hugo van der Sanden <hv@iii.co.uk>
+ Msg-ID: <199702181105.LAA17895@tyree.iii.co.uk>
+ Date: Tue, 18 Feb 1997 11:05:59 +0000
+ Files: t/op/misc.t
+
+ UTILITIES
+
+ (no changes)
+
+ DOCUMENTATION
+
+ Title: "INSTALL updates since _26"
+ From: Andy Dougherty <doughera@fractal.phys.lafayette.edu>
+ Msg-ID: <Pine.SOL.3.95q.970218155815.2014F-100000@fractal.lafayette.e
+ Date: Tue, 18 Feb 1997 16:00:08 -0500 (EST)
+ Files: INSTALL
+
+ Title: "Document "$$0" change"
+ From: Chip Salzenberg
+ Files: pod/perldelta.pod
+
+ Title: "Don't recommend impossible //o for C<$x =~ $y>"
+ From: Chip Salzenberg
+ Files: pod/perlop.pod
+
+ Title: "Correct doc that claimed that <FH> was never false"
+ From: Chip Salzenberg
+ Files: pod/perldelta.pod pod/perlop.pod
+
+ Title: "Document C<$?> vs. $SIG{CHLD}"
+ From: Ulrich Pfeifer <pfeifer@charly.informatik.uni-dortmund.de>
+ Files: pod/perlvar.pod
+
+ Title: "Add pumpkin.pod"
+ From: Chip Salzenberg
+ Files: MANIFEST Porting/pumpkin.pod
+
+ Title: "Don't say "associat*ve arr*y""
+ From: Chip Salzenberg
+ Files: MANIFEST gv.h hv.c lib/Env.pm lib/overload.pm opcode.pl
+ pod/perl.pod pod/perldelta.pod pod/perldiag.pod
+ pod/perlfunc.pod pod/perlguts.pod pod/perlmod.pod
+ pod/perltie.pod pod/perltoc.pod pod/perltrap.pod x2p/a2p.pod
+
+
+----------------
Version 5.003_27
----------------
diff --git a/INSTALL b/INSTALL
index 5bd277d0db..6aa8760063 100644
--- a/INSTALL
+++ b/INSTALL
@@ -297,8 +297,8 @@ systems, B<man less> would end up calling up Perl's less.pm module man
page, rather than the B<less> program.
If you specify a prefix that contains the string "perl", then the
-directory structure is simplified. For example, if you Configure
-with -Dprefix=/opt/perl, then the defaults are
+directory structure is simplified. For example, if you Configure with
+-Dprefix=/opt/perl, then the defaults are
/opt/perl/lib/archname/5.004
/opt/perl/lib
@@ -338,7 +338,7 @@ However, sites that use software such as B<depot> to manage software
packages may also wish to install perl into a different directory and
use that management software to move perl to its final destination.
This section describes how to do this. Someday, Configure may support
-an option C<-Dinstallprefix=/foo> to simplify this.
+an option -Dinstallprefix=/foo to simplify this.
Suppose you want to install perl under the F</tmp/perl5> directory.
You can edit F<config.sh> and change all the install* variables to
@@ -552,11 +552,58 @@ version of perl. You can do this with by changing all the *archlib*
variables in config.sh, namely archlib, archlib_exp, and
installarchlib, to point to your new architecture-dependent library.
+=head2 Malloc Performance Flags
+
+If you are using Perl's malloc, you may define one or more of the
+following macros to change its behavior in potentially useful ways.
+
+=over 4
+
+=item -DEMERGENCY_SBRK
+
+If this macro is defined, running out of memory need not be a fatal
+error: a memory pool can allocated by assigning to the special
+variable C<$^M>. See L<"$^M">.
+
+=item -DPACK_MALLOC
+
+Perl memory allocation is by bucket with sizes close to powers of two.
+Because of these malloc overhead may be big, especially for data of
+size exactly a power of two. If C<PACK_MALLOC> is defined, perl uses
+a slightly different algorithm for small allocations (up to 64 bytes
+long), which makes it possible to have overhead down to 1 byte for
+allocations which are powers of two (and appear quite often).
+
+Expected memory savings (with 8-byte alignment in C<alignbytes>) is
+about 20% for typical Perl usage. Expected slowdown due to additional
+malloc overhead is in fractions of a percent (hard to measure, because
+of the effect of saved memory on speed).
+
+=item -DTWO_POT_OPTIMIZE
+
+Similarly to C<PACK_MALLOC>, this macro improves allocations of data
+with size close to a power of two; but this works for big allocations
+(starting with 16K by default). Such allocations are typical for big
+hashes and special-purpose scripts, especially image processing.
+
+On recent systems, the fact that perl requires 2M from system for 1M
+allocation will not affect speed of execution, since the tail of such
+a chunk is not going to be touched (and thus will not require real
+memory). However, it may result in a premature out-of-memory error.
+So if you will be manipulating very large blocks with sizes close to
+powers of two, it would be wise to define this macro.
+
+Expected saving of memory is 0-100% (100% in applications which
+require most memory in such 2**n chunks); expected slowdown is
+negligible.
+
+=back
+
=head2 Other Compiler Flags
For most users, all of the Configure defaults are fine. However,
you can change a number of factors in the way perl is built
-by adding appropriate -D directives to your ccflags variable in
+by adding appropriate B<-D> directives to your ccflags variable in
config.sh.
For example, you can replace the rand() and srand() functions in the
@@ -752,8 +799,8 @@ locale. See the discussion under L<make test> below about locales.
=item *
-If you get duplicates upon linking for malloc et al,
-add -DHIDEMYMALLOC to your ccflags variable in config.sh.
+If you get duplicates upon linking for malloc et al, add -DHIDEMYMALLOC
+or -DEMBEDMYMALLOC to your ccflags variable in config.sh.
=item varargs
@@ -929,7 +976,7 @@ Genix may need to use libc rather than libc_s, or #undef VARARGS.
NCR Tower 32 (OS 2.01.01) may need -W2,-Sl,2000 and #undef MKDIR.
-UTS may need one or more of B<-DCRIPPLED_CC>, B<-K> or B<-g>, and undef LSTAT.
+UTS may need one or more of -DCRIPPLED_CC, B<-K> or B<-g>, and undef LSTAT.
If you get syntax errors on '(', try -DCRIPPLED_CC.
diff --git a/MANIFEST b/MANIFEST
index 0ed128fe03..7a79d90cd8 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -14,6 +14,7 @@ INTERN.h Included before domestic .h files
MANIFEST This list of files
Makefile.SH A script that generates Makefile
Porting/Glossary Glossary of config.sh variables
+Porting/pumpkin.pod Guidelines and hints for Perl maintainers
README The Instructions
README.amiga Notes about AmigaOS port
README.os2 Notes about OS/2 port
@@ -646,7 +647,7 @@ t/op/cmp.t See if the various string and numeric compare work
t/op/cond.t See if conditional expressions work
t/op/delete.t See if delete works
t/op/do.t See if subroutines work
-t/op/each.t See if associative iterators work
+t/op/each.t See if hash iterators work
t/op/eval.t See if eval operator works
t/op/exec.t See if exec and system work
t/op/exp.t See if math functions work
@@ -721,7 +722,6 @@ utils/perlbug.PL A simple tool to submit a bug report
utils/perldoc.PL A simple tool to find & display perl's documentation
utils/pl2pm.PL A pl to pm translator
utils/splain.PL Stand-alone version of diagnostics.pm
-vms/Makefile VMS port
vms/config.vms default config.h for VMS
vms/descrip.mms MM[SK] description file for build
vms/ext/DCLsym/0README.txt ReadMe file for VMS::DCLsym
@@ -813,7 +813,7 @@ x2p/a2p.y A yacc grammer for awk
x2p/a2py.c Awk compiler, sort of
x2p/cflags.SH A script that emits C compilation flags per file
x2p/find2perl.PL A find to perl translator
-x2p/hash.c Associative arrays again
+x2p/hash.c Hashes again
x2p/hash.h Public declarations for the above
x2p/proto.h Dummy header
x2p/s2p.PL Sed to perl translator
diff --git a/Porting/pumpkin.pod b/Porting/pumpkin.pod
new file mode 100644
index 0000000000..3744548fc5
--- /dev/null
+++ b/Porting/pumpkin.pod
@@ -0,0 +1,1122 @@
+=head1 NAME
+
+Pumpkin - Notes on handling the Perl Patch Pumpkin
+
+=head1 SYNOPSIS
+
+There is no simple synopsis, yet.
+
+=head1 DESCRIPTION
+
+This document attempts to begin to describe some of the
+considerations involved in patching and maintaining perl.
+
+This document is still under construction, and still subject to
+significant changes. Still, I hope parts of it will be useful,
+so I'm releasing it even though it's not done.
+
+For the most part, it's a collection of anecdotal information that
+already assumes some familiarity with the Perl sources. I really need
+an introductory section that describes the organization of the sources
+and all the various auxiliary files that are part of the distribution.
+
+=head1 Where Do I Get Perl Sources and Related Material?
+
+The Comprehensive Perl Archive Network (or CPAN) is the place to go.
+There are many mirrors, but the easiest thing to use is probably
+http://www.perl.com/CPAN, which automatically points you to a
+mirror site "close" to you.
+
+=head2 Perl5-porters mailing list
+
+The mailing list perl5-porters@perl.org
+is the main group working with the development of perl. If you're
+interested in all the latest developments, you should definitely
+subscribe. The list is high volume, but generally has a
+fairly low noise level.
+
+Subscribe by sending the message (in the body of your letter)
+
+ subscribe perl5-porters
+
+to perl5-porters-request@perl.org .
+
+=head1 How are Perl Releases Numbered?
+
+Perl version numbers are floating point numbers, such as 5.004. The
+major version number is 5, the minor version is '0', and '03' is the
+patchlevel. The version number is available as the magic variable $],
+and can be used in comparisons, e.g.
+
+ print "You've got an old perl\n" if $] < 5.002;
+
+(Observations about the imprecision of floating point numbers for
+representing reality probably have more relevance than you might
+imagine :-)
+
+You can also require particular version (or later) with
+
+ use 5.002;
+
+=head2 Subversions
+
+In addition, there may be "developer" sub-versions available. These
+are not official releases. They may contain unstable experimental
+features, and are subject to rapid change. Such developer
+sub-versions are numbered with sub-version numbers. For example,
+version 5.004_04 is the 4'th developer version built on top of
+5.004. It might include the _01, _02, and _03 changes, but it
+also might not. Sub-versions are allowed to be subversive.
+
+These sub-versions can also be used as floating point numbers, so
+you can do things such as
+
+ print "You've got an unstable perl\n" if $] == 5.00403;
+
+You can also require particular version (or later) with
+
+ use 5.004_03; # the "_" is optional
+
+Sub-versions produced by the members of perl5-porters are usually
+available on CPAN in the F<src/5.0/unsupported> directory.
+
+=head2 Why such a complicated scheme?
+
+Two reasons, really. At least.
+
+First, we need some way to identify releases that are known to
+have new features that need testing and exploration. The
+subversion scheme does that nicely while fitting into the
+C<use 5.004;> mold.
+
+Second, since most of the folks who help maintain perl do so on a
+free-time voluntary basis, perl development does not proceed at a
+precise pace, though it always seems to be moving ahead quickly.
+We needed some way to pass around the "patch pumpkin" to allow
+different people chances to work on different aspects of the
+distribution without getting in each other's way. It wouldn't be
+constructive to have multiple people working on incompatible
+implementations of the same idea. Instead what was needed was
+some kind of "baton" or "token" to pass around so everyone knew
+whose turn was next.
+
+=head2 Why is it called the patch pumpkin?
+
+Chip Salzenberg gets credit for that, with a nod to his cow orker,
+David Croy. We had passed around various names (baton, token, hot
+potato) but none caught on. Then, Chip asked:
+
+[begin quote]
+
+ Who has the patch pumpkin?
+
+To explain: David Croy once told me once that at a previous job,
+there was one tape drive and multiple systems that used it for backups.
+But instead of some high-tech exclusion software, they used a low-tech
+method to prevent multiple simultaneous backups: a stuffed pumpkin.
+No one was allowed to make backups unless they had the "backup pumpkin".
+
+[end quote]
+
+The name has stuck.
+
+=head1 Philosophical Issues in Patching Perl
+
+There are no absolute rules, but there are some general guidelines I
+have tried to follow as I apply patches to the perl sources.
+(This section is still under construction.)
+
+=head2 Solve problems as generally as possible
+
+(I still have to think of a good example here.)
+
+=head2 Seek consensus on major changes
+
+If you are making big changes, don't do it in secret. Discuss the
+ideas in advance on perl5-porters.
+
+=head2 Keep the documentation up-to-date
+
+If your changes may affect how users use perl, then check to be sure
+that the documentation is in sync with your changes. Be sure to
+check all the files F<pod/*.pod> and also the F<INSTALL> document.
+
+Consider writing the appropriate documentation first and then
+implementing it to correspond to the documentation.
+
+=head2 Avoid machine-specific #ifdef's
+
+To the extent reasonable, try to avoid machine-specific #ifdef's in
+the sources. Instead, use feature-specific #ifdef's. The reason is
+that the machine-specific #ifdef's may not be valid across major
+releases of the operating system. Further, the feature-specific tests
+may help out folks on another platform who have the same problem.
+
+=head2 Allow for lots of testing
+
+We should never release a main version without testing it as a
+subversion first.
+
+=head2 Automate generatation of derivative files
+
+The F<embed.h>, F<keywords.h>, F<opcode.h>, and F<perltoc.pod> files
+are all automatically generated by perl scripts. In general, don't
+patch these directly; patch the data files instead.
+
+F<Configure> and F<config_h.SH> are also automatically generated by
+B<metaconfig>. In general, you should patch the metaconfig units
+instead of patching these files directly. However, minor changes to
+F<Configure> may be made in between major sync-ups with the metaconfig
+units, which tends to be complicated operations.
+
+=head1 How to Make a Distribution
+
+There really ought to be a 'make dist' target, but there isn't.
+The 'dist' suite of tools also contains a number of tools that I haven't
+learned how to use yet. Some of them may make this all a bit easier.
+
+Here are the steps I go through to prepare a patch & distribution.
+
+Lots of it could doubtless be automated but isn't.
+
+=head2 Announce your intentions
+
+First, you should volunteer out loud to take the patch pumpkin. It's
+generally counter-productive to have multiple people working in secret
+on the same thing.
+
+At the same time, announce what you plan to do with the patch pumpkin,
+to allow folks a chance to object or suggest alternatives, or do it for
+you. Naturally, the patch pumpkin holder ought to incorporate various
+bug fixes and documentation improvements that are posted while he or
+she has the pumpkin, but there might also be larger issues at stake.
+
+One of the precepts of the subversion idea is that we shouldn't give
+it to anyone unless we have some idea what you're going to do with
+it.
+
+=head2 refresh pod/perltoc.pod
+
+Presumably, you have done a full C<make> in your working source
+directory. Before you C<make spotless> (if you do), and if you have
+changed any documentation in any module or pod file, change to the
+F<pod> directory and run C<make toc>.
+
+=head2 update patchlevel.h
+
+Don't be shy about using the subversion number, even for a relatively
+modest patch. We've never even come close to using all 99 subversions,
+and it's better to have a distinctive number for your patch. If you
+need feedback on your patch, go ahead and issue it and promise to
+incorporate that feedback quickly (e.g. within 1 week) and send out a
+second patch.
+
+=head2 run metaconfig
+
+If you need to make changes to Configure or config_h.SH, it may be best to
+change the appropriate metaconfig units instead, and regenerate Configure.
+
+ metaconfig -m
+
+will regenerate Configure and config_h.SH. More information on
+obtaining and running metaconfig is in the F<U/README> file that comes
+with Perl's metaconfig units. Perl's metaconfig units should be
+available the same place you found this file. On CPAN, look under my
+directory F<id/ANDYD/> for a file such as F<5.003_07-02.U.tar.gz>.
+That file should be unpacked in your main perl source directory. It
+contains the files needed to run B<metaconfig> to reproduce Perl's
+Configure script.
+
+Alternatively, do consider if the F<*ish.h> files might be a better
+place for your changes.
+
+=head2 MANIFEST
+
+Make sure the MANIFEST is up-to-date. You can use dist's B<manicheck>
+program for this. You can also use
+
+ perl -MExtUtils::Manifest -e fullcheck
+
+to do half the job. This will make sure everything listed in MANIFEST
+is included in the distribution. dist's B<manicheck> command will
+also list extra files in the directory that are not listed in
+MANIFEST.
+
+The MANIFEST is normally sorted, with one exception. Perl includes
+both a F<Configure> script and a F<configure> script. The
+F<configure> script is a front-end to the main F<Configure>, but
+is there to aid folks who use autoconf-generated F<configure> files
+for other software. The problem is that F<Configure> and F<configure>
+are the same on case-insensitive file systems, so I deliberately put
+F<configure> first in the MANIFEST so that the extraction of
+F<Configure> will overwrite F<configure> and leave you with the
+correct script. (The F<configure> script must also have write
+permission for this to work, so it's the only file in the distribution
+I normally have with write permission.)
+
+If you are using metaconfig to regenerate Configure, then you should note
+that metaconfig actually uses MANIFEST.new, so you want to be sure
+MANIFEST.new is up-to-date too. I haven't found the MANIFEST/MANIFEST.new
+distinction particularly useful, but that's probably because I still haven't
+learned how to use the full suite of tools in the dist distribution.
+
+=head2 Check permissions
+
+All the tests in the t/ directory ought to be executable. The
+main makefile used to do a 'chmod t/*/*.t', but that resulted in
+a self-modifying distribution--something some users would strongly
+prefer to avoid. Probably, the F<t/TEST> script should check for this
+and do the chmod if needed, but it doesn't currently.
+
+In all, the following files should probably be executable:
+
+ Configure
+ configpm
+ configure
+ embed.pl
+ installperl
+ installman
+ keywords.pl
+ lib/splain
+ myconfig
+ opcode.pl
+ perly.fixer
+ t/TEST
+ t/*/*.t
+ *.SH
+ vms/ext/Stdio/test.pl
+ vms/ext/filespec.t
+ vms/fndvers.com
+ x2p/*.SH
+
+Other things ought to be readable, at least :-).
+
+Probably, the permissions for the files could be encoded in MANIFEST
+somehow, but I'm reluctant to change MANIFEST itself because that
+could break old scripts that use MANIFEST.
+
+I seem to recall that some SVR3 systems kept some sort of file that listed
+permissions for system files; something like that might be appropriate.
+
+=head2 Run Configure
+
+This will build a config.sh and config.h. You can skip this if you haven't
+changed Configure or config_h.SH at all.
+
+=head2 Update config_H
+
+The config_H file is provided to help those folks who can't run Configure.
+It is important to keep it up-to-date. If you have changed config_h.SH,
+those changes must be reflected in config_H as well. (The name config_H was
+chosen to distinguish the file from config.h even on case-insensitive file
+systems.) Simply edit the existing config_H file; keep the first few
+explanatory lines and then copy your new config.h below.
+
+It may also be necessary to update vms/config.vms and
+plan9/config.plan9, though you should be quite careful in doing so if
+you are not familiar with those systems. You might want to issue your
+patch with a promise to quickly issue a follow-up that handles those
+directories.
+
+=head2 make run_byacc
+
+If you have byacc-1.8.2 (available from CPAN), and if there have been
+changes to F<perly.y>, you can regenerate the F<perly.c> file. The
+run_byacc makefile target does this by running byacc and then applying
+some patches so that byacc dynamically allocates space, rather than
+having fixed limits. This patch is handled by the F<perly.fixer>
+script. Depending on the nature of the changes to F<perly.y>, you may
+or may not have to hand-edit the patch to apply correctly. If you do,
+you should include the edited patch in the new distribution. If you
+have byacc-1.9, the patch won't apply cleanly. Changes to the printf
+output statements mean the patch won't apply cleanly. Long ago I
+started to fix F<perly.fixer> to detect this, but I never completed the
+task.
+
+Some additional notes from Larry on this:
+
+Don't forget to regenerate perly.c.diff.
+
+ byacc perly.y
+ mv y.tab.c perly.c
+ patch perly.c <perly.c.diff
+ # manually apply any failed hunks
+ diff -c2 perly.c.orig perly.c >perly.c.diff
+
+One chunk of lines that often fails begins with
+
+ #line 29 "perly.y"
+
+and ends one line before
+
+ #define YYERRCODE 256
+
+This only happens when you add or remove a token type. I suppose this
+could be automated, but it doesn't happen very often nowadays.
+
+Larry
+
+=head2 make regen_headers
+
+The F<embed.h>, F<keywords.h>, and F<opcode.h> files are all automatically
+generated by perl scripts. Since the user isn't guaranteed to have a
+working perl, we can't require the user to generate them. Hence you have
+to, if you're making a distribution.
+
+I used to include rules like the following in the makefile:
+
+ # The following three header files are generated automatically
+ # The correct versions should be already supplied with the perl kit,
+ # in case you don't have perl or 'sh' available.
+ # The - is to ignore error return codes in case you have the source
+ # installed read-only or you don't have perl yet.
+ keywords.h: keywords.pl
+ @echo "Don't worry if this fails."
+ - perl keywords.pl
+
+
+However, I got lots of mail consisting of people worrying because the
+command failed. I eventually decided that I would save myself time
+and effort by manually running C<make regen_headers> myself rather
+than answering all the questions and complaints about the failing
+command.
+
+=head2 global.sym and interp.sym
+
+Make sure these files are up-to-date. Read the comments in these
+files and in perl_exp.SH to see what to do.
+
+=head2 Binary compatibility
+
+If you do change F<global.sym> or F<interp.sym>, think carefully about
+what you are doing. To the extent reasonable, we'd like to maintain
+souce and binary compatibility with older releases of perl. That way,
+extensions built under one version of perl will continue to work with
+new versions of perl.
+
+Of course, some incompatible changes may well be necessary. I'm just
+suggesting that we not make any such changes without thinking carefully
+about them first. If possible, we should provide
+backwards-compatibility stubs. There's a lot of XS code out there.
+Let's not force people to keep changing it.
+
+=head2 Changes
+
+Be sure to update the F<Changes> file. Try to include both an overall
+summary as well as detailed descriptions of the changes. Your
+audience will include bother developers and users, so describe
+user-visible changes (if any) in terms they will understand, not in
+code like "initialize foo variable in bar function".
+
+There are differing opinions on whether the detailed descriptions
+ought to go in the Changes file or whether they ought to be available
+separately in the patch file (or both). There is no disagreement that
+detailed descriptions ought to be easily available somewhere.
+
+=head2 OS/2-specific updates
+
+In the os2 directory is F<diff.configure>, a set of OS/2-specific
+diffs against B<Configure>. If you make changes to Configure, you may
+want to consider regenerating this diff file to save trouble for the
+OS/2 maintainer.
+
+=head2 VMS-specific updates
+
+If you have changed F<perly.y>, then you may want to update
+F<vms/perly_{h,c}.vms> by running C<perl vms/vms_yfix.pl>.
+
+The Perl version number appears in several places under F<vms>.
+It is courteous to update these versions. For example, if you are
+making 5.004_42, replace "5.00441" with "5.00442".
+
+=head2 Making the new distribution
+
+Suppose, for example, that you want to make version 5.004_08. Then you can
+do something like the following
+
+ mkdir ../perl5.004_08
+ awk '{print $1}' MANIFEST | cpio -pdm ../perl5.004_08
+ cd ../
+ tar cf perl5.004_08.tar perl5.004_08
+ gzip --best perl5.004_08.tar
+
+=head2 Making a new patch
+
+I find the F<makepatch> utility quite handy for making patches.
+You can obtain it from any CPAN archive under
+http://www.perl.com/CPAN/authors/Johan_Vromans/. The only
+difference between my version and the standard one is that I have mine
+do a
+
+ # Print a reassuring "End of Patch" note so people won't
+ # wonder if their mailer truncated patches.
+ print "\n\nEnd of Patch.\n";
+
+at the end. That's because I used to get questions from people asking if
+their mail was truncated.
+
+Here's how I generate a new patch. I'll use the hypothetical
+5.004_07 to 5.004_08 patch as an example.
+
+ # unpack perl5.004_07/
+ gzip -d -c perl5.004_07.tar.gz | tar -xof -
+ # unpack perl5.004_08/
+ gzip -d -c perl5.004_08.tar.gz | tar -xof -
+ makepatch perl5.004_07 perl5.004_08 > perl5.004_08.pat
+
+Makepatch will automatically generate appropriate B<rm> commands to remove
+deleted files. Unfortunately, it will not correctly set permissions
+for newly created files, so you may have to do so manually. For example,
+patch 5.003_04 created a new test F<t/op/gv.t> which needs to be executable,
+so at the top of the patch, I inserted the following lines:
+
+ # Make a new test
+ touch t/op/gv.t
+ chmod +x t/opt/gv.t
+
+Now, of course, my patch is now wrong because makepatch didn't know I
+was going to do that command, and it patched against /dev/null.
+
+So, what I do is sort out all such shell commands that need to be in the
+patch (including possible mv-ing of files, if needed) and put that in the
+shell commands at the top of the patch. Next, I delete all the patch parts
+of perl5.004_08.pat, leaving just the shell commands. Then, I do the
+following:
+
+ cd perl5.003_07
+ sh ../perl5.003_08.pat
+ cd ..
+ makepatch perl5.003_07 perl5.003_08 >> perl5.003_08.pat
+
+(Note the append to preserve my shell commands.)
+Now, my patch will line up with what the end users are going to do.
+
+=head2 Testing your patch
+
+It seems obvious, but be sure to test your patch. That is, verify that
+it produces exactly the same thing as your full distribution.
+
+ rm -rf perl5.003_07
+ gzip -d -c perl5.003_07.tar.gz | tar -xf -
+ cd perl5.003_07
+ sh ../perl5.003_08.pat
+ patch -p1 -N < ../perl5.003_08.pat
+ cd ..
+ gdiff -r perl5.003_07 perl5.003_08
+
+where B<gdiff> is GNU diff. Other diff's may also do recursive checking.
+
+=head2 More testing
+
+Again, it's obvious, but you should test your new version as widely as you
+can. You can be sure you'll hear about it quickly if your version doesn't
+work on both ANSI and pre-ANSI compilers, and on common systems such as
+SunOS 4.1.[34], Solaris, and Linux.
+
+If your changes include conditional code, try to test the different
+branches as thoroughly as you can. For example, if your system
+supports dynamic loading, you can also test static loading with
+
+ sh Configure -Uusedl
+
+You can also hand-tweak your config.h to try out different #ifdef
+branches.
+
+=head1 Common Gotcha's
+
+=over 4
+
+=item #elif
+
+The '#elif' preprocessor directive is not understood on all systems.
+Specifically, I know that Pyramids don't understand it. Thus instead of the
+simple
+
+ #if defined(I_FOO)
+ # include <foo.h>
+ #elif defined(I_BAR)
+ # include <bar.h>
+ #else
+ # include <fubar.h>
+ #endif
+
+You have to do the more Byzantine
+
+ #if defined(I_FOO)
+ # include <foo.h>
+ #else
+ # if defined(I_BAR)
+ # include <bar.h>
+ # else
+ # include <fubar.h>
+ # endif
+ #endif
+
+Incidentally, whitespace between the leading '#' and the preprocessor
+command is not guaranteed, but is very portable and you may use it freely.
+I think it makes things a bit more readable, especially once things get
+rather deeply nested. I also think that things should almost never get
+too deeply nested, so it ought to be a moot point :-)
+
+=item Probably Prefer POSIX
+
+It's often the case that you'll need to choose whether to do
+something the BSD-ish way or the POSIX-ish way. It's usually not
+a big problem when the two systems use different names for similar
+functions, such as memcmp() and bcmp(). The perl.h header file
+handles these by appropriate #defines, selecting the POSIX mem*()
+functions if available, but falling back on the b*() functions, if
+need be.
+
+More serious is the case where some brilliant person decided to
+use the same function name but give it a different meaning or
+calling sequence :-). getpgrp() and setpgrp() come to mind.
+These are a real problem on systems that aim for conformance to
+one standard (e.g. POSIX), but still try to support the other way
+of doing things (e.g. BSD). My general advice (still not really
+implemented in the source) is to do something like the following.
+Suppose there are two alternative versions, fooPOSIX() and
+fooBSD().
+
+ #ifdef HAS_FOOPOSIX
+ /* use fooPOSIX(); */
+ #else
+ # ifdef HAS_FOOBSD
+ /* try to emulate fooPOSIX() with fooBSD();
+ perhaps with the following: */
+ # define fooPOSIX fooBSD
+ # else
+ # /* Uh, oh. We have to supply our own. */
+ # define fooPOSIX Perl_fooPOSIX
+ # endif
+ #endif
+
+=item Think positively
+
+If you need to add an #ifdef test, it is usually easier to follow if you
+think positively, e.g.
+
+ #ifdef HAS_NEATO_FEATURE
+ /* use neato feature */
+ #else
+ /* use some fallback mechanism */
+ #endif
+
+rather than the more impenetrable
+
+ #ifndef MISSING_NEATO_FEATURE
+ /* Not missing it, so we must have it, so use it */
+ #else
+ /* Are missing it, so fall back on something else. */
+ #endif
+
+Of course for this toy example, there's not much difference. But when
+the #ifdef's start spanning a couple of screen fulls, and the #else's
+are marked something like
+
+ #else /* !MISSING_NEATO_FEATURE */
+
+I find it easy to get lost.
+
+=item Providing Missing Functions -- Problem
+
+Not all systems have all the neat functions you might want or need, so
+you might decide to be helpful and provide an emulation. This is
+sound in theory and very kind of you, but please be careful about what
+you name the function. Let me use the C<pause()> function as an
+illustration.
+
+Perl5.003 has the following in F<perl.h>
+
+ #ifndef HAS_PAUSE
+ #define pause() sleep((32767<<16)+32767)
+ #endif
+
+Configure sets HAS_PAUSE if the system has the pause() function, so
+this #define only kicks in if the pause() function is missing.
+Nice idea, right?
+
+Unfortunately, some systems apparently have a prototype for pause()
+in F<unistd.h>, but don't actually have the function in the library.
+(Or maybe they do have it in a library we're not using.)
+
+Thus, the compiler sees something like
+
+ extern int pause(void);
+ /* . . . */
+ #define pause() sleep((32767<<16)+32767)
+
+and dies with an error message. (Some compilers don't mind this;
+others apparently do.)
+
+To work around this, 5.003_03 and later have the following in perl.h:
+
+ /* 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 compiler. Sigh.
+ */
+ #ifdef HAS_PAUSE
+ # define Pause pause
+ #else
+ # define Pause() sleep((32767<<16)+32767)
+ #endif
+
+This works.
+
+The curious reader may wonder why I didn't do the following in
+F<util.c> instead:
+
+ #ifndef HAS_PAUSE
+ void pause()
+ {
+ sleep((32767<<16)+32767);
+ }
+ #endif
+
+That is, since the function is missing, just provide it.
+Then things would probably be been alright, it would seem.
+
+Well, almost. It could be made to work. The problem arises from the
+conflicting needs of dynamic loading and namespace protection.
+
+For dynamic loading to work on AIX (and VMS) we need to provide a list
+of symbols to be exported. This is done by the script F<perl_exp.SH>,
+which reads F<global.sym> and F<interp.sym>. Thus, the C<pause>
+symbol would have to be added to F<global.sym> So far, so good.
+
+On the other hand, one of the goals of Perl5 is to make it easy to
+either extend or embed perl and link it with other libraries. This
+means we have to be careful to keep the visible namespace "clean".
+That is, we don't want perl's global variables to conflict with
+those in the other application library. Although this work is still
+in progress, the way it is currently done is via the F<embed.h> file.
+This file is built from the F<global.sym> and F<interp.sym> files,
+since those files already list the globally visible symbols. If we
+had added C<pause> to global.sym, then F<embed.h> would contain the
+line
+
+ #define pause Perl_pause
+
+and calls to C<pause> in the perl sources would now point to
+C<Perl_pause>. Now, when B<ld> is run to build the F<perl> executable,
+it will go looking for C<perl_pause>, which probably won't exist in any
+of the standard libraries. Thus the build of perl will fail.
+
+Those systems where C<HAS_PAUSE> is not defined would be ok, however,
+since they would get a C<Perl_pause> function in util.c. The rest of
+the world would be in trouble.
+
+And yes, this scenario has happened. On SCO, the function C<chsize>
+is available. (I think it's in F<-lx>, the Xenix compatibility
+library.) Since the perl4 days (and possibly before), Perl has
+included a C<chsize> function that gets called something akin to
+
+ #ifndef HAS_CHSIZE
+ I32 chsize(fd, length)
+ /* . . . */
+ #endif
+
+When 5.003 added
+
+ #define chsize Perl_chsize
+
+to F<embed.h>, the compile started failing on SCO systems.
+
+The "fix" is to give the function a different name. The one
+implemented in 5.003_05 isn't optimal, but here's what was done:
+
+ #ifdef HAS_CHSIZE
+ # ifdef my_chsize /* Probably #defined to Perl_my_chsize in embed.h */
+ # undef my_chsize
+ # endif
+ # define my_chsize chsize
+ #endif
+
+My explanatory comment in patch 5.003_05 said:
+
+ Undef and then re-define my_chsize from Perl_my_chsize to
+ just plain chsize if this system HAS_CHSIZE. This probably only
+ applies to SCO. This shows the perils of having internal
+ functions with the same name as external library functions :-).
+
+Now, we can safely put C<my_chsize> in F<global.sym>, export it, and
+hide it with F<embed.h>.
+
+To be consistent with what I did for C<pause>, I probably should have
+called the new function C<Chsize>, rather than C<my_chsize>.
+However, the perl sources are quite inconsistent on this (Consider
+New, Mymalloc, and Myremalloc, to name just a few.)
+
+There is a problem with this fix, however, in that C<Perl_chsize>
+was available as a F<libperl.a> library function in 5.003, but it
+isn't available any more (as of 5.003_07). This means that we've
+broken binary compatibility. This is not good.
+
+=item Providing missing functions -- some ideas
+
+We currently don't have a standard way of handling such missing
+function names. Right now, I'm effectively thinking aloud about a
+solution. Some day, I'll try to formally propose a solution.
+
+Part of the problem is that we want to have some functions listed as
+exported but not have their names mangled by embed.h or possibly
+conflict with names in standard system headers. We actually already
+have such a list at the end of F<perl_exp.SH> (though that list is
+out-of-date):
+
+ # extra globals not included above.
+ cat <<END >> perl.exp
+ perl_init_ext
+ perl_init_fold
+ perl_init_i18nl14n
+ perl_alloc
+ perl_construct
+ perl_destruct
+ perl_free
+ perl_parse
+ perl_run
+ perl_get_sv
+ perl_get_av
+ perl_get_hv
+ perl_get_cv
+ perl_call_argv
+ perl_call_pv
+ perl_call_method
+ perl_call_sv
+ perl_requirepv
+ safecalloc
+ safemalloc
+ saferealloc
+ safefree
+
+This still needs much thought, but I'm inclined to think that one
+possible solution is to prefix all such functions with C<perl_> in the
+source and list them along with the other C<perl_*> functions in
+F<perl_exp.SH>.
+
+Thus, for C<chsize>, we'd do something like the following:
+
+ /* in perl.h */
+ #ifdef HAS_CHSIZE
+ # define perl_chsize chsize
+ #endif
+
+then in some file (e.g. F<util.c> or F<doio.c>) do
+
+ #ifndef HAS_CHSIZE
+ I32 perl_chsize(fd, length)
+ /* implement the function here . . . */
+ #endif
+
+Alternatively, we could just always use C<chsize> everywhere and move
+C<chsize> from F<global.sym> to the end of F<perl_exp.SH>. That would
+probably be fine as long as our C<chsize> function agreed with all the
+C<chsize> function prototypes in the various systems we'll be using.
+As long as the prototypes in actual use don't vary that much, this is
+probably a good alternative. (As a counter-example, note how Configure
+and perl have to go through hoops to find and use get Malloc_t and
+Free_t for C<malloc> and C<free>.)
+
+At the moment, this latter option is what I tend to prefer.
+
+=item All the world's a VAX
+
+Sorry, showing my age:-). Still, all the world is not BSD 4.[34],
+SVR4, or POSIX. Be aware that SVR3-derived systems are still quite
+common (do you have any idea how many systems run SCO?) If you don't
+have a bunch of v7 manuals handy, the metaconfig units (by default
+installed in F</usr/local/lib/dist/U>) are a good resource to look at
+for portability.
+
+=back
+
+=head1 Miscellaneous Topics
+
+=head2 Autoconf
+
+Why does perl use a metaconfig-generated Configure script instead of an
+autoconf-generated configure script?
+
+Metaconfig and autoconf are two tools with very similar purposes.
+Metaconfig is actually the older of the two, and was originally written
+by Larry Wall, while autoconf is probably now used in a wider variety of
+packages. The autoconf info file discusses the history of autoconf and
+how it came to be. The curious reader is referred there for further
+information.
+
+Overall, both tools are quite good, I think, and the choice of which one
+to use could be argued either way. In March, 1994, when I was just
+starting to work on Configure support for Perl5, I considered both
+autoconf and metaconfig, and eventually decided to use metaconfig for the
+following reasons:
+
+=over 4
+
+=item Compatibility with Perl4
+
+Perl4 used metaconfig, so many of the #ifdef's were already set up for
+metaconfig. Of course metaconfig had evolved some since Perl4's days,
+but not so much that it posed any serious problems.
+
+=item Metaconfig worked for me
+
+My system at the time was Interactive 2.2, a SVR3.2/386 derivative that
+also had some POSIX support. Metaconfig-generated Configure scripts
+worked fine for me on that system. On the other hand, autoconf-generated
+scripts usually didn't. (They did come quite close, though, in some
+cases.) At the time, I actually fetched a large number of GNU packages
+and checked. Not a single one configured and compiled correctly
+out-of-the-box with the system's cc compiler.
+
+=item Configure can be interactive
+
+With both autoconf and metaconfig, if the script works, everything is
+fine. However, one of my main problems with autoconf-generated scripts
+was that if it guessed wrong about something, it could be B<very> hard to
+go back and fix it. For example, autoconf always insisted on passing the
+-Xp flag to cc (to turn on POSIX behavior), even when that wasn't what I
+wanted or needed for that package. There was no way short of editing the
+configure script to turn this off. You couldn't just edit the resulting
+Makefile at the end because the -Xp flag influenced a number of other
+configure tests.
+
+Metaconfig's Configure scripts, on the other hand, can be interactive.
+Thus if Configure is guessing things incorrectly, you can go back and fix
+them. This isn't as important now as it was when we were actively
+developing Configure support for new features such as dynamic loading,
+but it's still useful occasionally.
+
+=item GPL
+
+At the time, autoconf-generated scripts were covered under the GNU Public
+License, and hence weren't suitable for inclusion with Perl, which has a
+different licensing policy. (Autoconf's licensing has since changed.)
+
+=item Modularity
+
+Metaconfig builds up Configure from a collection of discrete pieces
+called "units". You can override the standard behavior by supplying your
+own unit. With autoconf, you have to patch the standard files instead.
+I find the metaconfig "unit" method easier to work with. Others
+may find metaconfig's units clumsy to work with.
+
+=back
+
+=head2 @INC search order
+
+By default, the list of perl library directories in @INC is the
+following:
+
+ $archlib
+ $privlib
+ $sitearch
+ $sitelib
+
+Specifically, on my Solaris/x86 system, I run
+B<sh Configure -Dprefix=/opt/perl> and I have the following
+directories:
+
+ /opt/perl/lib/i86pc-solaris/5.00307
+ /opt/perl/lib
+ /opt/perl/lib/site_perl/i86pc-solaris
+ /opt/perl/lib/site_perl
+
+That is, perl's directories come first, followed by the site-specific
+directories.
+
+The site libraries come second to support the usage of extensions
+across perl versions. Read the relevant section in F<INSTALL> for
+more information. If we ever make $sitearch version-specific, this
+topic could be revisited.
+
+=head2 Why isn't there a directory to override Perl's library?
+
+Mainly because no one's gotten around to making one. Note that
+"making one" involves changing perl.c, Configure, config_h.SH (and
+associated files, see above), and I<documenting> it all in the
+INSTALL file.
+
+Apparently, most folks who want to override one of the standard library
+files simply do it by overwriting the standard library files.
+
+=head2 APPLLIB
+
+In the perl.c sources, you'll find an undocumented APPLLIB_EXP
+variable, sort of like PRIVLIB_EXP and ARCHLIB_EXP (which are
+documented in config_h.SH). Here's what APPLLIB_EXP is for, from
+a mail message from Larry:
+
+ The main intent of APPLLIB_EXP is for folks who want to send out a
+ version of Perl embedded in their product. They would set the symbol
+ to be the name of the library containing the files needed to run or to
+ support their particular application. This works at the "override"
+ level to make sure they get their own versions of any library code that
+ they absolutely must have configuration control over.
+
+ As such, I don't see any conflict with a sysadmin using it for a
+ override-ish sort of thing, when installing a generic Perl. It should
+ probably have been named something to do with overriding though. Since
+ it's undocumented we could still change it... :-)
+
+Given that it's already there, you can use it to override
+distribution modules. If you do
+
+ sh Configure -Dccflags='-DAPPLLIB_EXP=/my/override'
+
+then perl.c will put /my/override ahead of ARCHLIB and PRIVLIB.
+
+=head1 Upload Your Work to CPAN
+
+You can upload your work to CPAN if you have a CPAN id. Check out
+http://www.perl.com/CPAN/modules/04pause.html for information on
+_PAUSE_, the Perl Author's Upload Server.
+
+I typically upload both the patch file, e.g. F<perl5.004_08.pat.gz>
+and the full tar file, e.g. F<perl5.004_08.tar.gz>.
+
+If you want your patch to appear in the F<src/5.0/unsupported>
+directory on CPAN, send e-mail to the CPAN master librarian. (Check
+out http://www.perl.com/CPAN/CPAN.html).
+
+=head1 Help Save the World
+
+You should definitely announce your patch on the perl5-porters list.
+You should also consider announcing your patch on
+comp.lang.perl.announce, though you should make it quite clear that a
+subversion is not a production release, and be prepared to deal with
+people who will not read your disclaimer.
+
+=head1 Todo
+
+Here, in no particular order, are some Configure and build-related
+items that merit consideration. This list isn't exhaustive, it's just
+what I came up with off the top of my head.
+
+=head2 Good ideas waiting for round tuits
+
+=over 4
+
+=item installprefix
+
+I think we ought to support
+
+ Configure -Dinstallprefix=/blah/blah
+
+Currently, we support B<-Dprefix=/blah/blah>, but the changing the install
+location has to be handled by something like the F<config.over> trick
+described in F<INSTALL>. AFS users also are treated specially.
+We should probably duplicate the metaconfig prefix stuff for an
+install prefix.
+
+=item Configure -Dsrcdir=/blah/blah
+
+We should be able to emulate B<configure --srcdir>. Tom Tromey
+tromey@creche.cygnus.com has submitted some patches to
+the dist-users mailing list along these lines. Eventually, they ought
+to get folded back into the main distribution.
+
+=item Hint file fixes
+
+Various hint files work around Configure problems. We ought to fix
+Configure so that most of them aren't needed.
+
+=item Hint file information
+
+Some of the hint file information (particularly dynamic loading stuff)
+ought to be fed back into the main metaconfig distribution.
+
+=back
+
+=head2 Probably good ideas waiting for round tuits
+
+=over 4
+
+=item GNU configure --options
+
+I've received sensible suggestions for --exec_prefix and other
+GNU configure --options. It's not always obvious exactly what is
+intended, but this merits investigation.
+
+=item make clean
+
+Currently, B<make clean> isn't all that useful, though
+B<make realclean> and B<make distclean> are. This needs a bit of
+thought and documentation before it gets cleaned up.
+
+=item Try gcc if cc fails
+
+Currently, we just give up.
+
+=item bypassing safe*alloc wrappers
+
+On some systems, it may be safe to call the system malloc directly
+without going through the util.c safe* layers. (Such systems would
+accept free(0), for example.) This might be a time-saver for systems
+that already have a good malloc. (Recent Linux libc's apparently have
+a nice malloc that is well-tuned for the system.)
+
+=back
+
+=head2 Vague possibilities
+
+=over 4
+
+=item Win95, WinNT, and Win32 support
+
+We need to get something into the distribution for 32-bit Windows.
+I'm tired of all the private e-mail questions I get, and I'm saddened
+that so many folks keep trying to reinvent the same wheel.
+
+=item MacPerl
+
+Get some of the Macintosh stuff folded back into the main
+distribution.
+
+=item gconvert replacement
+
+Maybe include a replacement function that doesn't lose data in rare
+cases of coercion between string and numerical values.
+
+=item long long
+
+Can we support C<long long> on systems where C<long long> is larger
+than what we've been using for C<IV>? What if you can't C<sprintf>
+a C<long long>?
+
+=item Improve makedepend
+
+The current makedepend process is clunky and annoyingly slow, but it
+works for most folks. Alas, it assumes that there is a filename
+$firstmakefile that the B<make> command will try to use before it uses
+F<Makefile>. Such may not be the case for all B<make> commands,
+particularly those on non-Unix systems.
+
+Probably some variant of the BSD F<.depend> file will be useful.
+We ought to check how other packages do this, if they do it at all.
+We could probably pre-generate the dependencies (with the exception of
+malloc.o, which could probably be determined at F<Makefile.SH>
+extraction time.
+
+=item GNU Makefile standard targets
+
+GNU software generally has standardized Makefile targets. Unless we
+have good reason to do otherwise, I see no reason not to support them.
+
+=item File locking
+
+Somehow, straighten out, document, and implement lockf(), flock(),
+and/or fcntl() file locking. It's a mess.
+
+=back
+
+=head1 AUTHOR
+
+Andy Dougherty <doughera@lafcol.lafayette.edu>.
+
+Additions by Chip Salzenberg <chip@atlantic.net>.
+
+All opinions expressed herein are those of the authorZ<>(s).
+
+=head1 LAST MODIFIED
+
+$Id: pumpkin.pod,v 1.8 1997/02/18 18:19:20 chip Released $
diff --git a/doop.c b/doop.c
index f16ec6471f..f1392ff9e5 100644
--- a/doop.c
+++ b/doop.c
@@ -667,6 +667,9 @@ dARGS
(void)hv_iterinit(hv); /* always reset iterator regardless */
+ if (op->op_private & OPpLEAVE_VOID)
+ RETURN;
+
if (GIMME != G_ARRAY) {
I32 i;
dTARGET;
diff --git a/dosish.h b/dosish.h
index 58296a4224..58fdb28aac 100644
--- a/dosish.h
+++ b/dosish.h
@@ -78,5 +78,3 @@ void Perl_DJGPP_init();
#define Stat(fname,bufptr) stat((fname),(bufptr))
#define Fstat(fd,bufptr) fstat((fd),(bufptr))
#define Fflush(fp) fflush(fp)
-
-#define my_getenv(var) getenv(var)
diff --git a/gv.h b/gv.h
index 2def7c49a4..8a8ac656e9 100644
--- a/gv.h
+++ b/gv.h
@@ -13,7 +13,7 @@ struct gp {
struct io * gp_io; /* filehandle value */
CV * gp_form; /* format value */
AV * gp_av; /* array value */
- HV * gp_hv; /* associative array value */
+ HV * gp_hv; /* hash value */
GV * gp_egv; /* effective gv, if *glob */
CV * gp_cv; /* subroutine value */
U32 gp_cvgen; /* generational validity of cached gv_cv */
diff --git a/hints/solaris_2.sh b/hints/solaris_2.sh
index d563e53d7b..255811f2a6 100644
--- a/hints/solaris_2.sh
+++ b/hints/solaris_2.sh
@@ -142,6 +142,7 @@ case "`${cc:-cc} -v 2>&1`" in
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
GCC_EXEC_PREFIX or by including -B/usr/ccs/bin/ in your cc command.
+(Note that the trailing "/" is required.)
END
;;
diff --git a/hv.c b/hv.c
index 71009c9e20..1ae7ad952d 100644
--- a/hv.c
+++ b/hv.c
@@ -135,7 +135,7 @@ I32 lval;
if (HvNAME(hv) && strEQ(HvNAME(hv),ENV_HV_NAME)) {
char *gotenv;
- gotenv = my_getenv(key);
+ gotenv = ENV_getenv(key);
if (gotenv != NULL) {
sv = newSVpv(gotenv,strlen(gotenv));
return hv_store(hv,key,klen,sv,hash);
@@ -215,7 +215,7 @@ register U32 hash;
if (HvNAME(hv) && strEQ(HvNAME(hv),ENV_HV_NAME)) {
char *gotenv;
- gotenv = my_getenv(key);
+ gotenv = ENV_getenv(key);
if (gotenv != NULL) {
sv = newSVpv(gotenv,strlen(gotenv));
return hv_store_ent(hv,keysv,sv,hash);
@@ -854,7 +854,7 @@ HV *hv;
HvNAME(hv) = 0;
}
xhv->xhv_array = 0;
- xhv->xhv_max = 7; /* it's a normal associative array */
+ xhv->xhv_max = 7; /* it's a normal hash */
xhv->xhv_fill = 0;
xhv->xhv_keys = 0;
@@ -866,10 +866,16 @@ I32
hv_iterinit(hv)
HV *hv;
{
- register XPVHV* xhv = (XPVHV*)SvANY(hv);
- HE *entry = xhv->xhv_eiter;
+ register XPVHV* xhv;
+ HE *entry;
+
+ if (!hv)
+ croak("Bad hash");
+ xhv = (XPVHV*)SvANY(hv);
+ entry = xhv->xhv_eiter;
#ifdef DYNAMIC_ENV_FETCH /* set up %ENV for iteration */
- if (HvNAME(hv) && strEQ(HvNAME(hv),ENV_HV_NAME)) prime_env_iter();
+ if (HvNAME(hv) && strEQ(HvNAME(hv), ENV_HV_NAME))
+ prime_env_iter();
#endif
if (entry && HvLAZYDEL(hv)) { /* was deleted earlier? */
HvLAZYDEL_off(hv);
@@ -890,7 +896,7 @@ HV *hv;
MAGIC* mg;
if (!hv)
- croak("Bad associative array");
+ croak("Bad hash");
xhv = (XPVHV*)SvANY(hv);
oldentry = entry = xhv->xhv_eiter;
diff --git a/lib/Env.pm b/lib/Env.pm
index 1f06bebf24..f2fe4af422 100644
--- a/lib/Env.pm
+++ b/lib/Env.pm
@@ -11,10 +11,9 @@ Env - perl module that imports environment variables
=head1 DESCRIPTION
-Perl maintains environment variables in a pseudo-associative-array
-named %ENV. For when this access method is inconvenient, the Perl
-module C<Env> allows environment variables to be treated as simple
-variables.
+Perl maintains environment variables in a pseudo-hash named %ENV. For
+when this access method is inconvenient, the Perl module C<Env> allows
+environment variables to be treated as simple variables.
The Env::import() function ties environment variables with suitable
names to global Perl variables with the same names. By default it
diff --git a/lib/ExtUtils/MM_VMS.pm b/lib/ExtUtils/MM_VMS.pm
index 12350aaab5..e719946f92 100644
--- a/lib/ExtUtils/MM_VMS.pm
+++ b/lib/ExtUtils/MM_VMS.pm
@@ -1978,7 +1978,14 @@ $(PERL_ARCHLIB)Config.pm : $(PERL_VMS)config.vms $(PERL_VMS)genconfig.pl
$(NOECHO) Write Sys$Error "$(PERL_ARCHLIB)Config.pm may be out of date with config.vms or genconfig.pl"
olddef = F$Environment("Default")
Set Default $(PERL_SRC)
- $(MMS)],$mmsquals,q[ $(MMS$TARGET)
+ $(MMS)],$mmsquals,);
+ if ($self->{PERL_ARCHLIB} =~ m|\[-| && $self->{PERL_SRC} =~ m|(\[-+)|) {
+ my($prefix,$target) = ($1,$self->fixpath('$(PERL_ARCHLIB)Config.pm'));
+ $target =~ s/\Q$prefix/[/;
+ push(@m," $target");
+ }
+ else { push(@m,' $(MMS$TARGET)'); }
+ push(@m,q[
Set Default 'olddef'
]);
}
diff --git a/lib/ExtUtils/xsubpp b/lib/ExtUtils/xsubpp
index 09b8e7dcd3..0cc8d785a7 100755
--- a/lib/ExtUtils/xsubpp
+++ b/lib/ExtUtils/xsubpp
@@ -79,11 +79,20 @@ require 5.002;
use Cwd;
use vars '$cplusplus';
+sub Q ;
+
# Global Constants
-$XSUBPP_version = "1.9401";
-$Is_VMS = $^O eq 'VMS';
-sub Q ;
+$XSUBPP_version = "1.9402";
+
+my ($Is_VMS, $SymSet);
+if ($^O eq 'VMS') {
+ $Is_VMS = 1;
+ # Establish set of global symbols with max length 28, since xsubpp
+ # will later add the 'XS_' prefix.
+ require ExtUtils::XSSymSet;
+ $SymSet = new ExtUtils::XSSymSet 28;
+}
$FH = 'File0000' ;
@@ -127,13 +136,7 @@ $pwd = cwd();
my(@XSStack) = ({type => 'none'}); # Stack of conditionals and INCLUDEs
my($XSS_work_idx, $cpp_next_tmp) = (0, "XSubPPtmpAAAA");
-my($SymSet);
-if ($Is_VMS) {
- # Establish set of global symbols with max length 28, since xsubpp
- # will later add the 'XS_' prefix.
- require ExtUtils::XSSymSet;
- $SymSet = new ExtUtils::XSSymSet 28;
-}
+
sub TrimWhitespace
{
diff --git a/lib/Test/Harness.pm b/lib/Test/Harness.pm
index e2bb89eb5a..1bc791be3e 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.15";
+$VERSION = "1.1501";
@ISA=('Exporter');
@EXPORT= qw(&runtests);
diff --git a/lib/overload.pm b/lib/overload.pm
index 0eb9702f82..c9044db0dc 100644
--- a/lib/overload.pm
+++ b/lib/overload.pm
@@ -588,9 +588,9 @@ function).
=head1 BUGS
-Because it is used for overloading, the per-package associative array
-%OVERLOAD now has a special meaning in Perl. The symbol table is
-filled with names looking like line-noise.
+Because it is used for overloading, the per-package hash %OVERLOAD now
+has a special meaning in Perl. The symbol table is filled with names
+looking like line-noise.
For the purpose of inheritance every overloaded package behaves as if
C<fallback> is present (possibly undefined). This may create
diff --git a/op.c b/op.c
index 55450e11a8..f6c57e5874 100644
--- a/op.c
+++ b/op.c
@@ -693,8 +693,6 @@ OP *op;
case OP_AELEM:
case OP_AELEMFAST:
case OP_ASLICE:
- case OP_VALUES:
- case OP_KEYS:
case OP_HELEM:
case OP_HSLICE:
case OP_UNPACK:
@@ -817,6 +815,8 @@ OP *op;
deprecate("implicit split to @_");
}
break;
+ case OP_KEYS:
+ case OP_VALUES:
case OP_DELETE:
op->op_private |= OPpLEAVE_VOID;
break;
@@ -2949,11 +2949,11 @@ CV* outside;
AvFLAGS(av) = AVf_REIFY;
for (ix = AvFILL(protopad); ix > 0; ix--) {
- SV* sv;
- if (pname[ix] != &sv_undef) {
- char *name = SvPVX(pname[ix]); /* XXX */
- if (SvFLAGS(pname[ix]) & SVf_FAKE) { /* lexical from outside? */
- I32 off = pad_findlex(name, ix, SvIVX(pname[ix]),
+ SV* namesv = pname[ix];
+ if (namesv && namesv != &sv_undef) {
+ char *name = SvPVX(namesv); /* XXX */
+ if (SvFLAGS(namesv) & SVf_FAKE) { /* lexical from outside? */
+ I32 off = pad_findlex(name, ix, SvIVX(namesv),
CvOUTSIDE(cv), cxstack_ix);
if (!off)
curpad[ix] = SvREFCNT_inc(ppad[ix]);
@@ -2961,6 +2961,7 @@ CV* outside;
croak("panic: cv_clone: %s", name);
}
else { /* our own lexical */
+ SV* sv;
if (*name == '&') {
/* anon code -- we'll come back for it */
sv = SvREFCNT_inc(ppad[ix]);
@@ -2977,7 +2978,7 @@ CV* outside;
}
}
else {
- sv = NEWSV(0,0);
+ SV* sv = NEWSV(0,0);
SvPADTMP_on(sv);
curpad[ix] = sv;
}
@@ -2986,9 +2987,11 @@ CV* outside;
/* Now that vars are all in place, clone nested closures. */
for (ix = AvFILL(protopad); ix > 0; ix--) {
- if (pname[ix] != &sv_undef
- && !(SvFLAGS(pname[ix]) & SVf_FAKE)
- && *SvPVX(pname[ix]) == '&'
+ SV* namesv = pname[ix];
+ if (namesv
+ && namesv != &sv_undef
+ && !(SvFLAGS(namesv) & SVf_FAKE)
+ && *SvPVX(namesv) == '&'
&& CvCLONE(ppad[ix]))
{
CV *kid = cv_clone2((CV*)ppad[ix], cv);
@@ -3075,6 +3078,11 @@ OP *block;
SvPOK(cv) ? SvPV((SV*)cv,na) : "none",
p ? p : "none");
}
+ if (!block) {
+ /* just a "sub foo;" when &foo is already defined */
+ SAVEFREESV(compcv);
+ goto done;
+ }
if (const_sv || dowarn) {
line_t oldline = curcop->cop_line;
curcop->cop_line = copline;
@@ -3206,6 +3214,7 @@ OP *block;
}
}
+ done:
copline = NOLINE;
LEAVE_SCOPE(floor);
return cv;
diff --git a/opcode.h b/opcode.h
index 43586babce..15331b733b 100644
--- a/opcode.h
+++ b/opcode.h
@@ -838,9 +838,9 @@ EXT char *op_desc[] = {
"keys",
"delete",
"exists operator",
- "associative array deref",
- "associative array elem",
- "associative array slice",
+ "hash deref",
+ "hash elem",
+ "hash slice",
"unpack",
"pack",
"split",
diff --git a/opcode.pl b/opcode.pl
index d63ecc5292..303489eda7 100755
--- a/opcode.pl
+++ b/opcode.pl
@@ -358,16 +358,16 @@ aelemfast known array element ck_null s A S
aelem array element ck_null s A S
aslice array slice ck_null m A L
-# Associative arrays.
+# Hashes.
each each ck_fun t H
values values ck_fun t H
keys keys ck_fun t H
delete delete ck_delete 0 S
exists exists operator ck_exists is S
-rv2hv associative array deref ck_rvconst dt
-helem associative array elem ck_null s H S
-hslice associative array slice ck_null m H L
+rv2hv hash deref ck_rvconst dt
+helem hash elem ck_null s H S
+hslice hash slice ck_null m H L
# Explosives and implosives.
diff --git a/os2/perl2cmd.pl b/os2/perl2cmd.pl
index f9cc03bdac..e774f773d0 100644
--- a/os2/perl2cmd.pl
+++ b/os2/perl2cmd.pl
@@ -23,7 +23,7 @@ foreach $file (<$idir/*>) {
$base =~ s|.*/||;
$file =~ s|/|\\|g ;
print "Processing $file => $dir\\$base.cmd\n";
- system 'cmd.exe', '/c', "echo extproc perl -S>$dir\\$base.cmd";
+ system 'cmd.exe', '/c', "echo extproc perl -S >$dir\\$base.cmd";
system 'cmd.exe', '/c', "type $file >> $dir\\$base.cmd";
}
diff --git a/patchlevel.h b/patchlevel.h
index 5c392cac4b..0314619d6e 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -1,5 +1,5 @@
#define PATCHLEVEL 3
-#define SUBVERSION 27
+#define SUBVERSION 28
/*
local_patches -- list of locally applied less-than-subversion patches.
diff --git a/perl.c b/perl.c
index be2f7d8d38..a93ff71977 100644
--- a/perl.c
+++ b/perl.c
@@ -948,7 +948,7 @@ I32 flags; /* See G_* flags in cop.h */
{
LOGOP myop; /* fake syntax tree node */
SV** sp = stack_sp;
- I32 oldmark = TOPMARK;
+ I32 oldmark;
I32 retval;
Sigjmp_buf oldtop;
I32 oldscope;
@@ -959,20 +959,24 @@ I32 flags; /* See G_* flags in cop.h */
SAVETMPS;
}
+ Zero(&myop, 1, LOGOP);
+ if (flags & G_NOARGS) {
+ PUSHMARK(sp);
+ }
+ else
+ myop.op_flags |= OPf_STACKED;
+ myop.op_next = Nullop;
+ myop.op_flags |= OPf_KNOW;
+ if (flags & G_ARRAY)
+ myop.op_flags |= OPf_LIST;
SAVESPTR(op);
op = (OP*)&myop;
- Zero(op, 1, LOGOP);
+
EXTEND(stack_sp, 1);
*++stack_sp = sv;
+ oldmark = TOPMARK;
oldscope = scopestack_ix;
- if (!(flags & G_NOARGS))
- myop.op_flags = OPf_STACKED;
- myop.op_next = Nullop;
- myop.op_flags |= OPf_KNOW;
- if (flags & G_ARRAY)
- myop.op_flags |= OPf_LIST;
-
if (perldb && curstash != debstash
/* Handle first BEGIN of -d. */
&& (DBcv || (DBcv = GvCV(DBsub)))
@@ -1435,13 +1439,13 @@ GNU General Public License, which may be found in the Perl 5.0 source kit.\n\n")
case '\n':
case '\t':
break;
- case 'P':
- if (preprocess)
- return s+1;
#ifdef ALTERNATE_SHEBANG
case 'S': /* OS/2 needs -S on "extproc" line. */
break;
#endif
+ case 'P':
+ if (preprocess)
+ return s+1;
/* FALL THROUGH */
default:
croak("Can't emulate -%.1s on #! line",s);
@@ -1471,9 +1475,9 @@ my_unexec()
# ifdef VMS
# include <lib$routines.h>
lib$signal(SS$_DEBUG); /* ssdef.h #included from vmsish.h */
-#else
+# else
ABORT(); /* for use with undump */
-#endif
+# endif
#endif
}
@@ -2336,6 +2340,11 @@ int addsubdirs;
+ sizeof("//auto"));
New(55, archpat_auto, len, char);
sprintf(archpat_auto, "/%s/%s/auto", ARCHNAME, patchlevel);
+#ifdef VMS
+ for (len = sizeof(ARCHNAME) + 2;
+ archpat_auto[len] != '\0' && archpat_auto[len] != '/'; len++)
+ if (archpat_auto[len] == '.') archpat_auto[len] = '_';
+#endif
}
}
@@ -2367,7 +2376,20 @@ int addsubdirs;
*/
if (addsubdirs) {
struct stat tmpstatbuf;
+#ifdef VMS
+ char *unix;
+ STRLEN len;
+ if ((unix = tounixspec_ts(SvPV(libdir,na),Nullch)) != Nullch) {
+ len = strlen(unix);
+ while (unix[len-1] == '/') len--; /* Cosmetic */
+ sv_usepvn(libdir,unix,len);
+ }
+ else
+ PerlIO_printf(PerlIO_stderr(),
+ "Failed to unixify @INC element \"%s\"\n",
+ SvPV(libdir,na));
+#endif
/* .../archname/version if -d .../archname/version/auto */
sv_setsv(subdir, libdir);
sv_catpv(subdir, archpat_auto);
diff --git a/perlsdio.h b/perlsdio.h
index c3714410d6..f5c2921f38 100644
--- a/perlsdio.h
+++ b/perlsdio.h
@@ -32,10 +32,14 @@
((*(f) && !((*(f))->_flag & _IONBF) && \
((*(f))->_ptr > (*(f))->_base)) ? \
((*(f))->_cnt++, *(--(*(f))->_ptr) = (c)) : decc$ungetc(c,f)))
+ /* Work around bug in DECCRTL/AXP (DECC v5.x) which causes read
+ * from a pipe after EOF has been returned once to hang.
+ */
+# define PerlIO_getc(f) (feof(f) ? EOF : getc(f))
#else
# define PerlIO_ungetc(f,c) ungetc(c,f)
+# define PerlIO_getc(f) getc(f)
#endif
-#define PerlIO_getc(f) getc(f)
#define PerlIO_eof(f) feof(f)
#define PerlIO_getname(f,b) fgetname(f,b)
#define PerlIO_error(f) ferror(f)
diff --git a/pod/perl.pod b/pod/perl.pod
index e8522fe89b..302f58b94d 100644
--- a/pod/perl.pod
+++ b/pod/perl.pod
@@ -90,26 +90,28 @@ system management tasks. The language is intended to be practical
(easy to use, efficient, complete) rather than beautiful (tiny,
elegant, minimal).
-Perl combines (in the author's opinion, anyway) some
-of the best features of C, B<sed>, B<awk>, and B<sh>, so people
-familiar with those languages should have little difficulty with it.
-(Language historians will also note some vestiges of B<csh>, Pascal,
-and even BASIC-PLUS.) Expression syntax corresponds quite closely to C
+Perl combines (in the author's opinion, anyway) some of the best
+features of C, B<sed>, B<awk>, and B<sh>, so people familiar with
+those languages should have little difficulty with it. (Language
+historians will also note some vestiges of B<csh>, Pascal, and even
+BASIC-PLUS.) Expression syntax corresponds quite closely to C
expression syntax. Unlike most Unix utilities, Perl does not
arbitrarily limit the size of your data--if you've got the memory,
-Perl can slurp in your whole file as a single string. Recursion is
-of unlimited depth. And the hash tables used by associative arrays
-grow as necessary to prevent degraded performance. Perl uses
-sophisticated pattern matching techniques to scan large amounts of data
-very quickly. Although optimized for scanning text, Perl can also
-deal with binary data, and can make dbm files look like associative
-arrays. Setuid Perl scripts are safer than
-C programs through a dataflow tracing mechanism which prevents many
-stupid security holes. If you have a problem that would ordinarily use
-B<sed> or B<awk> or B<sh>, but it exceeds their capabilities or must
-run a little faster, and you don't want to write the silly thing in C,
-then Perl may be for you. There are also translators to turn your
-B<sed> and B<awk> scripts into Perl scripts.
+Perl can slurp in your whole file as a single string. Recursion is of
+unlimited depth. And the tables used by hashes (previously called
+"associative arrays") grow as necessary to prevent degraded
+performance. Perl uses sophisticated pattern matching techniques to
+scan large amounts of data very quickly. Although optimized for
+scanning text, Perl can also deal with binary data, and can make dbm
+files look like hashes. Setuid Perl scripts are safer than C programs
+through a dataflow tracing mechanism which prevents many stupid
+security holes.
+
+If you have a problem that would ordinarily use B<sed> or B<awk> or
+B<sh>, but it exceeds their capabilities or must run a little faster,
+and you don't want to write the silly thing in C, then Perl may be for
+you. There are also translators to turn your B<sed> and B<awk>
+scripts into Perl scripts.
But wait, there's more...
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 08c0a2d066..628ca22f27 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -34,6 +34,14 @@ 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 Fixed Parsing of $$<digit>, &$<digit>, etc.
+
+A bug in previous versions of Perl 5.0 prevented proper parsing of
+numeric special variables as symbolic references. That bug has been
+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 Internal Change: FileHandle Deprecated
Filehandles are now stored internally as type IO::Handle.
@@ -103,10 +111,9 @@ So "%hi" means "short integer in decimal", and "%ho" means
=item keys as an lvalue
As an lvalue, C<keys> allows you to increase the number of hash buckets
-allocated for the given associative array. This can gain you a measure
-of efficiency if you know the hash is going to get big. (This is
-similar to pre-extending an array by assigning a larger number to
-$#array.) If you say
+allocated for the given hash. This can gain you a measure of efficiency if
+you know the hash is going to get big. (This is similar to pre-extending
+an array by assigning a larger number to $#array.) If you say
keys %hash = 200;
@@ -122,7 +129,7 @@ as trying has no effect).
You can now use my() (with or without the parentheses) in the control
expressions of control structures such as:
- while (my $line = <>) {
+ while (defined(my $line = <>)) {
$line = lc $line;
} continue {
print $line;
@@ -331,69 +338,72 @@ possibly for cleaning up.
=back
-=head2 Efficiency Enhancements
-
-All hash keys with the same string are only allocated once, so
-even if you have 100 copies of the same hash, the immutable keys
-never have to be re-allocated.
-
-Functions that have an empty prototype and that do nothing but return
-a fixed value are now inlined (e.g. C<sub PI () { 3.14159 }>).
-
=head2 Malloc Enhancements
-If perl's malloc() is used, you can require memory statistics at
-runtime by running perl thusly:
+If perl's malloc() is used, you can print memory statistics at runtime
+by running Perl thusly:
env PERL_DEBUG_MSTATS=2 perl your_script_here
-The value of 2 means that the statistics is required after the
-compilation and on exit, if value is 1 the statistics is printed on
-exit only. (If you want the statistics at an arbitrary time, you need
-to install an optional module Devel::Peek.)
+The value of 2 means to print statistics after compilation and on
+exit; with a value of 1, the statistics ares printed only on exit.
+(If you want the statistics at an arbitrary time, you'll need to
+install the optional module Devel::Peek.)
-Three new flags are recognized by malloc.c. (They have no effect if
-perl is compiled with system malloc().)
+In addition, three new compilation flags are recognized by malloc.c.
+(They have no effect if perl is compiled with system malloc().)
=over
-=item B<-D>C<EMERGENCY_SBRK>
+=item -DEMERGENCY_SBRK
-If defined, running out of memory may be not a fatal error if a memory
-pool is allocated by assigning to variable $^M, see L<"$^M">.
+If this macro is defined, running out of memory need not be a fatal
+error: a memory pool can allocated by assigning to the special
+variable C<$^M>. See L<"$^M">.
-=item B<-D>C<PACK_MALLOC>
+=item -DPACK_MALLOC
-Perl memory allocation is by bucket with sizes close to powers of
-two. Because of these malloc overhead may be big, especially for data
-of size exactly a power of two. If C<PACK_MALLOC> is defined, perl
-uses a slightly different algorithm for small allocations (up to 64
-bytes long), which makes it possible to have overhead down to 1 byte
-for allocations which are powers of two (and appear quite often).
+Perl memory allocation is by bucket with sizes close to powers of two.
+Because of these malloc overhead may be big, especially for data of
+size exactly a power of two. If C<PACK_MALLOC> is defined, perl uses
+a slightly different algorithm for small allocations (up to 64 bytes
+long), which makes it possible to have overhead down to 1 byte for
+allocations which are powers of two (and appear quite often).
-Expected memory savings (with 8-byte alignment in C<alignbytes>) are
-circa 20% for typical Perl usage. Expected slowdown due to additional
-malloc overhead is in fractions of percent (hard to measure, because
+Expected memory savings (with 8-byte alignment in C<alignbytes>) is
+about 20% for typical Perl usage. Expected slowdown due to additional
+malloc overhead is in fractions of a percent (hard to measure, because
of the effect of saved memory on speed).
-=item B<-D>C<TWO_POT_OPTIMIZE>
+=item -DTWO_POT_OPTIMIZE
-Similarly to C<PACK_MALLOC>, this improves allocations of data with
-size close ot power of two, only it works for big allocations
-(starting with 16K by default). Such allocations are typical for big
-hashes and special-purpose scripts, say, image processing.
+Similarly to C<PACK_MALLOC>, this macro improves allocations of data
+with size close to a power of two; but this works for big allocations
+(starting with 16K by default). Such allocations are typical for big
+hashes and special-purpose scripts, especially image processing.
-On young systems the fact that perl requires 2M from system for 1M
-allocation will not affect the speed, since the tail of such a chunk
-is not going to be touched, however, this may affect the maximal
-number of allocations (unless the system overcommits memory).
+On recent systems, the fact that perl requires 2M from system for 1M
+allocation will not affect speed of execution, since the tail of such
+a chunk is not going to be touched (and thus will not require real
+memory). However, it may result in a premature out-of-memory error.
+So if you will be manipulating very large blocks with sizes close to
+powers of two, it would be wise to define this macro.
Expected saving of memory is 0-100% (100% in applications which
-require most memory in such 2**n chunks), expected slowdown
+require most memory in such 2**n chunks); expected slowdown is
negligible.
=back
+=head2 Miscellaneous Efficiency Enhancements
+
+Functions that have an empty prototype and that do nothing but return
+a fixed value are now inlined (e.g. C<sub PI () { 3.14159 }>).
+
+Each unique hash key is only allocated once, no matter how many hashes
+have an entry with that key. So even if you have 100 copies of the
+same hash, the hash keys never have to be re-allocated.
+
=head1 Pragmata
Four new pragmatic modules exist:
@@ -436,7 +446,7 @@ Disable unsafe opcodes, or any named opcodes, when compiling Perl code.
=item use vmsish
Enable VMS-specific language features. Currently, there are three
-VMS-specific feature available: 'status', which makes C<$?> and
+VMS-specific features available: 'status', which makes C<$?> and
C<system> return genuine VMS status values instead of emulating POSIX;
'exit', which makes C<exit> take a genuine VMS status value instead of
assuming that C<exit 1> is an error; and 'time', which makes all times
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index ec300c862b..394ffcbab3 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -267,10 +267,6 @@ shmctl(). In C parlance, the correct sizes are, respectively,
S<sizeof(struct msqid_ds *)>, S<sizeof(struct semid_ds *)>, and
S<sizeof(struct shmid_ds *)>.
-=item Bad associative array
-
-(P) One of the internal hash routines was passed a null HV pointer.
-
=item Bad filehandle: %s
(F) A symbol was passed to something wanting a filehandle, but the symbol
@@ -288,6 +284,10 @@ This message can be quite often seen with DB_File on systems with
C<Berkeley DB> which is left unnoticed if C<DB> uses I<forgiving>
system malloc().
+=item Bad hash
+
+(P) One of the internal hash routines was passed a null HV pointer.
+
=item Bad name after %s::
(F) You started to name a symbol by using a package prefix, and then didn't
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 6825d22e7d..9d21587696 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -622,31 +622,31 @@ their own password:
Of course, typing in your own password to whomever asks you
for it is unwise.
-=item dbmclose ASSOC_ARRAY
+=item dbmclose HASH
[This function has been superseded by the untie() function.]
-Breaks the binding between a DBM file and an associative array.
+Breaks the binding between a DBM file and a hash.
-=item dbmopen ASSOC,DBNAME,MODE
+=item dbmopen HASH,DBNAME,MODE
[This function has been superseded by the tie() function.]
-This binds a dbm(3), ndbm(3), sdbm(3), gdbm(), or Berkeley DB file to an
-associative array. ASSOC is the name of the associative array. (Unlike
-normal open, the first argument is I<NOT> a filehandle, even though it
-looks like one). DBNAME is the name of the database (without the F<.dir>
-or F<.pag> extension if any). If the database does not exist, it is
-created with protection specified by MODE (as modified by the umask()).
-If your system supports only the older DBM functions, you may perform only
-one dbmopen() in your program. In older versions of Perl, if your system
-had neither DBM nor ndbm, calling dbmopen() produced a fatal error; it now
-falls back to sdbm(3).
-
-If you don't have write access to the DBM file, you can only read
-associative array variables, not set them. If you want to test whether
-you can write, either use file tests or try setting a dummy array entry
-inside an eval(), which will trap the error.
+This binds a dbm(3), ndbm(3), sdbm(3), gdbm(), or Berkeley DB file to a
+hash. HASH is the name of the hash. (Unlike normal open, the first
+argument is I<NOT> a filehandle, even though it looks like one). DBNAME
+is the name of the database (without the F<.dir> or F<.pag> extension if
+any). If the database does not exist, it is created with protection
+specified by MODE (as modified by the umask()). If your system supports
+only the older DBM functions, you may perform only one dbmopen() in your
+program. In older versions of Perl, if your system had neither DBM nor
+ndbm, calling dbmopen() produced a fatal error; it now falls back to
+sdbm(3).
+
+If you don't have write access to the DBM file, you can only read hash
+variables, not set them. If you want to test whether you can write,
+either use file tests or try setting a dummy hash entry inside an eval(),
+which will trap the error.
Note that functions such as keys() and values() may return huge array
values when used on large DBM files. You may prefer to use the each()
@@ -677,8 +677,8 @@ a real null string, such as referencing elements of an array. You may
also check to see if arrays or subroutines exist. Use of defined on
predefined variables is not guaranteed to produce intuitive results.
-When used on a hash array element, it tells you whether the value
-is defined, not whether the key exists in the hash. Use exists() for that.
+When used on a hash array element, it tells you whether the value is
+defined, not whether the key exists in the hash. Use exists() for that.
Examples:
@@ -727,14 +727,14 @@ changed, fixed, or broken in a future release of Perl.
=item delete EXPR
-Deletes the specified key(s) and their associated values from a hash
-array. For each key, returns the deleted value associated with that key,
-or the undefined value if there was no such key. Deleting from C<$ENV{}>
-modifies the environment. Deleting from an array tied to a DBM file
+Deletes the specified key(s) and their associated values from a hash.
+For each key, returns the deleted value associated with that key, or
+the undefined value if there was no such key. Deleting from C<$ENV{}>
+modifies the environment. Deleting from a hash tied to a DBM file
deletes the entry from the DBM file. (But deleting from a tie()d hash
doesn't necessarily return anything.)
-The following deletes all the values of an associative array:
+The following deletes all the values of a hash:
foreach $key (keys %HASH) {
delete $HASH{$key};
@@ -854,22 +854,23 @@ Example:
QUICKSTART:
Getopt('f');
-=item each ASSOC_ARRAY
-
-When called in a list context, returns a 2-element array consisting
-of the key and value for the next element of an associative array,
-so that you can iterate over it. When called in a scalar context,
-returns the key for only the next element in the associative array.
-Entries are returned in an apparently random order. When the array is
-entirely read, a null array is returned in list context (which when
-assigned produces a FALSE (0) value), and C<undef> is returned in a
-scalar context. The next call to each() after that will start
-iterating again. The iterator can be reset only by reading all the
-elements from the array. You should not add elements to an array while
-you're iterating over it. There is a single iterator for each
-associative array, shared by all each(), keys(), and values() function
-calls in the program. The following prints out your environment like
-the printenv(1) program, only in a different order:
+=item each HASH
+
+When called in a list context, returns a 2-element array consisting of the
+key and value for the next element of a hash, so that you can iterate over
+it. When called in a scalar context, returns the key for only the next
+element in the hash. Entries are returned in an apparently random order.
+When the hash is entirely read, a null array is returned in list context
+(which when assigned produces a FALSE (0) value), and C<undef> is returned
+in a scalar context. The next call to each() after that will start
+iterating again. There is a single iterator for each hash, shared by all
+each(), keys(), and values() function calls in the program; it can be
+reset by reading all the elements from the hash, or by evaluating C<keys
+HASH> or C<values HASH> in a scalar context. You should not add elements
+to an hash while you're iterating over it.
+
+The following prints out your environment like the printenv(1) program,
+only in a different order:
while (($key,$value) = each %ENV) {
print "$key=$value\n";
@@ -1573,14 +1574,15 @@ Example:
See L<perlfunc/split>.
-=item keys ASSOC_ARRAY
+=item keys HASH
+
+Returns a normal array consisting of all the keys of the named hash. (In
+a scalar context, returns the number of keys.) The keys are returned in
+an apparently random order, but it is the same order as either the
+values() or each() function produces (given that the hash has not been
+modified). As a side effect, it resets HASH's iterator.
-Returns a normal array consisting of all the keys of the named
-associative array. (In a scalar context, returns the number of keys.)
-The keys are returned in an apparently random order, but it is the same
-order as either the values() or each() function produces (given that
-the associative array has not been modified). Here is yet another way
-to print your environment:
+Here is yet another way to print your environment:
@keys = keys %ENV;
@values = values %ENV;
@@ -1594,18 +1596,17 @@ or how about sorted by key:
print $key, '=', $ENV{$key}, "\n";
}
-To sort an array by value, you'll need to use a C<sort{}>
-function. Here's a descending numeric sort of a hash by its values:
+To sort an array by value, you'll need to use a C<sort{}> function.
+Here's a descending numeric sort of a hash by its values:
foreach $key (sort { $hash{$b} <=> $hash{$a} } keys %hash)) {
printf "%4d %s\n", $hash{$key}, $key;
}
As an lvalue C<keys> allows you to increase the number of hash buckets
-allocated for the given associative array. This can gain you a measure
-of efficiency if you know the hash is going to get big. (This is
-similar to pre-extending an array by assigning a larger number to
-$#array.) If you say
+allocated for the given hash. This can gain you a measure of efficiency if
+you know the hash is going to get big. (This is similar to pre-extending
+an array by assigning a larger number to $#array.) If you say
keys %hash = 200;
@@ -2377,7 +2378,7 @@ If the referenced object has been blessed into a package, then that package
name is returned instead. You can think of ref() as a typeof() operator.
if (ref($r) eq "HASH") {
- print "r is a reference to an associative array.\n";
+ print "r is a reference to a hash.\n";
}
if (!ref ($r) {
print "r is not a reference at all.\n";
@@ -2832,8 +2833,8 @@ Examples:
}
@sortedclass = sort byage @class;
- # this sorts the %age associative arrays by value
- # instead of key using an in-line function
+ # this sorts the %age hash by value instead of key
+ # using an in-line function
@eldest = sort { $age{$b} <=> $age{$a} } keys %age;
sub backwards { $b cmp $a; }
@@ -3369,8 +3370,7 @@ use the each() function to iterate over such. Example:
}
untie(%HIST);
-A class implementing an associative array should have the following
-methods:
+A class implementing a hash should have the following methods:
TIEHASH classname, LIST
DESTROY this
@@ -3475,7 +3475,7 @@ subroutine. Examples:
undef $foo;
undef $bar{'blurfl'};
undef @ary;
- undef %assoc;
+ undef %hash;
undef &mysub;
return (wantarray ? () : undef) if $they_blew_it;
@@ -3629,13 +3629,13 @@ to the current time. Example of a "touch" command:
$now = time;
utime $now, $now, @ARGV;
-=item values ASSOC_ARRAY
+=item values HASH
-Returns a normal array consisting of all the values of the named
-associative array. (In a scalar context, returns the number of
-values.) The values are returned in an apparently random order, but it
-is the same order as either the keys() or each() function would produce
-on the same array. See also keys(), each(), and sort().
+Returns a normal array consisting of all the values of the named hash.
+(In a scalar context, returns the number of values.) The values are
+returned in an apparently random order, but it is the same order as either
+the keys() or each() function would produce on the same hash. As a side
+effect, it resets HASH's iterator. See also keys(), each(), and sort().
=item vec EXPR,OFFSET,BITS
diff --git a/pod/perlguts.pod b/pod/perlguts.pod
index 3d16f94f25..77acc98aae 100644
--- a/pod/perlguts.pod
+++ b/pod/perlguts.pod
@@ -504,12 +504,12 @@ C<sv_2mortal> or C<sv_mortalcopy> routines.
=head2 Stashes and Globs
-A stash is a hash table (associative array) that contains all of the
-different objects that are contained within a package. Each key of the
-stash is a symbol name (shared by all the different types of objects
-that have the same name), and each value in the hash table is called a
-GV (for Glob Value). This GV in turn contains references to the various
-objects of that name, including (but not limited to) the following:
+A "stash" is a hash that contains all of the different objects that
+are contained within a package. Each key of the stash is a symbol
+name (shared by all the different types of objects that have the same
+name), and each value in the hash table is a GV (Glob Value). This GV
+in turn contains references to the various objects of that name,
+including (but not limited to) the following:
Scalar Value
Array Value
diff --git a/pod/perlmod.pod b/pod/perlmod.pod
index b7383d23d3..9b649d6425 100644
--- a/pod/perlmod.pod
+++ b/pod/perlmod.pod
@@ -67,15 +67,15 @@ or L<perlref> regarding closures.
=head2 Symbol Tables
-The symbol table for a package happens to be stored in the associative
-array of that name appended with two colons. The main symbol table's
-name is thus C<%main::>, or C<%::> for short. Likewise symbol table for
-the nested package mentioned earlier is named C<%OUTER::INNER::>.
-
-The value in each entry of the associative array is what you are referring
-to when you use the C<*name> typeglob notation. In fact, the following
-have the same effect, though the first is more efficient because it does
-the symbol table lookups at compile time:
+The symbol table for a package happens to be stored in the hash of that
+name with two colons appended. The main symbol table's name is thus
+C<%main::>, or C<%::> for short. Likewise symbol table for the nested
+package mentioned earlier is named C<%OUTER::INNER::>.
+
+The value in each entry of the hash is what you are referring to when you
+use the C<*name> typeglob notation. In fact, the following have the same
+effect, though the first is more efficient because it does the symbol
+table lookups at compile time:
local(*main::foo) = *main::bar; local($main::{'foo'}) =
$main::{'bar'};
diff --git a/pod/perlop.pod b/pod/perlop.pod
index 55108f0328..88a8af0fd4 100644
--- a/pod/perlop.pod
+++ b/pod/perlop.pod
@@ -167,9 +167,8 @@ supposed to be searched, substituted, or translated instead of the default
$_. The return value indicates the success of the operation. (If the
right argument is an expression rather than a search pattern,
substitution, or translation, it is interpreted as a search pattern at run
-time. This is less efficient than an explicit search, because the pattern
-must be compiled every time the expression is evaluated--unless you've
-used C</o>.)
+time. This can be is less efficient than an explicit search, because the
+pattern must be compiled every time the expression is evaluated.
Binary "!~" is just like "=~" except the return value is negated in
the logical sense.
@@ -1001,15 +1000,15 @@ always undergo shell expansion as well, see L<perlsec> for
security concerns.)
Evaluating a filehandle in angle brackets yields the next line from
-that file (newline included, so it's never false until end of file, at
-which time an undefined value is returned). Ordinarily you must assign
-that value to a variable, but there is one situation where an automatic
-assignment happens. I<If and ONLY if> the input symbol is the only
-thing inside the conditional of a C<while> loop, the value is
-automatically assigned to the variable C<$_>. The assigned value is
-then tested to see if it is defined. (This may seem like an odd thing
-to you, but you'll use the construct in almost every Perl script you
-write.) Anyway, the following lines are equivalent to each other:
+that file (newline, if any, included), or C<undef> at end of file.
+Ordinarily you must assign that value to a variable, but there is one
+situation where an automatic assignment happens. I<If and ONLY if> the
+input symbol is the only thing inside the conditional of a C<while> or
+C<for(;;)> loop, the value is automatically assigned to the variable
+C<$_>. The assigned value is then tested to see if it is defined.
+(This may seem like an odd thing to you, but you'll use the construct
+in almost every Perl script you write.) Anyway, the following lines
+are equivalent to each other:
while (defined($_ = <STDIN>)) { print; }
while (<STDIN>) { print; }
diff --git a/pod/perlsec.pod b/pod/perlsec.pod
index 2324b8a373..5961200f4d 100644
--- a/pod/perlsec.pod
+++ b/pod/perlsec.pod
@@ -20,11 +20,10 @@ mode explicitly by using the B<-T> command line flag. This flag is
I<strongly> suggested for server programs and any program run on behalf of
someone else, such as a CGI script.
-While in this mode, Perl takes special precautions called I<taint
-checks> to prevent both obvious and subtle traps. Some of these checks
-are reasonably simple, such as verifying that path directories aren't
-writable by others; careful programmers have always used checks like
-these. Other checks, however, are best supported by the language itself,
+While in this mode, Perl takes special precautions called I<taint checks> to
+prevent both obvious and subtle traps. Some of these checks are reasonably
+simple, such as not blindly using the PATH inherited from one's parent
+process. Other checks, however, are best supported by the language itself,
and it is these checks especially that contribute to making a setuid Perl
program more secure than the corresponding C program.
@@ -145,15 +144,13 @@ block. See L<perllocale/SECURITY> for further discussion and examples.
=head2 Cleaning Up Your Path
For "Insecure C<$ENV{PATH}>" messages, you need to set C<$ENV{'PATH'}> to a
-known value, and each directory in the path must be non-writable by others
-than its owner and group. You may be surprised to get this message even
-if the pathname to your executable is fully qualified. This is I<not>
-generated because you didn't supply a full path to the program; instead,
-it's generated because you never set your PATH environment variable, or
-you didn't set it to something that was safe. Because Perl can't
-guarantee that the executable in question isn't itself going to turn
-around and execute some other program that is dependent on your PATH, it
-makes sure you set the PATH.
+known value. You may be surprised to get this message even if the pathname
+to your executable is fully qualified. This is I<not> generated because you
+didn't supply a full path to the program; instead, it's generated because
+you never set your PATH environment variable. Because Perl can't guarantee
+that the executable in question isn't itself going to turn around and
+execute some other program that is dependent on your PATH, it makes sure you
+set the PATH.
It's also possible to get into trouble with other operations that don't
care whether they use tainted values. Make judicious use of the file
diff --git a/pod/perltie.pod b/pod/perltie.pod
index 13135c4ad5..dfc6894172 100644
--- a/pod/perltie.pod
+++ b/pod/perltie.pod
@@ -293,19 +293,18 @@ the following output demonstrates:
=head2 Tying Hashes
-As the first Perl data type to be tied (see dbmopen()), associative arrays
-have the most complete and useful tie() implementation. A class
-implementing a tied associative array should define the following
-methods: TIEHASH is the constructor. FETCH and STORE access the key and
-value pairs. EXISTS reports whether a key is present in the hash, and
-DELETE deletes one. CLEAR empties the hash by deleting all the key and
-value pairs. FIRSTKEY and NEXTKEY implement the keys() and each()
-functions to iterate over all the keys. And DESTROY is called when the
-tied variable is garbage collected.
-
-If this seems like a lot, then feel free to inherit from
-merely the standard Tie::Hash module for most of your methods, redefining only
-the interesting ones. See L<Tie::Hash> for details.
+As the first Perl data type to be tied (see dbmopen()), hashes have the
+most complete and useful tie() implementation. A class implementing a
+tied hash should define the following methods: TIEHASH is the constructor.
+FETCH and STORE access the key and value pairs. EXISTS reports whether a
+key is present in the hash, and DELETE deletes one. CLEAR empties the
+hash by deleting all the key and value pairs. FIRSTKEY and NEXTKEY
+implement the keys() and each() functions to iterate over all the keys.
+And DESTROY is called when the tied variable is garbage collected.
+
+If this seems like a lot, then feel free to inherit from merely the
+standard Tie::Hash module for most of your methods, redefining only the
+interesting ones. See L<Tie::Hash> for details.
Remember that Perl distinguishes between a key not existing in the hash,
and the key existing in the hash but having a corresponding value of
diff --git a/pod/perltoc.pod b/pod/perltoc.pod
index 224ad5e863..992cd2c3f5 100644
--- a/pod/perltoc.pod
+++ b/pod/perltoc.pod
@@ -54,6 +54,8 @@ HOME, LOGDIR, PATH, PERL5LIB, PERL5DB, PERL_DESTRUCT_LEVEL, PERLLIB
=item New Opcode Module and Revised Safe Module
+=item Fixed Parsing of $$<digit>, &$<digit>, etc.
+
=item Internal Change: FileHandle Deprecated
=item Internal Change: PerlIO internal IO abstraction interface
@@ -76,8 +78,13 @@ isa(CLASS), can(METHOD), VERSION( [NEED] )
=item TIEHANDLE Now Supported
-TIEHANDLE classname, LIST, PRINT this, LIST, READLINE this, DESTROY this,
-Efficiency Enhancements
+TIEHANDLE classname, LIST, PRINT this, LIST, READLINE this, DESTROY this
+
+=item Malloc Enhancements
+
+-DEMERGENCY_SBRK, -DPACK_MALLOC, -DTWO_POT_OPTIMIZE
+
+=item Miscellaneous Efficiency Enhancements
=back
@@ -346,11 +353,11 @@ binmode FILEHANDLE, bless REF,CLASSNAME, bless REF, caller EXPR, caller,
chdir EXPR, chmod LIST, chomp VARIABLE, chomp LIST, chomp, chop VARIABLE,
chop LIST, chop, chown LIST, chr NUMBER, chr, chroot FILENAME, chroot,
close FILEHANDLE, closedir DIRHANDLE, connect SOCKET,NAME, continue BLOCK,
-cos EXPR, crypt PLAINTEXT,SALT, dbmclose ASSOC_ARRAY, dbmopen
-ASSOC,DBNAME,MODE, defined EXPR, defined, delete EXPR, die LIST, do BLOCK,
-do SUBROUTINE(LIST), do EXPR, dump LABEL, each ASSOC_ARRAY, eof FILEHANDLE,
-eof (), eof, eval EXPR, eval BLOCK, exec LIST, exists EXPR, exit EXPR, exp
-EXPR, exp, fcntl FILEHANDLE,FUNCTION,SCALAR, fileno FILEHANDLE, flock
+cos EXPR, crypt PLAINTEXT,SALT, dbmclose HASH, dbmopen HASH,DBNAME,MODE,
+defined EXPR, defined, delete EXPR, die LIST, do BLOCK, do
+SUBROUTINE(LIST), do EXPR, dump LABEL, each HASH, eof FILEHANDLE, eof (),
+eof, eval EXPR, eval BLOCK, exec LIST, exists EXPR, exit EXPR, exp EXPR,
+exp, fcntl FILEHANDLE,FUNCTION,SCALAR, fileno FILEHANDLE, flock
FILEHANDLE,OPERATION, fork, format, formline PICTURE, LIST, getc
FILEHANDLE, getc, getlogin, getpeername SOCKET, getpgrp PID, getppid,
getpriority WHICH,WHO, getpwnam NAME, getgrnam NAME, gethostbyname NAME,
@@ -364,24 +371,24 @@ endprotoent, endservent, getsockname SOCKET, getsockopt
SOCKET,LEVEL,OPTNAME, glob EXPR, glob, gmtime EXPR, goto LABEL, goto EXPR,
goto &NAME, grep BLOCK LIST, grep EXPR,LIST, hex EXPR, hex, import, index
STR,SUBSTR,POSITION, index STR,SUBSTR, int EXPR, int, ioctl
-FILEHANDLE,FUNCTION,SCALAR, join EXPR,LIST, keys ASSOC_ARRAY, kill LIST,
-last LABEL, last, lc EXPR, lc, lcfirst EXPR, lcfirst, length EXPR, length,
-link OLDFILE,NEWFILE, listen SOCKET,QUEUESIZE, local EXPR, localtime EXPR,
-log EXPR, log, lstat FILEHANDLE, lstat EXPR, lstat, m//, map BLOCK LIST,
-map EXPR,LIST, mkdir FILENAME,MODE, msgctl ID,CMD,ARG, msgget KEY,FLAGS,
-msgsnd ID,MSG,FLAGS, msgrcv ID,VAR,SIZE,TYPE,FLAGS, my EXPR, next LABEL,
-next, no Module LIST, oct EXPR, oct, open FILEHANDLE,EXPR, open FILEHANDLE,
-opendir DIRHANDLE,EXPR, ord EXPR, ord, pack TEMPLATE,LIST, package
-NAMESPACE, pipe READHANDLE,WRITEHANDLE, pop ARRAY, pop, pos SCALAR, pos,
-print FILEHANDLE LIST, print LIST, print, printf FILEHANDLE FORMAT, LIST,
-printf FORMAT, LIST, prototype FUNCTION, push ARRAY,LIST, q/STRING/,
-qq/STRING/, qx/STRING/, qw/STRING/, quotemeta EXPR, quotemeta, rand EXPR,
-rand, read FILEHANDLE,SCALAR,LENGTH,OFFSET, read FILEHANDLE,SCALAR,LENGTH,
-readdir DIRHANDLE, readlink EXPR, readlink, recv SOCKET,SCALAR,LEN,FLAGS,
-redo LABEL, redo, ref EXPR, ref, rename OLDNAME,NEWNAME, require EXPR,
-require, reset EXPR, reset, return LIST, reverse LIST, rewinddir DIRHANDLE,
-rindex STR,SUBSTR,POSITION, rindex STR,SUBSTR, rmdir FILENAME, rmdir, s///,
-scalar EXPR, seek FILEHANDLE,POSITION,WHENCE, seekdir DIRHANDLE,POS, select
+FILEHANDLE,FUNCTION,SCALAR, join EXPR,LIST, keys HASH, kill LIST, last
+LABEL, last, lc EXPR, lc, lcfirst EXPR, lcfirst, length EXPR, length, link
+OLDFILE,NEWFILE, listen SOCKET,QUEUESIZE, local EXPR, localtime EXPR, log
+EXPR, log, lstat FILEHANDLE, lstat EXPR, lstat, m//, map BLOCK LIST, map
+EXPR,LIST, mkdir FILENAME,MODE, msgctl ID,CMD,ARG, msgget KEY,FLAGS, msgsnd
+ID,MSG,FLAGS, msgrcv ID,VAR,SIZE,TYPE,FLAGS, my EXPR, next LABEL, next, no
+Module LIST, oct EXPR, oct, open FILEHANDLE,EXPR, open FILEHANDLE, opendir
+DIRHANDLE,EXPR, ord EXPR, ord, pack TEMPLATE,LIST, package NAMESPACE, pipe
+READHANDLE,WRITEHANDLE, pop ARRAY, pop, pos SCALAR, pos, print FILEHANDLE
+LIST, print LIST, print, printf FILEHANDLE FORMAT, LIST, printf FORMAT,
+LIST, prototype FUNCTION, push ARRAY,LIST, q/STRING/, qq/STRING/,
+qx/STRING/, qw/STRING/, quotemeta EXPR, quotemeta, rand EXPR, rand, read
+FILEHANDLE,SCALAR,LENGTH,OFFSET, read FILEHANDLE,SCALAR,LENGTH, readdir
+DIRHANDLE, readlink EXPR, readlink, recv SOCKET,SCALAR,LEN,FLAGS, redo
+LABEL, redo, ref EXPR, ref, rename OLDNAME,NEWNAME, require EXPR, require,
+reset EXPR, reset, return LIST, reverse LIST, rewinddir DIRHANDLE, rindex
+STR,SUBSTR,POSITION, rindex STR,SUBSTR, rmdir FILENAME, rmdir, s///, scalar
+EXPR, seek FILEHANDLE,POSITION,WHENCE, seekdir DIRHANDLE,POS, select
FILEHANDLE, select, select RBITS,WBITS,EBITS,TIMEOUT, semctl
ID,SEMNUM,CMD,ARG, semget KEY,NSEMS,FLAGS, semop KEY,OPSTRING, send
SOCKET,MSG,FLAGS,TO, send SOCKET,MSG,FLAGS, setpgrp PID,PGRP, setpriority
@@ -404,9 +411,8 @@ VARIABLE, time, times, tr///, truncate FILEHANDLE,LENGTH, truncate
EXPR,LENGTH, uc EXPR, uc, ucfirst EXPR, ucfirst, umask EXPR, umask, undef
EXPR, undef, unlink LIST, unlink, unpack TEMPLATE,EXPR, untie VARIABLE,
unshift ARRAY,LIST, use Module LIST, use Module, use Module VERSION LIST,
-use VERSION, utime LIST, values ASSOC_ARRAY, vec EXPR,OFFSET,BITS, wait,
-waitpid PID,FLAGS, wantarray, warn LIST, write FILEHANDLE, write EXPR,
-write, y///
+use VERSION, utime LIST, values HASH, vec EXPR,OFFSET,BITS, wait, waitpid
+PID,FLAGS, wantarray, warn LIST, write FILEHANDLE, write EXPR, write, y///
=back
diff --git a/pod/perltrap.pod b/pod/perltrap.pod
index 4b56dd23d8..05cb02b47b 100644
--- a/pod/perltrap.pod
+++ b/pod/perltrap.pod
@@ -47,8 +47,7 @@ You have to decide whether your array has numeric or string indices.
=item *
-Associative array values do not spring into existence upon mere
-reference.
+Hash values do not spring into existence upon mere reference.
=item *
@@ -795,7 +794,7 @@ The behavior is slightly different for:
=item * (Variable Suicide)
Variable suicide behavior is more consistent under Perl 5.
-Perl5 exhibits the same behavior for associative arrays and scalars,
+Perl5 exhibits the same behavior for hashes and scalars,
that perl4 exhibits for only scalars.
$aGlobal{ "aKey" } = "global value";
diff --git a/pod/perlvar.pod b/pod/perlvar.pod
index 23c110d34e..d072d25df9 100644
--- a/pod/perlvar.pod
+++ b/pod/perlvar.pod
@@ -404,11 +404,14 @@ C<$? & 255> gives which signal, if any, the process died from, and
whether there was a core dump. (Mnemonic: similar to B<sh> and
B<ksh>.)
+Note that if you have installed a signal handler for C<SIGCHLD>, the
+value of C<$?> will usually be wrong outside that handler.
+
Inside an C<END> subroutine C<$?> contains the value that is going to be
given to C<exit()>. You can modify C<$?> in an C<END> subroutine to
change the exit status of the script.
-Under VMS, the pragma C<use vmsish 'status'> make C<$?> reflect the
+Under VMS, the pragma C<use vmsish 'status'> makes C<$?> reflect the
actual VMS exit status, instead of the default emulation of POSIX
status.
diff --git a/pp_sys.c b/pp_sys.c
index 964332828f..75fdc4055a 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -154,12 +154,13 @@ PP(pp_backtick)
TAINT_PROPER("``");
fp = my_popen(tmps, "r");
if (fp) {
- sv_setpv(TARG, ""); /* note that this preserves previous buffer */
if (GIMME == G_SCALAR) {
+ sv_setpv(TARG, ""); /* note that this preserves previous buffer */
while (sv_gets(TARG, fp, SvCUR(TARG)) != Nullch)
/*SUPPRESS 530*/
;
XPUSHs(TARG);
+ SvTAINTED_on(TARG);
}
else {
SV *sv;
@@ -175,9 +176,11 @@ PP(pp_backtick)
SvLEN_set(sv, SvCUR(sv)+1);
Renew(SvPVX(sv), SvLEN(sv), char);
}
+ SvTAINTED_on(sv);
}
}
STATUS_NATIVE_SET(my_pclose(fp));
+ TAINT; /* "I believe that this is not gratuitous!" */
}
else {
STATUS_NATIVE_SET(-1);
@@ -3048,7 +3051,7 @@ PP(pp_getpgrp)
#ifdef BSD_GETPGRP
value = (I32)BSD_GETPGRP(pid);
#else
- if (pid != 0 && pid != getpid()) {
+ if (pid != 0 && pid != getpid())
DIE("POSIX getpgrp can't take an argument");
value = (I32)getpgrp();
#endif
@@ -3078,9 +3081,8 @@ PP(pp_setpgrp)
#ifdef BSD_SETPGRP
SETi( BSD_SETPGRP(pid, pgrp) >= 0 );
#else
- if ((pgrp != 0 && pgrp != getpid())) || (pid != 0 && pid != getpid())) {
+ if ((pgrp != 0 && pgrp != getpid())) || (pid != 0 && pid != getpid()))
DIE("POSIX setpgrp can't take an argument");
- }
SETi( setpgrp() >= 0 );
#endif /* USE_BSDPGRP */
RETURN;
diff --git a/t/harness b/t/harness
index 18feb32dc3..8d87ddd7fb 100755
--- a/t/harness
+++ b/t/harness
@@ -4,9 +4,11 @@
# sophisticated testing.
BEGIN {
- unshift @INC, '../lib'; # To get lib.pm
+ chdir 't' if -d 't';
+ @INC = '../lib';
}
use lib '../lib';
+
use Test::Harness;
$Test::Harness::switches = ""; # Too much noise otherwise
diff --git a/t/op/closure.t b/t/op/closure.t
index 04fb7a303a..7af3abb291 100755
--- a/t/op/closure.t
+++ b/t/op/closure.t
@@ -408,22 +408,31 @@ END
} else {
# No fork(). Do it the hard way.
my $cmdfile = "tcmd$$"; $cmdfile++ while -e $cmdfile;
- my $outfile = "tout$$"; $outfile++ while -e $outfile;
my $errfile = "terr$$"; $errfile++ while -e $errfile;
+ my @tmpfiles = ($cmdfile, $errfile);
open CMD, ">$cmdfile"; print CMD $code; close CMD;
my $cmd = ($^O eq 'VMS') ? "MCR $^X" : "./perl";
- $cmd .= " -w $cmdfile >$outfile 2>$errfile";
- system $cmd;
- $? = 0 if $^O eq 'VMS' and $? & 1; # Keep Unix-minded code below happy
+ $cmd .= " -w $cmdfile 2>$errfile";
+ if ($^O eq 'VMS') {
+ # Use pipe instead of system so we don't inherit STD* from
+ # this process, and then foul our pipe back to parent by
+ # redirecting output in the child.
+ open PERL,"$cmd |" or die "Can't open pipe: $!\n";
+ { local $/; $output = join '', <PERL> }
+ close PERL;
+ } else {
+ my $outfile = "tout$$"; $outfile++ while -e $outfile;
+ push @tmpfiles, $outfile;
+ system "$cmd >$outfile";
+ { local $/; open IN, $outfile; $output = <IN>; close IN }
+ }
if ($?) {
printf "not ok: exited with error code %04X\n", $?;
- $debugging or do { 1 while unlink $cmdfile, $outfile, $errfile };
+ $debugging or do { 1 while unlink @tmpfiles };
exit;
}
- { local $/;
- open IN, $outfile; $output = <IN>; close IN;
- open IN, $errfile; $errors = <IN>; close IN; }
- 1 while unlink $cmdfile, $outfile, $errfile;
+ { local $/; open IN, $errfile; $errors = <IN>; close IN }
+ 1 while unlink @tmpfiles;
}
print $output;
print STDERR $errors;
diff --git a/t/op/magic.t b/t/op/magic.t
index 789c60a93c..f3e6ba3cc2 100755
--- a/t/op/magic.t
+++ b/t/op/magic.t
@@ -104,13 +104,10 @@ else {
$wd = '.';
}
$script = "$wd/show-shebang";
-$s = "\$^X is $wd/perl, \$0 is $script\n";
+$s1 = $s2 = "\$^X is $wd/perl, \$0 is $script\n";
if ($^O eq 'os2') {
# Started by ksh, which adds suffixes '.exe' and '.' to perl and script
- $s1 = "\$^X is $wd/perl.exe, \$0 is $script.\n";
-}
-else {
- $s1 = $s;
+ $s2 = "\$^X is $wd/perl.exe, \$0 is $script.\n";
}
ok 19, open(SCRIPT, ">$script"), $!;
ok 20, print(SCRIPT <<EOB . <<'EOF'), $!;
@@ -122,9 +119,9 @@ ok 21, close(SCRIPT), $!;
ok 22, chmod(0755, $script), $!;
$_ = `$script`;
s{is perl}{is $wd/perl}; # for systems where $^X is only a basename
-ok 23, $_ eq $s1, ":$_:!=:$s1:";
+ok 23, $_ eq $s2, ":$_:!=:$s2:";
$_ = `$wd/perl $script`;
-ok 24, $_ eq $s, ":$_:!=:$s: after `$wd/perl $script`";
+ok 24, $_ eq $s1, ":$_:!=:$s1: after `$wd/perl $script`";
ok 25, unlink($script), $!;
# $], $^O, $^T
diff --git a/unixish.h b/unixish.h
index f21ca739fb..c6cb272104 100644
--- a/unixish.h
+++ b/unixish.h
@@ -105,8 +105,6 @@
#define Fstat(fd,bufptr) fstat((fd),(bufptr))
#define Fflush(fp) fflush(fp)
-#define my_getenv(var) getenv(var)
-
#ifdef PERL_SCO5
# define PERL_SYS_INIT(c,v) fpsetmask(0)
#else
diff --git a/vms/descrip.mms b/vms/descrip.mms
index d3ac365eb2..183c33f2eb 100644
--- a/vms/descrip.mms
+++ b/vms/descrip.mms
@@ -546,7 +546,7 @@ IO : [.lib]IO.pm [.lib.IO]File.pm [.lib.IO]Handle.pm [.lib.IO]Pipe.pm [.lib.IO]S
# Rename catches problem with some DECC versions in which object file is
# placed in current default dir, not same one as source file.
[.x2p]$(DBG)a2p$(E) : [.x2p]a2p$(O), [.x2p]hash$(O), [.x2p]str$(O), [.x2p]util$(O), [.x2p]walk$(O)
- @ If F$Search("a2p$(O)").nes."" Then Rename/NoLog a2p$(O),hash$(O),str$(O),util$(O),walk$(O) [.x2p]
+ @ If F$Search("hash$(O)").nes."" Then Rename/NoLog hash$(O),str$(O),util$(O),walk$(O) [.x2p]
Link $(LINKFLAGS) /Exe=$(MMS$TARGET) $(MMS$SOURCE_LIST) $(CRTLOPTS)
# Accomodate buggy cpp in some version of DECC, which chokes on illegal
@@ -609,6 +609,10 @@ preplibrary : $(MINIPERL_EXE) $(LIBPREREQ) $(SOCKPM)
@ If F$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod]
@ Copy/Log $(MMS$SOURCE) $(MMS$TARGET)
+[.lib.pod]perldelta.pod : [.pod]perldelta.pod
+ @ If F$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod]
+ @ Copy/Log $(MMS$SOURCE) $(MMS$TARGET)
+
[.lib.pod]perldiag.pod : [.pod]perldiag.pod
@ If F$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod]
@ Copy/Log $(MMS$SOURCE) $(MMS$TARGET)
@@ -697,6 +701,10 @@ preplibrary : $(MINIPERL_EXE) $(LIBPREREQ) $(SOCKPM)
@ If F$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod]
@ Copy/Log $(MMS$SOURCE) $(MMS$TARGET)
+[.lib.pod]perltoot.pod : [.pod]perltoot.pod
+ @ If F$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod]
+ @ Copy/Log $(MMS$SOURCE) $(MMS$TARGET)
+
[.lib.pod]perltrap.pod : [.pod]perltrap.pod
@ If F$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod]
@ Copy/Log $(MMS$SOURCE) $(MMS$TARGET)
@@ -1640,7 +1648,6 @@ tidy : cleanlis
- If F$Search("[.Ext.DynaLoader]DL_VMS$(O);-1").nes."" Then Purge/NoConfirm/Log [.Ext.DynaLoader]DL_VMS$(O)
- If F$Search("[.Ext.DynaLoader]DL_VMS.C;-1").nes."" Then Purge/NoConfirm/Log [.Ext.DynaLoader]DL_VMS.C
- If F$Search("[.Ext.Opcode...];-1").nes."" Then Purge/NoConfirm/Log [.Ext.Opcode]
- - If F$Search("[.Ext.FileHandle...];-1").nes."" Then Purge/NoConfirm/Log [.Ext.FileHandle]
- If F$Search("[.VMS.Ext...]*.C;-1").nes."" Then Purge/NoConfirm/Log [.VMS.Ext...]*.C
- If F$Search("[.VMS.Ext...]*$(O);-1").nes."" Then Purge/NoConfirm/Log [.VMS.Ext...]*$(O)
- If F$Search("[.Lib.Auto...]*.al;-1").nes."" Then Purge/NoConfirm/Log [.Lib.Auto...]*.al
@@ -1663,9 +1670,6 @@ clean : tidy
Set Default [.ext.Fcntl]
- $(MMS) clean
Set Default [--]
- Set Default [.ext.FileHandle]
- - $(MMS) clean
- Set Default [--]
Set Default [.ext.IO]
- $(MMS) clean
Set Default [--]
@@ -1701,9 +1705,6 @@ realclean : clean
Set Default [.ext.Fcntl]
- $(MMS) realclean
Set Default [--]
- Set Default [.ext.FileHandle]
- - $(MMS) realclean
- Set Default [--]
Set Default [.ext.IO]
- $(MMS) realclean
Set Default [--]
diff --git a/vms/ext/filespec.t b/vms/ext/filespec.t
index a0a274bfee..62b06fe9ed 100644
--- a/vms/ext/filespec.t
+++ b/vms/ext/filespec.t
@@ -1,5 +1,7 @@
#!./perl
+BEGIN { unshift(@INC,'../lib') if -d '../lib'; }
+
use VMS::Filespec;
foreach (<DATA>) {
diff --git a/vms/genconfig.pl b/vms/genconfig.pl
index 6c3582216d..d2e514b1c9 100644
--- a/vms/genconfig.pl
+++ b/vms/genconfig.pl
@@ -78,10 +78,6 @@ ar=''
eunicefix=':'
hint='none'
hintfile=''
-intsize='4'
-longsize='4'
-shortsize='2'
-alignbytes='8'
shrplib='define'
usemymalloc='n'
usevfork='true'
@@ -256,13 +252,15 @@ while (<IN>) {
$val =~ s!\s*/\*.*!!; # strip off trailing comment
my($had_val); # Maybe a macro with args that we just #undefd or commented
if (!length($val) and $val_vars{$token} and ($un || $blocked)) {
- print OUT "$val_vars{$token}=''\n";
+ print OUT "$val_vars{$token}=''\n" unless exists $done{$val_vars{$token}};
+ $done{$val_vars{$token}}++;
delete $val_vars{$token};
$had_val = 1;
}
$state = ($blocked || $un) ? 'undef' : 'define';
if ($pp_vars{$token}) {
- print OUT "$pp_vars{$token}='$state'\n";
+ print OUT "$pp_vars{$token}='$state'\n" unless exists $done{$pp_vars{$token}};
+ $done{$pp_vars{$token}}++;
delete $pp_vars{$token};
}
elsif (not length $val and not $had_val) {
@@ -278,8 +276,11 @@ while (<IN>) {
# Library directory; convert to VMS syntax
$val = VMS::Filespec::vmspath($val) if ($token =~ /EXP$/);
if ($val_vars{$token}) {
- print OUT "$val_vars{$token}='$val'\n";
- if ($val_vars{$token} =~ s/exp$//) {print OUT "$val_vars{$token}='$val'\n";}
+ print OUT "$val_vars{$token}='$val'\n" unless exists $done{$val_vars{$token}};
+ if ($val_vars{$token} =~ s/exp$//) {
+ print OUT "$val_vars{$token}='$val'\n" unless exists $done{$val_vars{$token}};;
+ }
+ $done{$val_vars{$token}}++;
delete $val_vars{$token};
}
elsif (!$pp_vars{$token}) { # Haven't seen it previously, either
diff --git a/vms/vms.c b/vms/vms.c
index 98f34cef35..b54456918d 100644
--- a/vms/vms.c
+++ b/vms/vms.c
@@ -42,9 +42,9 @@
# define SS$_NOSUCHOBJECT 2696
#endif
-/* Don't intercept calls to vfork, since my_vfork below needs to
- * get to the underlying CRTL routine. */
-#define __DONT_MASK_VFORK
+/* Don't replace system definitions of vfork, getenv, and stat,
+ * code below needs to get to the underlying CRTL routines. */
+#define DONT_MASK_RTL_CALLS
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
@@ -333,7 +333,7 @@ do_rmdir(char *name)
{
char dirfile[NAM$C_MAXRSS+1];
int retval;
- struct stat st;
+ struct mystat st;
if (do_fileify_dirspec(name,dirfile,0) == NULL) return -1;
if (flex_stat(dirfile,&st) || !S_ISDIR(st.st_mode)) retval = -1;
@@ -2965,7 +2965,7 @@ struct passwd *my_getpwnam(char *name)
{
struct dsc$descriptor_s name_desc;
union uicdef uic;
- unsigned long int status, stat;
+ unsigned long int status, sts;
__pwdcache = __passwd_empty;
if (!fillpasswd(name, &__pwdcache)) {
@@ -2974,17 +2974,17 @@ struct passwd *my_getpwnam(char *name)
name_desc.dsc$b_dtype= DSC$K_DTYPE_T;
name_desc.dsc$b_class= DSC$K_CLASS_S;
name_desc.dsc$a_pointer= (char *) name;
- if ((stat = sys$asctoid(&name_desc, &uic, 0)) == SS$_NORMAL) {
+ if ((sts = sys$asctoid(&name_desc, &uic, 0)) == SS$_NORMAL) {
__pwdcache.pw_uid= uic.uic$l_uic;
__pwdcache.pw_gid= uic.uic$v_group;
}
else {
- if (stat == SS$_NOSUCHID || stat == SS$_IVIDENT || stat == RMS$_PRV) {
- set_vaxc_errno(stat);
- set_errno(stat == RMS$_PRV ? EACCES : EINVAL);
+ if (sts == SS$_NOSUCHID || sts == SS$_IVIDENT || sts == RMS$_PRV) {
+ set_vaxc_errno(sts);
+ set_errno(sts == RMS$_PRV ? EACCES : EINVAL);
return NULL;
}
- else { _ckvmssts(stat); }
+ else { _ckvmssts(sts); }
}
}
strncpy(__pw_namecache, name, sizeof(__pw_namecache));
@@ -3388,11 +3388,11 @@ int my_utime(char *file, struct utimbuf *utimes)
* on the first call.
*/
#define LOCKID_MASK 0x80000000 /* Use 0 to force device name use only */
-static dev_t encode_dev (const char *dev)
+static mydev_t encode_dev (const char *dev)
{
int i;
unsigned long int f;
- dev_t enc;
+ mydev_t enc;
char c;
const char *q;
@@ -3456,14 +3456,15 @@ is_null_device(name)
/* Do the permissions allow some operation? Assumes statcache already set. */
/* Do this via $Check_Access on VMS, since the CRTL stat() returns only a
- * subset of the applicable information.
+ * subset of the applicable information. (We have to stick with struct
+ * stat instead of struct mystat in the prototype since we have to match
+ * the one in proto.h.)
*/
/*{{{I32 cando(I32 bit, I32 effective, struct stat *statbufp)*/
I32
cando(I32 bit, I32 effective, struct stat *statbufp)
{
- if (statbufp == &statcache)
- return cando_by_name(bit,effective,namecache);
+ if (statbufp == &statcache) return cando_by_name(bit,effective,namecache);
else {
char fname[NAM$C_MAXRSS+1];
unsigned long int retsts;
@@ -3472,13 +3473,13 @@ cando(I32 bit, I32 effective, struct stat *statbufp)
/* If the struct mystat is stale, we're OOL; stat() overwrites the
device name on successive calls */
- devdsc.dsc$a_pointer = statbufp->st_devnam;
- devdsc.dsc$w_length = strlen(statbufp->st_devnam);
+ devdsc.dsc$a_pointer = ((struct mystat *)statbufp)->st_devnam;
+ devdsc.dsc$w_length = strlen(((struct mystat *)statbufp)->st_devnam);
namdsc.dsc$a_pointer = fname;
namdsc.dsc$w_length = sizeof fname - 1;
- retsts = lib$fid_to_name(&devdsc,&(statbufp->st_ino),&namdsc,
- &namdsc.dsc$w_length,0,0);
+ retsts = lib$fid_to_name(&devdsc,&(((struct mystat *)statbufp)->st_ino),
+ &namdsc,&namdsc.dsc$w_length,0,0);
if (retsts & 1) {
fname[namdsc.dsc$w_length] = '\0';
return cando_by_name(bit,effective,fname);
@@ -3589,13 +3590,12 @@ cando_by_name(I32 bit, I32 effective, char *fname)
/*}}}*/
-/*{{{ int flex_fstat(int fd, struct stat *statbuf)*/
-#undef stat
+/*{{{ int flex_fstat(int fd, struct mystat *statbuf)*/
int
flex_fstat(int fd, struct mystat *statbufp)
{
if (!fstat(fd,(stat_t *) statbufp)) {
- if (statbufp == &statcache) *namecache == '\0';
+ if (statbufp == (struct mystat *) &statcache) *namecache == '\0';
statbufp->st_dev = encode_dev(statbufp->st_devnam);
# ifdef VMSISH_TIME
if (!VMSISH_TIME) { /* Return UTC instead of local time */
@@ -3614,19 +3614,15 @@ flex_fstat(int fd, struct mystat *statbufp)
} /* end of flex_fstat() */
/*}}}*/
-/*{{{ int flex_stat(char *fspec, struct stat *statbufp)*/
-/* We defined 'stat' as 'mystat' in vmsish.h so that declarations of
- * 'struct stat' elsewhere in Perl would use our struct. We go back
- * to the system version here, since we're actually calling their
- * stat().
- */
+/*{{{ int flex_stat(char *fspec, struct mystat *statbufp)*/
int
flex_stat(char *fspec, struct mystat *statbufp)
{
char fileified[NAM$C_MAXRSS+1];
int retval = -1;
- if (statbufp == &statcache) do_tovmsspec(fspec,namecache,0);
+ if (statbufp == (struct mystat *) &statcache)
+ do_tovmsspec(fspec,namecache,0);
if (is_null_device(fspec)) { /* Fake a stat() for the null device */
memset(statbufp,0,sizeof *statbufp);
statbufp->st_dev = encode_dev("_NLA0:");
@@ -3648,7 +3644,8 @@ flex_stat(char *fspec, struct mystat *statbufp)
*/
if (do_fileify_dirspec(fspec,fileified,0) != NULL) {
retval = stat(fileified,(stat_t *) statbufp);
- if (!retval && statbufp == &statcache) strcpy(namecache,fileified);
+ if (!retval && statbufp == (struct mystat *) &statcache)
+ strcpy(namecache,fileified);
}
if (retval) retval = stat(fspec,(stat_t *) statbufp);
if (!retval) {
@@ -3667,8 +3664,6 @@ flex_stat(char *fspec, struct mystat *statbufp)
return retval;
} /* end of flex_stat() */
-/* Reset definition for later calls */
-#define stat mystat
/*}}}*/
/* Insures that no carriage-control translation will be done on a file. */
diff --git a/vms/vmsish.h b/vms/vmsish.h
index cab319dc04..61543415e2 100644
--- a/vms/vmsish.h
+++ b/vms/vmsish.h
@@ -2,8 +2,8 @@
*
* VMS-specific C header file for perl5.
*
- * Last revised: 01-Oct-1995 by Charles Bailey bailey@genetics.upenn.edu
- * Version: 5.1.6
+ * Last revised: 18-Feb-1997 by Charles Bailey bailey@genetics.upenn.edu
+ * Version: 5.3.28
*/
#ifndef __vmsish_h_included
@@ -56,6 +56,18 @@
# include <unistd.h> /* DECC has this; VAXC and gcc don't */
#endif
+#ifdef NO_PERL_TYPEDEFS /* a2p; we don't want Perl's special routines */
+# define DONT_MASK_RTL_CALLS
+#endif
+
+ /* defined for vms.c so we can see CRTL | defined for a2p */
+#ifndef DONT_MASK_RTL_CALLS
+# ifdef getenv
+# undef getenv
+# endif
+# define getenv(v) my_getenv(v) /* getenv used for regular logical names */
+#endif
+
/* DECC introduces this routine in the RTL as of VMS 7.0; for now,
* we'll use ours, since it gives us the full VMS exit status. */
#ifdef __PID_T
@@ -130,7 +142,7 @@
* exec should be handled in VMSish or Unixish style.
*/
#define fork my_vfork
-#ifndef __DONT_MASK_VFORK /* #defined in vms.c so we see real vfork */
+#ifndef DONT_MASK_RTL_CALLS /* #defined in vms.c so we see real vfork */
# ifdef vfork
# undef vfork
# endif
@@ -181,13 +193,13 @@
#define COMPLEX_STATUS 1 /* We track both "POSIX" and VMS values */
-#define HINT_S_VMSISH 24
+#define HINT_V_VMSISH 24
#define HINT_M_VMSISH_STATUS 0x01000000 /* system, $? return VMS status */
#define HINT_M_VMSISH_EXIT 0x02000000 /* exit(1) ==> SS$_NORMAL */
#define HINT_M_VMSISH_TIME 0x04000000 /* times are local, not UTC */
-#define NATIVE_HINTS (hints >> HINT_S_VMSISH) /* used in op.c */
+#define NATIVE_HINTS (hints >> HINT_V_VMSISH) /* used in op.c */
-#define TEST_VMSISH(h) (curcop->op_private & ((h) >> HINT_S_VMSISH))
+#define TEST_VMSISH(h) (curcop->op_private & ((h) >> HINT_V_VMSISH))
#define VMSISH_STATUS TEST_VMSISH(HINT_M_VMSISH_STATUS)
#define VMSISH_EXIT TEST_VMSISH(HINT_M_VMSISH_EXIT)
#define VMSISH_TIME TEST_VMSISH(HINT_M_VMSISH_TIME)
@@ -327,6 +339,9 @@ struct utimbuf {
/* Look up new %ENV values on the fly */
#define DYNAMIC_ENV_FETCH 1
#define ENV_HV_NAME "%EnV%VmS%"
+ /* Special getenv function for retrieving %ENV elements. */
+#define ENV_getenv(v) my_getenv(v)
+
/* Thin jacket around cuserid() tomatch Unix' calling sequence */
#define getlogin my_getlogin
@@ -430,11 +445,16 @@ struct mystat
char st_fab_fsz; /* fixed header size */
unsigned st_dev; /* encoded device name */
};
-#define stat mystat
typedef unsigned mydev_t;
-#define dev_t mydev_t
typedef unsigned myino_t;
-#define ino_t myino_t
+#ifndef DONT_MASK_RTL_CALLS /* defined for vms.c so we can see RTL calls */
+# ifdef stat
+# undef stat
+# endif
+# define stat mystat
+# define dev_t mydev_t
+# define ino_t myino_t
+#endif
#if defined(__DECC) || defined(__DECCXX)
# pragma __member_alignment __restore
#endif
@@ -513,8 +533,8 @@ struct tm * my_gmtime _((const time_t *));
struct tm * my_localtime _((const time_t *));
time_t my_time _((time_t *));
I32 cando_by_name _((I32, I32, char *));
-int flex_fstat _((int, struct stat *));
-int flex_stat _((char *, struct stat *));
+int flex_fstat _((int, struct mystat *));
+int flex_stat _((char *, struct mystat *));
int trim_unixpath _((char *, char*, int));
int my_vfork _(());
bool vms_do_aexec _((SV *, SV **, SV **));
diff --git a/x2p/a2p.pod b/x2p/a2p.pod
index 4e61fd6ab9..06c5ac7322 100644
--- a/x2p/a2p.pod
+++ b/x2p/a2p.pod
@@ -82,13 +82,13 @@ block to bypass the block under such circumstances can be simplified
by removing the conditional in the END block and just exiting directly
from the perl script.
-Perl has two kinds of array, numerically-indexed and associative. Awk
-arrays are usually translated to associative arrays, but if you happen
-to know that the index is always going to be numeric you could change
-the {...} to [...]. Iteration over an associative array is done using
-the keys() function, but iteration over a numeric array is NOT. You
-might need to modify any loop that is iterating over the array in
-question.
+Perl has two kinds of array, numerically-indexed and associative.
+Perl associative arrays are called "hashes". Awk arrays are usually
+translated to hashes, but if you happen to know that the index is
+always going to be numeric you could change the {...} to [...].
+Iteration over a hash is done using the keys() function, but iteration
+over an array is NOT. You might need to modify any loop that iterates
+over such an array.
Awk starts by assuming OFMT has the value %.6g. Perl starts by
assuming its equivalent, $#, to have the value %.20g. You'll want to