Patch for perl.pod
[p5sagit/p5-mst-13.2.git] / pod / perldelta.pod
index c99fe8b..46bd59b 100644 (file)
@@ -27,17 +27,29 @@ might have symbol conflicts if you embed Perl in another application,
 just as in the 5.003 release.  By default, binary compatibility
 is preserved at the expense of symbol table pollution.
 
-=head2 Subroutine Parameters Are Not Autovivified
+=head2 Subroutine arguments created only when they're modified
 
-In Perl versions 5.002 and 5.003, array and hash elements used as
-subroutine parameters were "autovivified"; that is, they were brought
-into existence if they did not already exist.  For example, calling
-C<func($h{foo})> would create C<$h{foo}> if it did not already exist,
-causing C<exists $h{foo}> to become true and C<keys %h> to return
-C<('foo')>.
+In Perl 5.004, nonexistent array and hash elements used as subroutine
+parameters are brought into existence only if they are actually
+assigned to (via C<@_>).
 
-Perl 5.004 returns to the pre-5.002 behavior of I<not> autovivifying
-array and hash elements used as subroutine parameters.
+Earlier versions of Perl vary in their handling of such arguments.
+Perl versions 5.002 and 5.003 always brought them into existence.
+Perl versions 5.000, 5.001, and 5.002 brought them into existence only
+if they were not the first argument (which was almost certainly a
+bug).  Earlier versions of Perl never brought them into existence.
+
+For example, given this code:
+
+     undef @a; undef %a;
+     sub show { print $_[0] };
+     sub change { $_[0]++ };
+     show($a[2]);
+     change($a{b});
+
+After this code executes in Perl 5.004, $a{b} exists but $a[2] does
+not.  In Perl 5.002 and 5.003, both $a{b} and $a[2] would have existed
+(but $a[2]'s value would have been undefined).
 
 =head2 Fixed Parsing of $$<digit>, &$<digit>, etc.
 
@@ -47,6 +59,13 @@ fixed.  As a result, the string "$$0" is no longer equivalent to
 C<$$."0">, but rather to C<${$0}>.  To get the old behavior, change
 "$$" followed by a digit to "${$}".
 
+=head2 No Resetting of $. on Implicit Close
+
+The documentation for Perl 5.0 has always stated that C<$.> is I<not>
+reset when an already-open file handle is re-opened with no intervening
+call to C<close>.  Due to a bug, perl versions 5.000 through 5.0003
+I<did> reset C<$.> under that circumstance; Perl 5.004 does not.
+
 =head2 Changes to Tainting Checks
 
 A bug in previous versions may have failed to detect some insecure
@@ -64,6 +83,15 @@ application of opcode masks.  The revised Safe module has a new API
 and is implemented using the new Opcode module.  Please read the new
 Opcode and Safe documentation.
 
+=head2 Embedding Improvements
+
+In older versions of Perl it was not possible to create more than one
+Perl interpreter instance inside a single process without leaking like a
+sieve and/or crashing.  The bugs that caused this behavior have all been
+fixed.  However, you still must take care when embedding Perl in a C
+program.  See the updated perlembed manpage for tips on how to manage
+your interpreters.
+
 =head2 Internal Change: FileHandle Class Based on IO::* Classes
 
 File handles are now stored internally as type IO::Handle.  The
@@ -124,8 +152,8 @@ This now works.  (e.g. C<delete @ENV{'PATH', 'MANPATH'}>)
 
 =item flock
 
-is now supported on more platforms, and prefers fcntl
-to lockf when emulating.
+is now supported on more platforms, prefers fcntl to lockf when
+emulating, and always flushes before (un)locking.
 
 =item printf and sprintf
 
@@ -251,6 +279,13 @@ string in some way.  This change makes it practical to chain C<m//g>
 matches together in conjunction with ordinary matches using the C<\G>
 zero-width assertion.  See L<perlop> and L<perlre>.
 
+=item C<m//x> ignores whitespace before ?*+{}
+
+The C<m//x> construct has always been intended to ignore all unescaped
+whitespace.  However, before Perl 5.004, whitespace had the effect of
+esacping repeat modifier like "*" or "?".  For example, C</a *b/x> was
+(mis)interpreted as C</a\*b/x>.  This bug has been fixed in 5.004.
+
 =item nested C<sub{}> closures work now
 
 Prior to the 5.004 release, nested anonymous functions didn't work
@@ -283,7 +318,7 @@ are inherited by all other classes:
 
 =item isa(CLASS)
 
-C<isa> returns I<true> if its object is blessed into a sub-class of C<CLASS>
+C<isa> returns I<true> if its object is blessed into a subclass of C<CLASS>
 
 C<isa> is also exportable and can be called as a sub with two arguments. This
 allows the ability to check what a reference points to. Example:
@@ -459,7 +494,7 @@ a fixed value are now inlined (e.g. C<sub PI () { 3.14159 }>).
 
 Each unique hash key is only allocated once, no matter how many hashes
 have an entry with that key.  So even if you have 100 copies of the
-same hash, the hash keys never have to be re-allocated.
+same hash, the hash keys never have to be reallocated.
 
 =head1 Pragmata
 
@@ -739,15 +774,6 @@ access functions and macros if they wish to use C<SV*> keys.  These
 additions also make it feasible to manipulate C<HE*>s (hash entries),
 which can be more efficient.  See L<perlguts> for details.
 
-=item Embedding improvements
-
-In older versions of Perl it was not possible to create more than one
-instance of a Perl interpreter inside the same process without leaking
-like mad and/or crashing.  The major bugs which caused this behavior
-have been fixed, however, you still must take care when embedding Perl
-in a C program.  See the updated perlembed manpage for tips on how to
-manage your interpreters.
-
 =back
 
 =head1 Documentation Changes