Putting It All Together
- HTTP Transactions
- Perl5 and the WWW Libraries in Action
- Example 1: Creating Forms with CGI.pm
- Example 2: Open a New Browser Window
- Example 3: Upload a File to the Server
- Example 4: Using CGI::Carp to Debug Scripts
- Using the HTTP::Request Module Directly
The first step to mastering CGI programming and creating useful and dynamic programs is understanding what goes on when your CGI script is run. The transaction that occurs between the Web server and the browser before your script is run--and the data that is transferred back and forth during this transaction--is the only input your script has. Thus understanding exactly how something occurs and what occurs during this transaction is crucial.
After looking at all that happens during the transaction, we'll focus on how Perl5 modular libraries such as CGI.pm and the libwww modules can be used to greatly simplify and enhance
programming CGI scripts. CGI.pm and the libwww modules provide simple APIs (applications programming interfaces) which allow you to supply a few simple arguments to a supported Web-related function. The module then generates appropriate HTML output for you. Tasks such as creating HTML forms, imagemaps, and headers are just a few of the tasks enhanced by using these Perl5 modules in your program.