This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
minor win32 scribbles
[perl5.git] / pod / perldelta.pod
index f4a4d23..bfa57c0 100644 (file)
@@ -10,13 +10,21 @@ this one.
 
 =head1 Supported Environments
 
-Perl5.004 builds out of the box on Unix, Plan9, LynxOS, VMS, OS/2,
-QNX, and AmigaOS.
+Perl5.004 builds out of the box on Unix, Plan 9, LynxOS, VMS, OS/2,
+QNX, AmigaOS, and Windows NT.  Perl runs on Windows 95 as well, but it
+cannot be built there, for lack of a reasonable command interpreter.
 
 =head1 Core Changes
 
-Most importantly, many bugs were fixed.  See the F<Changes>
-file in the distribution for details.
+Most importantly, many bugs were fixed, including several security
+problems.  See the F<Changes> file in the distribution for details.
+
+=head2 List assignment to %ENV works
+
+C<%ENV = ()> and C<%ENV = @list> now work as expected (except on VMS
+where it generates a fatal error).
+
+=head2 "Can't locate Foo.pm in @INC" error now lists @INC
 
 =head2 Compilation option: Binary compatibility with 5.003
 
@@ -35,7 +43,7 @@ variable as if its contents had appeared on a "#!perl" line at the
 beginning of your script, except that hyphens are optional.  PERL5OPT
 may only be used to set the following switches: B<-[DIMUdmw]>.
 
-=head2 Limitations on B<-M>, and C<-m>, and B<-T> options
+=head2 Limitations on B<-M>, B<-m>, and B<-T> options
 
 The C<-M> and C<-m> options are no longer allowed on the C<#!> line of
 a script.  If a script needs a module, it should invoke it with the
@@ -71,7 +79,7 @@ your scripts.
 Before Perl 5.004, C<AUTOLOAD> functions were looked up as methods
 (using the C<@ISA> hierarchy), even when the function to be autoloaded
 was called as a plain function (e.g. C<Foo::bar()>), not a method
-(e.g. C<Foo->bar()> or C<$obj->bar()>).
+(e.g. C<Foo-E<gt>bar()> or C<$obj-E<gt>bar()>).
 
 Perl 5.005 will use method lookup only for methods' C<AUTOLOAD>s.
 However, there is a significant base of existing code that may be using
@@ -83,6 +91,13 @@ non-methods.  The simple fix for old code is:  In any module that used to
 depend on inheriting C<AUTOLOAD> for non-methods from a base class named
 C<BaseClass>, execute C<*AUTOLOAD = \&BaseClass::AUTOLOAD> during startup.
 
+=head2 Previously deprecated %OVERLOAD is no longer usable
+
+Using %OVERLOAD to define overloading was deprecated in 5.003.
+Overloading is now defined using the overload pragma. %OVERLOAD is
+still used internally but should not be used by Perl scripts. See
+L<overload> for more details.
+
 =head2 Subroutine arguments created only when they're modified
 
 In Perl 5.004, nonexistent array and hash elements used as subroutine
@@ -91,9 +106,9 @@ assigned to (via C<@_>).
 
 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.
+Perl versions 5.000 and 5.001 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:
 
@@ -157,6 +172,33 @@ previously-working script to now fail -- which should be construed
 as a blessing, since that indicates a potentially-serious security
 hole was just plugged.
 
+The new restrictions when tainting include:
+
+=over
+
+=item No glob() or <*>
+
+These operators may spawn the C shell (csh), which cannot be made
+safe.  This restriction will be lifted in a future version of Perl
+when globbing is implemented without the use of an external program.
+
+=item No spawning if tainted $CDPATH, $ENV, $BASH_ENV
+
+These environment variables may alter the behavior of spawned programs
+(especially shells) in ways that subvert security.  So now they are
+treated as dangerous, in the manner of $IFS and $PATH.
+
+=item No spawning if tainted $TERM doesn't look like a terminal name
+
+Some termcap libraries do unsafe things with $TERM.  However, it would be
+unnecessarily harsh to treat all $TERM values as unsafe, since only shell
+metacharacters can cause trouble in $TERM.  So a tainted $TERM is
+considered to be safe if it contains only alphanumerics, underscores,
+dashes, and colons, and unsafe if it contains other characters (including
+whitespace).
+
+=back
+
 =head2 New Opcode module and revised Safe module
 
 A new Opcode module supports the creation, manipulation and
@@ -181,8 +223,8 @@ it is now merely a front end to the IO::* modules -- specifically,
 IO::Handle, IO::Seekable, and IO::File.  We suggest, but do not
 require, that you use the IO::* modules in new code.
 
-In harmony with this change, C<*GLOB{FILEHANDLE}> is now a
-backward-compatible synonym for C<*STDOUT{IO}>.
+In harmony with this change, C<*GLOB{FILEHANDLE}> is now just a
+backward-compatible synonym for C<*GLOB{IO}>.
 
 =head2 Internal change: PerlIO abstraction interface
 
@@ -200,11 +242,11 @@ A subroutine reference may now be suffixed with an arrow and a
 (possibly empty) parameter list.  This syntax denotes a call of the
 referenced subroutine, with the given parameters (if any).
 
-This new syntax follows the pattern of C<$hashref-E<gt>{FOO}> and
-C<$aryref-E<gt>[$foo]>; now, C<&$subref($foo)> may now be written
-C<$subref-E<gt>($foo)>.  All of these arrow terms may be chained;
-thus, C<&{$table-E<gt>{FOO}}($bar)> may now be written
-C<$table-E<gt>{FOO}->($bar)>.
+This new syntax follows the pattern of S<C<$hashref-E<gt>{FOO}>> and
+S<C<$aryref-E<gt>[$foo]>>: You may now write S<C<&$subref($foo)>> as
+S<C<$subref-E<gt>($foo)>>.  All of these arrow terms may be chained;
+thus, S<C<&{$table-E<gt>{FOO}}($bar)>> may now be written
+S<C<$table-E<gt>{FOO}-E<gt>($bar)>>.
 
 =back
 
@@ -279,8 +321,8 @@ The new conversions in Perl's sprintf() are:
 
    %i  a synonym for %d
    %p  a pointer (the address of the Perl value, in hexadecimal)
-   %n  special: B<stores> into the next variable in the parameter
-        list the number of characters printed so far
+   %n  special: *stores* the number of characters output so far
+        into the next variable in the parameter list 
 
 The new flags that go between the C<%> and the conversion are:
 
@@ -414,25 +456,16 @@ of course, or if you want a seed other than the default.
 Functions documented in the Camel to default to $_ now in
 fact do, and all those that do are so documented in L<perlfunc>.
 
-=item C<m//g> does not reset search position on failure
-
-The C<m//g> match iteration construct used to reset its target string's
-search position (which is visible through the C<pos> operator) when a
-match failed; as a result, the next C<m//g> match would start at the
-beginning of the string).  With Perl 5.004, the search position must be
-reset explicitly, as with C<pos $str = 0;>, or by modifying the target
-string.  This change in Perl makes it possible to chain matches together
-in conjunction with the C<\G> zero-width assertion.  See L<perlop> and
-L<perlre>.
+=item C<m//gc> does not reset search position on failure
 
-Here is an illustration of what it takes to get the old behavior:
-
-    for ( qw(this and that are not what you think you got) ) {
-        while ( /(\w*t\w*)/g ) { print "t word is: $1\n" }
-        pos = 0;  # REQUIRED FOR 5.004
-        while ( /(\w*a\w*)/g ) { print "a word is: $1\n" }
-        print "\n";
-    }
+The C<m//g> match iteration construct has always reset its target
+string's search position (which is visible through the C<pos> operator)
+when a match fails; as a result, the next C<m//g> match after a failure
+starts again at the beginning of the string.  With Perl 5.004, this
+reset may be disabled by adding the "c" (for "continue") modifier,
+i.e. C<m//gc>.  This feature, in conjunction with the C<\G> zero-width
+assertion, makes it possible to chain matches together.  See L<perlop>
+and L<perlre>.
 
 =item C<m//x> ignores whitespace before ?*+{}
 
@@ -451,16 +484,16 @@ right.  They do now.
 Just like anonymous functions that contain lexical variables
 that change (like a lexical index variable for a C<foreach> loop),
 formats now work properly.  For example, this silently failed
-before, and is fine now:
+before (printed only zeros), but is fine now:
 
     my $i;
     foreach $i ( 1 .. 10 ) {
-       format =
+       write;
+    }
+    format =
        my i is @#
        $i
     .
-       write;
-    }
 
 =back
 
@@ -664,6 +697,42 @@ 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 reallocated.
 
+=head1 Support for More Operating Systems
+
+Support for the following operating systems is new in Perl 5.004.
+
+=head2 Win32
+
+Perl 5.004 now includes support for building a "native" perl under
+Windows NT, using the Microsoft Visual C++ compiler (versions 2.0
+and above) or the Borland C++ compiler (versions 5.02 and above).
+The resulting perl can be used under Windows 95 (if it
+is installed in the same directory locations as it got installed
+in Windows NT).  This port includes support for perl extension
+building tools like L<MakeMaker> and L<h2xs>, so that many extensions
+available on the Comprehensive Perl Archive Network (CPAN) can now be
+readily built under Windows NT.  See http://www.perl.com/ for more
+information on CPAN, and L<README.win32> for more details on how to
+get started with building this port.
+
+There is also support for building perl under the Cygwin32 environment.
+Cygwin32 is a set of GNU tools that make it possible to compile and run
+many UNIX programs under Windows NT by providing a mostly UNIX-like 
+interface for compilation and execution.  See L<README.cygwin32> for
+more details on this port, and how to obtain the Cygwin32 toolkit.
+
+=head2 Plan 9
+
+See L<README.plan9>.
+
+=head2 QNX
+
+See L<README.qnx>.
+
+=head2 AmigaOS
+
+See L<README.amigaos>.
+
 =head1 Pragmata
 
 Six new pragmatic modules exist:
@@ -932,6 +1001,19 @@ For example, you can now say
 
 =head1 Utility Changes
 
+=head2 pod2html
+
+=over
+
+=item Sends converted HTML to standard output
+
+The I<pod2html> utility included with Perl 5.004 is entirely new.
+By default, it sends the converted HTML to its standard output,
+instead of writing it to a file like Perl 5.003's I<pod2html> did.
+Use the B<--outfile=FILENAME> option to write to a file.
+
+=back
+
 =head2 xsubpp
 
 =over
@@ -1006,6 +1088,10 @@ new pods are included in section 1:
 
 This document.
 
+=item L<perlfaq>
+
+Frequently asked questions.
+
 =item L<perllocale>
 
 Locale support (internationalization and localization).
@@ -1018,6 +1104,11 @@ Tutorial on Perl OO programming.
 
 Perl internal IO abstraction interface.
 
+=item L<perlmodlib>
+
+Perl module library and recommended practice for module creation.
+Extracted from L<perlmod> (which is much smaller as a result).
+
 =item L<perldebug>
 
 Although not new, this has been massively updated.
@@ -1096,6 +1187,13 @@ that can no longer be found in the table.
 as an lvalue, which is pretty strange.  Perhaps you forgot to
 dereference it first.  See L<perlfunc/substr>.
 
+=item Can't redefine active sort subroutine %s
+
+(F) Perl optimizes the internal handling of sort subroutines and keeps
+pointers into them.  You tried to redefine one such sort subroutine when it
+was currently active, which is not allowed.  If you really want to do
+this, you should write C<sort { &func } @x> instead of C<sort func @x>.
+
 =item Can't use bareword ("%s") as %s ref while "strict refs" in use
 
 (F) Only hard references are allowed by "strict refs".  Symbolic references
@@ -1174,6 +1272,11 @@ empty (except that C<d_csh> should be C<'undef'>) so that Perl will
 think csh is missing.  In either case, after editing config.sh, run
 C<./Configure -S> and rebuild Perl.
 
+=item Invalid conversion in %s: "%s"
+
+(W) Perl does not understand the given format conversion.
+See L<perlfunc/sprintf>.
+
 =item Invalid type in pack: '%s'
 
 (F) The given character is not a valid pack type.  See L<perlfunc/pack>.
@@ -1220,6 +1323,10 @@ remaining memory (or virtual memory) to satisfy the request. However,
 the request was judged large enough (compile-time default is 64K), so
 a possibility to shut down by trapping this error is granted.
 
+=item panic: frexp
+
+(P) The library function frexp() failed, making printf("%f") impossible.
+
 =item Possible attempt to put comments in qw() list
 
 (W) qw() lists contain items separated by whitespace; as with literal
@@ -1452,4 +1559,4 @@ Constructed by Tom Christiansen, grabbing material with permission
 from innumerable contributors, with kibitzing by more than a few Perl
 porters.
 
-Last update: Sat Mar  8 19:51:26 EST 1997
+Last update: Wed May 14 11:14:09 EDT 1997