[ Team LiB ] Previous Section Next Section

24.2 What's New in Perl 5.6.0-5.8.0

As mentioned earlier, Perl 5.6.0 is the minimum requirement for mod_perl 2.0. However, certain new features work only with Perl 5.8.0 and higher.

The following are the important changes in the recent Perl versions that had an impact on mod_perl. For a complete list of changes, see the appropriate perldelta manpage. The 5.6 generation of Perl introduced the following features:

  • The beginnings of support for running multiple interpreters concurrently in different threads. In conjunction with the perl_clone( ) API call, which can be used to selectively duplicate the state of any given interpreter, it is possible to compile a piece of code once in an interpreter, clone that interpreter one or more times, and run all the resulting interpreters in distinct threads. See the perlembed and perl561delta manpages.

  • The core support for declaring subroutine attributes, which is used by mod_perl 2.0's method handlers (with the : method attribute). See the attributes manpage.

  • The warnings pragma, which allows programmers to force the code to be super clean, via the setting:

    use warnings FATAL => 'all';

    which will abort any code that generates warnings. This pragma also allows fine control over what warnings should be reported. See the perllexwarn manpage.

  • Certain CORE:: functions can now be overridden via the CORE::GLOBAL:: namespace. For example, mod_perl now can override exit( ) globally by defining CORE::GLOBAL::exit. So when exit( ) is called, CORE::GLOBAL::exit( ) gets invoked. Note that you can still use CORE::exit( ) to get the original behavior. See the perlsub manpage.

  • The XSLoader extension as a simpler alternative to DynaLoader. See the XSLoader manpage.

  • Large-file support. If you have filesystems that support files larger than 2 GB), you may now also be able to create and access them from Perl. See the perl561delta manpage.

  • Multiple performance enhancements. See the perl561delta manpage.

  • Numerous memory leaks were fixed. See the perl561delta manpage.

  • Improved security features: more potentially unsafe operations taint their results for improved security. See the perlsec and perl561delta manpages.

  • Perl is now available on new platforms: GNU/Hurd, Rhapsody/Darwin, and EPOC.

Overall, multiple bugs and problems were fixed in Perl 5.6.1, so if you plan on running the 5.6 generation, you should run at least 5.6.1. It is possible that when this book is released 5.6.2 will be out, which will then incorporate the bug fixes from Perl 5.8.0.

Perl 5.8.0 has introduced the following features:

  • The experimental PerlIO layer, introduced in 5.6.0, has been stabilized and become the default I/O layer in 5.8.0. Now the I/O stream can be filtered through multiple I/O layers. See the perlapio and perliol manpages.

    For example, this allows mod_perl to interoperate with the APR I/O layer and even use the APR I/O layer in Perl code. See the APR::PerlIO manpage.

    Another example of using this new feature is the extension of the open( ) functionality to create anonymous temporary files via:

    open my $fh, "+>", undef or die $!;

    That is a literal undef( ), not an undefined value. See the open( ) entry in the perlfunc manpage.

  • More keywords are now overridable via CORE::GLOBAL::. See the perlsub manpage.

  • The signal handling in Perl has been notoriously unsafe because signals have been able to arrive at inopportune moments, leaving Perl in an inconsistent state. Now Perl delays signal handling until it is safe.

  • File::Temp was added to allow creation of temporary files and directories in an easy, portable, and secure way. See the File::Temp manpage.

  • A new command-line option, -t, is available. It is the little brother of -T: instead of dying on taint violations, lexical warnings are given. This is meant only as a temporary debugging aid while securing the code of old legacy applications. It is not a substitute for -T. See the perlrun manpage.

  • A new special variable, ${^TAINT}, was introduced. It indicates whether taint mode is enabled. See the perlvar manpage.

  • Thread implementation is much improved since 5.6.0. The Perl interpreter should now be completely thread-safe, and 5.8.0 marks the arrival of the threads module, which allows Perl programs to work with threads (creating them, sharing variables, etc.).

  • Much better support for Unicode has been added.

  • Numerous bugs and memory leaks have been fixed. For example, now you can localize the tied Apache::DBI database handles without leaking memory.

  • Perl is now available on new platforms: AtheOS, Mac OS Classic, MinGW, NCR MP-RAS, NonStop-UX, NetWare, and UTS. Also, the following platforms are again supported: BeOS, DYNIX/ptx, POSIX-BC, VM/ESA, and z/OS (OS/390).

    [ Team LiB ] Previous Section Next Section