10.2. Importing Method Groups
The syntax for calling CGI methods can be unwieldy. However, if you choose not to use the object form of CGI.pm, you can import individual methods instead. The "birthday" example shown earlier could be written even more simply as:
#!/usr/local/bin/perl -w use CGI qw(param header p); my $bday = param("birthday"); print header('text/plain'); print "Your birthday is $bday.";
By importing the param, header, and p methods into your namespace, you no longer have to use the new constructor (since it is called automatically now), and you don't need to specify a CGI object with every method call.
CGI.pm also lets you import groups of methods, which can make your programs much simpler and more elegant. For example, to import all form-creation methods and all CGI-handling methods:
use CGI qw/:form :cgi/;
The method groups supported by CGI.pm are:
Copyright © 2002 O'Reilly & Associates. All rights reserved.