|
NAMEperl5005delta - what's new for perl5.005DESCRIPTIONThis document describes differences between the 5.004 release and this one.About the new versioning systemPerl is now developed on two tracks: a maintenance track that makes small, safe updates to released production versions with emphasis on compatibility; and a development track that pursues more aggressive evolution. Maintenance releases (which should be considered production quality) have subversion numbers that run from 1 to 49, and development releases (which should be considered "alpha" quality) run from 50 to 99.Perl 5.005 is the combined product of the new dual-track development scheme. Incompatible ChangesWARNING: This version is not binary compatible with Perl 5.004.Starting with Perl 5.004_50 there were many deep and far-reaching changes to the language internals. If you have dynamically loaded extensions that you built under perl 5.003 or 5.004, you can continue to use them with 5.004, but you will need to rebuild and reinstall those extensions to use them 5.005. See INSTALL for detailed instructions on how to upgrade.Default installation structure has changedThe new Configure defaults are designed to allow a smooth upgrade from 5.004 to 5.005, but you should read INSTALL for a detailed discussion of the changes in order to adapt them to your system.Perl Source CompatibilityWhen none of the experimental features are enabled, there should be very few user-visible Perl source compatibility issues.If threads are enabled, then some caveats apply. @_ and $_ become lexical variables. The effect of this should be largely transparent to the user, but there are some boundary conditions under which user will need to be aware of the issues. For example, "local(@_)" results in a "Can't localize lexical variable @_ ..." message. This may be enabled in a future version. Some new keywords have been introduced. These are generally expected to have very little impact on compatibility. See "New "INIT" keyword", "New "lock" keyword", and "New "qr//" operator". Certain barewords are now reserved. Use of these will provoke a warning if you have asked for them with the "-w" switch. See ""our" is now a reserved word". C Source CompatibilityThere have been a large number of changes in the internals to support the new features in this release.
Binary CompatibilityThis version is NOT binary compatible with older versions. All extensions will need to be recompiled. Further binaries built with threads enabled are incompatible with binaries built without. This should largely be transparent to the user, as all binary incompatible configurations have their own unique architecture name, and extension binaries get installed at unique locations. This allows coexistence of several configurations in the same directory hierarchy. See INSTALL.Security fixes may affect compatibilityA few taint leaks and taint omissions have been corrected. This may lead to "failure" of scripts that used to work with older versions. Compiling with -DINCOMPLETE_TAINTS provides a perl with minimal amounts of changes to the tainting behavior. But note that the resulting perl will have known insecurities.Oneliners with the "-e" switch do not create temporary files anymore. Relaxed new mandatory warnings introduced in 5.004Many new warnings that were introduced in 5.004 have been made optional. Some of these warnings are still present, but perl's new features make them less often a problem. See "New Diagnostics".LicensingPerl has a new Social Contract for contributors. See Porting/Contract.The license included in much of the Perl documentation has changed. Most of the Perl documentation was previously under the implicit GNU General Public License or the Artistic License (at the user's choice). Now much of the documentation unambiguously states the terms under which it may be distributed. Those terms are in general much less restrictive than the GNU GPL. See perl and the individual perl manpages listed therein. Core ChangesThreadsWARNING: Threading is considered an experimental feature. Details of the implementation may change without notice. There are known limitations and some bugs. These are expected to be fixed in future versions.See README.threads. CompilerWARNING: The Compiler and related tools are considered experimental. Features may change without notice, and there are known limitations and bugs. Since the compiler is fully external to perl, the default configuration will build and install it.The Compiler produces three different types of transformations of a perl program. The C backend generates C code that captures perl's state just before execution begins. It eliminates the compile-time overheads of the regular perl interpreter, but the run-time performance remains comparatively the same. The CC backend generates optimized C code equivalent to the code path at run-time. The CC backend has greater potential for big optimizations, but only a few optimizations are implemented currently. The Bytecode backend generates a platform independent bytecode representation of the interpreter's state just before execution. Thus, the Bytecode back end also eliminates much of the compilation overhead of the interpreter. The compiler comes with several valuable utilities. "B::Lint" is an experimental module to detect and warn about suspicious code, especially the cases that the "-w" switch does not detect. "B::Deparse" can be used to demystify perl code, and understand how perl optimizes certain constructs. "B::Xref" generates cross reference reports of all definition and use of variables, subroutines and formats in a program. "B::Showlex" show the lexical variables used by a subroutine or file at a glance. "perlcc" is a simple frontend for compiling perl. See "ext/B/README", B, and the respective compiler modules. Regular ExpressionsPerl's regular expression engine has been seriously overhauled, and many new constructs are supported. Several bugs have been fixed.Here is an itemized summary:
See perlre and perlop. Improved malloc()See banner at the beginning of "malloc.c" for details.Quicksort is internally implementedPerl now contains its own highly optimized qsort() routine. The new qsort() is resistant to inconsistent comparison functions, so Perl's "sort()" will not provoke coredumps any more when given poorly written sort subroutines. (Some C library "qsort()"s that were being used before used to have this problem.) In our testing, the new "qsort()" required the minimal number of pair-wise compares on average, among all known "qsort()" implementations.See "perlfunc/sort". Reliable signalsPerl's signal handling is susceptible to random crashes, because signals arrive asynchronously, and the Perl runtime is not reentrant at arbitrary times.However, one experimental implementation of reliable signals is available when threads are enabled. See "Thread::Signal". Also see INSTALL for how to build a Perl capable of threads. Reliable stack pointersThe internals now reallocate the perl stack only at predictable times. In particular, magic calls never trigger reallocations of the stack, because all reentrancy of the runtime is handled using a "stack of stacks". This should improve reliability of cached stack pointers in the internals and in XSUBs.More generous treatment of carriage returnsPerl used to complain if it encountered literal carriage returns in scripts. Now they are mostly treated like whitespace within program text. Inside string literals and here documents, literal carriage returns are ignored if they occur paired with linefeeds, or get interpreted as whitespace if they stand alone. This behavior means that literal carriage returns in files should be avoided. You can get the older, more compatible (but less generous) behavior by defining the preprocessor symbol "PERL_STRICT_CR" when building perl. Of course, all this has nothing whatever to do with how escapes like "\r" are handled within strings.Note that this doesn't somehow magically allow you to keep all text files in DOS format. The generous treatment only applies to files that perl itself parses. If your C compiler doesn't allow carriage returns in files, you may still be unable to build modules that need a C compiler. Memory leaks"substr", "pos" and "vec" don't leak memory anymore when used in lvalue context. Many small leaks that impacted applications that embed multiple interpreters have been fixed.Better support for multiple interpretersThe build-time option "-DMULTIPLICITY" has had many of the details reworked. Some previously global variables that should have been per-interpreter now are. With care, this allows interpreters to call each other. See the "PerlInterp" extension on CPAN.Behavior of local() on array and hash elements is now well-definedSee "Temporary Values via local()" in perlsub."%!" is transparently tied to the Errno moduleSee perlvar, and Errno.Pseudo-hashes are supportedSee perlref."EXPR foreach EXPR" is supportedSee perlsyn.Keywords can be globally overriddenSee perlsub.$^E is meaningful on Win32See perlvar."foreach (1..1000000)" optimized"foreach (1..1000000)" is now optimized into a counting loop. It does not try to allocate a 1000000-size list anymore."Foo::" can be used as implicitly quoted package nameBarewords caused unintuitive behavior when a subroutine with the same name as a package happened to be defined. Thus, "new Foo @args", use the result of the call to "Foo()" instead of "Foo" being treated as a literal. The recommended way to write barewords in the indirect object slot is "new Foo:: @args". Note that the method "new()" is called with a first argument of "Foo", not "Foo::" when you do that."exists $Foo::{Bar::}" tests existence of a packageIt was impossible to test for the existence of a package without actually creating it before. Now "exists $Foo::{Bar::}" can be used to test if the "Foo::Bar" namespace has been created.Better locale supportSee perllocale.Experimental support for 64-bit platformsPerl5 has always had 64-bit support on systems with 64-bit longs. Starting with 5.005, the beginnings of experimental support for systems with 32-bit long and 64-bit 'long long' integers has been added. If you add -DUSE_LONG_LONG to your ccflags in config.sh (or manually define it in perl.h) then perl will be built with 'long long' support. There will be many compiler warnings, and the resultant perl may not work on all systems. There are many other issues related to third-party extensions and libraries. This option exists to allow people to work on those issues.prototype() returns useful results on builtinsSee "prototype" in perlfunc.Extended support for exception handling"die()" now accepts a reference value, and $@ gets set to that value in exception traps. This makes it possible to propagate exception objects. This is an undocumented experimental feature.Re-blessing in DESTROY() supported for chaining DESTROY() methodsSee "Destructors" in perlobj.All "printf" format conversions are handled internallySee "printf" in perlfunc.New "INIT" keyword"INIT" subs are like "BEGIN" and "END", but they get run just before the perl runtime begins execution. e.g., the Perl Compiler makes use of "INIT" blocks to initialize and resolve pointers to XSUBs.New "lock" keywordThe "lock" keyword is the fundamental synchronization primitive in threaded perl. When threads are not enabled, it is currently a noop.To minimize impact on source compatibility this keyword is "weak", i.e., any user-defined subroutine of the same name overrides it, unless a "use Thread" has been seen. New "qr//" operatorThe "qr//" operator, which is syntactically similar to the other quote-like operators, is used to create precompiled regular expressions. This compiled form can now be explicitly passed around in variables, and interpolated in other regular expressions. See perlop."our" is now a reserved wordCalling a subroutine with the name "our" will now provoke a warning when using the "-w" switch.Tied arrays are now fully supportedSee Tie::Array.Tied handles support is betterSeveral missing hooks have been added. There is also a new base class for TIEARRAY implementations. See Tie::Array.4th argument to substrsubstr() can now both return and replace in one operation. The optional 4th argument is the replacement string. See "substr" in perlfunc.Negative LENGTH argument to splicesplice() with a negative LENGTH argument now work similar to what the LENGTH did for substr(). Previously a negative LENGTH was treated as 0. See "splice" in perlfunc.Magic lvalues are now more magicalWhen you say something like "substr($x, 5) = "hi"", the scalar returned by substr() is special, in that any modifications to it affect $x. (This is called a 'magic lvalue' because an 'lvalue' is something on the left side of an assignment.) Normally, this is exactly what you would expect to happen, but Perl uses the same magic if you use substr(), pos(), or vec() in a context where they might be modified, like taking a reference with "\" or as an argument to a sub that modifies @_. In previous versions, this 'magic' only went one way, but now changes to the scalar the magic refers to ($x in the above example) affect the magic lvalue too. For instance, this code now acts differently:$x = "hello"; sub printit { $x = "g'bye"; print $_[0], "\n"; } printit(substr($x, 0, 5)); In previous versions, this would print "hello", but it now prints "g'bye". <> now reads in recordsIf $/ is a reference to an integer, or a scalar that holds an integer, <> will read in records instead of lines. For more info, see "$/" in perlvar.Supported PlatformsConfigure has many incremental improvements. Site-wide policy for building perl can now be made persistent, via Policy.sh. Configure also records the command-line arguments used in config.sh.New PlatformsBeOS is now supported. See README.beos.DOS is now supported under the DJGPP tools. See README.dos (installed as perldos on some systems). MiNT is now supported. See README.mint. MPE/iX is now supported. See README.mpeix. MVS (aka OS390, aka Open Edition) is now supported. See README.os390 (installed as perlos390 on some systems). Stratus VOS is now supported. See README.vos. Changes in existing supportWin32 support has been vastly enhanced. Support for Perl Object, a C++ encapsulation of Perl. GCC and EGCS are now supported on Win32. See README.win32, aka perlwin32.VMS configuration system has been rewritten. See README.vms (installed as README_vms on some systems). The hints files for most Unix platforms have seen incremental improvements. Modules and PragmataNew Modules
Changes in existing modules
Utility Changes"h2ph" and related utilities have been vastly overhauled."perlcc", a new experimental front end for the compiler is available. The crude GNU "configure" emulator is now called "configure.gnu" to avoid trampling on "Configure" under case-insensitive filesystems. "perldoc" used to be rather slow. The slower features are now optional. In particular, case-insensitive searches need the "-i" switch, and recursive searches need "-r". You can set these switches in the "PERLDOC" environment variable to get the old behavior. Documentation ChangesConfig.pm now has a glossary of variables.Porting/patching.pod has detailed instructions on how to create and submit patches for perl. perlport specifies guidelines on how to write portably. perlmodinstall describes how to fetch and install modules from "CPAN" sites. Some more Perl traps are documented now. See perltrap. perlopentut gives a tutorial on using open(). perlreftut gives a tutorial on references. perlthrtut gives a tutorial on threads. New Diagnostics
Obsolete Diagnostics
Configuration ChangesYou can use "Configure -Uinstallusrbinperl" which causes installperl to skip installing perl also as /usr/bin/perl. This is useful if you prefer not to modify /usr/bin for some reason or another but harmful because many scripts assume to find Perl in /usr/bin/perl.BUGSIf you find what you think is a bug, you might check the headers of recently posted articles in the comp.lang.perl.misc newsgroup. There may also be information at http://www.perl.com/perl/ , the Perl Home Page.If you believe you have an unreported bug, please run the perlbug program included with your release. Make sure you trim your bug down to a tiny but sufficient test case. Your bug report, along with the output of "perl -V", will be sent off to <perlbug@perl.com> to be analysed by the Perl porting team. SEE ALSOThe Changes file for exhaustive details on what changed.The INSTALL file for how to build Perl. The README file for general stuff. The Artistic and Copying files for copyright information. HISTORYWritten by Gurusamy Sarathy <gsar@activestate.com>, with many contributions from The Perl Porters.Send omissions or corrections to <perlbug@perl.com>.
Visit the GSP FreeBSD Man Page Interface. |