13.9. CGI.pm

We've mentioned CGI.pm several times, but now it's time to address it in more depth. This module provides a functional interface to generating HTML,[5] an object-oriented or functional interface to processing form inputs, and functions for supporting every other conceivable operation associated with user interaction through CGI. If you're concerned about performance—taking into account Perl of Wisdom #33—then you'll want to look into options like mod_perl, FastCGI, and CGI::Lite. These are outside the scope of this book, here are some references to them:

[5] And even makes it XHTML-compliant in recent versions.

Writing code to handle the CGI protocol is harder than it looks; writing it yourself instead of using CGI.pm is like making whipped cream with a fork while a shiny electric mixer stands idly by.[6] We will just touch on the debugging issues here; for comprehensive documentation on CGI.pm check out:

[6] It can be done, but it's murder on the elbows.

  • Official Guide to Programming with CGI.pm, by Lincoln Stein (Wiley, 1998)

  • CGI Programming with Perl, 2nd ed., by Scott Guelich, Shishir Gundavaram, and Gunther Birznieks (O'Reilly, 2000)

If anyone is going to inspect the HTML generated by a CGI.pm program—either for command line debugging or for viewing the source from a Web browser—you may want to change the use CGI statement to use CGI::Pretty. This will insert line breaks and indentation to create, well, pretty output.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset