Lesson 6 - Common Tasks
Lesson Outline
Download

Required Reading
- CGI
101: Chapter
6, Chapter 7, and Chapter 11
- WWW: Sending
Email using Perl and Sendmail
- CGI
101: Chapter 8, Chapter 10, Chapter 12, Chapter
13, Chapter 14 (these chapters spend a lot of time explaining
the perl syntax, just skim these to understand how these
topics apply to CGI scripts; see the outline for key points)
Additional Resources
Remember that sendmail is not always available on NT systems.
On NT, you might have Blat or WinMail, or you might have to
work directly with the SMTP protocol, as done in this
library from Extropia
or in this afm.cgi script.
The perl
recipes from the Effective
Perl Programming website are worth a bookmark. Don't spin
your wheels trying to figure out how to sort a list ever again!
I also like the perl
tips & tricks section of about.com,
but my most well-worn resources is The
Perl Cookbook. I just ordered the CGI/Perl
Cookbook, but I haven't had much chance to browse it.
Some other common tasks, although not really CGI-specific,
are setting up htaccess
password protection and configuring
cron jobs.
Perl.com has more information
about using flock in their perl/CGI
FAQ, but keep in mind that it is not available on all
servers. The do-it-yourself approach to file locking is to
create temporary files as "locks." Take a look at
this exerpt from Extropia's
Web Store to see how they implement file
locking. A similar routine was used in the guestbook script
you installed in project
3 (look in the cgi-lib.sol library).
I can't emphasize enough how important file locking is with
CGI scripts. I had one client with a counter gone haywire
and it turned out the script had a poorly-written locking
algorithm. Can you spot the trouble with this simple
counter script? Here is my revised
version.
For an example of a "brute force" search engine,
check out Matt's
Simple Search. Perlfect,
on the other hand, uses a site indexing approach which is
much more efficient for large sites.
Next Step
Take the self-quiz
Complete project 4
Continue to lesson 7
Jump
to Forums [Lesson 6]
|