Приглашаем посетить
Клюев (klyuev.lit-info.ru)

7.3 Perl 5.000

Previous Table of Contents Next

7.3 Perl 5.000

At this point it's no longer useful to point out what each version of Perl lacked, so from now on I'll say what they added. Yes, there were several subversions of each of these major versions, but I'll just consider the last one in each case. Although many changes went into each release of Perl, I will just mention the major features noticeable at the level of writing code. Much more was visible to programmers of embedded applications, for instance. There were many other changes made behind the scenes; for instance, Perl 5.8.1 randomizes the order of hash elements from one run to the next to defeat potential denial-of-service attacks.

Perl 5.000 of course added the object-oriented system, modules, pragmas, lexical variables, and references, to name only a few features.

7.3.1 Upgrading to Perl 5.000

Add use strict and ensure that all barewords that are implicit strings are quoted. Make all user variables lexical (declare them with my). Do list transformation with map() instead of temporary arrays. Turn symbolic references into hard references. Look for lengthy subroutine parameter lists and analyze the information flow to see where you can construct object classes. Look for lengthy operations that can be replaced by calls to core or CPAN modules.

If the program requires a customized perl built from Perl source and additional code, look for a CPAN module that does the same job or convert the additional code to XS and write a dynamically loadable module. Alternatively, small amounts of foreign code can be included directly and transparently in a Perl program using the Inline:: series of modules (Inline::C, Inline::Java, Inline::Python, etc.).

    Previous Table of Contents Next