CGI and Perl

Souped-Up Regular Expressions

The Perl regular expression--and its associated functions--remains one of the most powerful and useful features of the overall language.

A Convention

The words "Regular Expression" from here on may be shortened to "RE."

All of the older Perl4 RE functionality remains in Perl5, and several capabilities have been added.

Possibly the most interesting and usable of the newer features is the extension syntax that is now available for regular expressions. The extensions that are currently available with Perl5 enable you to embed comments in your pattern, do grouping without backreferences, perform zero-width positive lookahead assertions, and even have embedded pattern-match modifiers. See PERLRE for details on all the powerful new RE features.

Enhanced Safety and Security

Perl5 integrates the TAINT features into the single Perl binary. All the runtime checks and assurances remain when executing an SUID script, and you can even turn on the TAINT features from the command line by using the -T switch. No additional binaries need to be executed when running an SUID script. Naturally, this applies only to architectures that support multiple user IDs, such as UNIX, and safe SUID scripts. See PERLSEC for more details.

Warning! SUIDPERL patch is necessary for older versions.

We'll mention this again in the security chapter, but it's important enough to say right now. If you're using SUIDPERL, you need to be sure to apply the patch that was released with Version 5.003. There's also a patch for older Perl4 SUIDPERL versions. You can get the patch at your nearest CPAN.

A large number of new Perl modules provide the programmer with a rich new toolset for dealing with security issues. Some modules provide encryption and WWW administrative tasks, whereas other modules enhance standard system administration programming tasks. Probably the most important security module is the Safe module, which allows you to selectively enable or disable certain Perl operations within a program. You learn more about these modules in Chapter 3, "Security on the Web."

by BrainBellupdated