Great CPAN Modules
OO support in Perl 5 to provide a simpler way to write CGI scripts. CGI.pm also
included many new features, particularly extensive support for HTML generation.
The most obvious reason CGI.pm is so popular is that it represents a complete
solution to a difficult problem. Nearly every capability you could want in a CGI
environment is present, from parameter parsing to file uploads to cookie handling
to HTML form generation. All of these capabilities are documented clearly with
full examples of nearly every possible usage.
Another highlight is the interface design. Lincoln Stein has embraced
TMTOWTDI
6
to a degree that few have managed. For example, a critical task in
CGI is parameter parsing and processing. CGI.pm provides five different ways to
access the CGI parameters. Many of these are supplied to allow for backwards com
patibility with older libraries and older versions of CGI.pm. Stein has always focused
on keeping older scripts working even as he enhances CGI.pm with new features.
Furthermore, CGI.pm provides its functionality through both object oriented
and functional interfaces. This is accomplished by starting each and every sub
routine in CGI.pm as follows:
sub method_foo {
my($self,@p) = self_or_default(@_);
The self_or_default() routine extracts $self from @_, or if $self is not found uses a
globally defined CGI object instead. This means that users can pick either an
object oriented style:
use CGI;
my $cgi = CGI >new;
print join "\n", $cgi >param();
or functional calling style:
use CGI qw(param);
print join "\n", param();
People writing quick scripts can benefit from the brevity of the functional inter
face, whereas those developing more intensive CGI code can benefit from the
extensibility of the OO interface.
6. Short for There's more than one way to do it.
16
167
7
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved