Appendix B

Perl Web Reference


CONTENTS

Perl has become very popular, both because of its ease of use in proportion to its capability and because it is freely and easily available for many different operating systems. Appendix A, "Perl Acquisition and Installation," describes where you can access Perl for your operating system and provides some installation instructions for some of the most popular operating systems. This appendix lists some of the Internet sites where you can get Perl-related libraries, scripts, documents, and other goodies.

The first section describes usenets that you can browse through and pick up useful information. Additionally, any time you have a question on Perl or on CGI programming, you can post to one of these groups and usually get at least one response within eight hours.

The second section describes sites that have useful Web-, CGI-, and Perl-related libraries, samples, code, and documentation that can be extremely helpful. The sites might also include libraries for database access and for other important Internet and intranet activities.

The last section describes sites that have useful Perl libraries, samples, code, and documentation that are not necessarily Web-related.

TIP
If you are new to CGI programming with Perl, you will want to visit each of the sites listed in this appendix. Doing so will give you a good understanding of what scripts, libraries, modules, and documentation are available (in addition to this book) to help you become a great CGI programmer. As you visit the sites, jot down the downloadable files that interest you, including their versions and the date. When you finish visiting the sites, you will know where to access the most recent tools, and you can begin to download and build your own CGI development library.

Perl, Web, and CGI-Related Usenets

One of the most useful Perl-related sites is comp.lang.perl. This site is the one that you will most likely post to when you have a perl-language problem or general perl-language question. Now that I've said that, I want to recommend yet another extremely useful site, which is comp.lang.perl.misc. If comp.lang.perl does not have what you need, comp.lang.perl.misc probably will, especially in regard to Perl on various operating systems and Perl in comparison with other tools, such as Tcl. Both of these sites are useful and should be on your subscribe-to list. Before you post at either of these usenets, you might want to read the Perl FAQ at http://www.perl.com/perl/faq/. In addition, this site points you to other FAQs.

To see the latest Perl-related announcements, check out comp.lang.perl.announce. You should also check out the CPAN sites (listed in Appendix A and repeated later in this appendix) for announcements of new releases. In addition, you can find archives of this usenet at any of the CPAN sites, in the /CLPA subdirectory.

The usenet comp.lang.perl.modules is very helpful if you want to check out what modules are available and how they are being used, if you have questions about or problems with existing Perl modules, or if you want to ask about the existence of modules to support a particular need.

The last perl-specific usenet is comp.lang.perl.tk. Tk is an interface tool (developed by Sun) primarily for use with Tcl, an embeddable scripting language. Tk extensions to Perl 5.0 have been made to allow integration. If you are interested in using both tools, you definitely want to check out this usenet. You also can find a FAQ for this usenet at http://w4.lns.cornell.edu/~pvhp/ptk/ptkFAQ.html.

Another useful usenet is comp.infosystems.www.authoring.cgi. This group contains many references to CGI programming with Perl, which is still one of the most popular approaches. You will want to glance through all the usenets that begin with comp.infosystems.www to find those that best meet your needs.

Table B.1 recaps the usenets discussed in this section.

Table B.1  Web Programming with Perl Usenets

Usenet NameSubject
comp.lang.perlGeneral perl language discussions
comp.lang.perl.miscGeneral perl language and tool discussions
comp.lang.perl.announcePerl-related announcements
comp.lang.perl.tkPerl/Tk integration discussions
comp.infosystems.www.CGI issues in Web authoring authoring.cgi

Web-Related Perl and CGI Sites

The following sites are terrific places to visit to build up your CGI script library. In addition, the sites give you an idea of what you can use or modify for your own use. You will be amazed by the amount of freeware and shareware that is available.

Yahoo

One of the best places to begin a search for information or files is Yahoo (see fig. B.1), which is one of the best organized and most comprehensive search sites on the Web. You can access Yahoo at http://www.yahoo.com.

Figure B.1 : This figure shows the Yahoo WWW site.

To find several sources that have Perl-related information, access Yahoo's site on Perl programming at http://www.yahoo.com/Computers_and_Internet/Programming_Languages/Perl/. You can access information on CGI programming in general by starting at http://www.yahoo.com/Computers_and_Internet/Internet/World_Wide_Web/CGI_Common_Gateway_Interface/. In addition, you can access http://www.yahoo.com/Computers_and_Internet/Internet/World_Wide_Web/Programming/ to find information that is specific to programming on the Web, including a section on Perl scripts.

The cgi-lib.pl Home Page

One of the most important libraries for CGI development with Perl is cgi-lib.pl, created by Steven Brenner. You can find this simple, easy-to-use library-as well as instructions on its use and examples of using it-at http://www.bio.cam.ac.uk/cgi-lib/. The library includes functions such as ReadParse (which parses the data passed to the script from the form) and HtmlTop/HtmlBot, which print specific <HEAD> and end-of <BODY> sections of an HTML document. This library, which works with Perl 4.0 and Perl 5.0, is a must to review and use.

cgi.pm

cgi.pm is another CGI perl library that provides powerful functions for performing CGI programming with perl. This library, which requires Perl 5.001m, uses Perl 5.0 objects for Web-related activity. This library is another must for your perl-library list. Access the documentation, source code, and samples at http://www-genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html.

The CGI Collection

This site has a set of scripts, some of which were created with perl and some of which were created with C. Table B.2 lists some of the scripts that you can find at this site. In particular, check out the simple script Logger.cgi, which performs a very useful function. You can reach the site at http://www.selah.net/cgi.html.

Table B.2  The CGI Collection Scripts

Script/ModuleCovers
MailForm.cgiCustomizable mail-form CGI script
Guestbook.cgiGuestbook CGI script
Logger.cgiSimple script that logs visitors
FrameChatOdd little application that implements a frames-based chat service (requires Perl 5.0)

HFPM Home Page

Sites such as this one mean that CGI/Perl programmers will have an easier time. The modules provided at this site take form contents; perform some processing; and output the result to e-mail, a file, or communication with the Web page reader, or return a new URL. You need Perl 5.0 and a UNIX-based system to use the modules listed at this site. You also need a copy of cgi.pm (discussed earlier in this chapter), as well as pipeline.pl (which is available with the HFPM distribution).

You can reach the site at http://seclab.cs.ucdavis.edu/~hoagland/hfpm/.

Selina Sol's CGI Script Archive

This attractive and very useful site contains links to many fairly sophisticated CGI scripts, such as Web Chat 1.0, a slide-show script, a guestbook script, and a complete shopping-cart example. This site not only provides the sample scripts, but also allows you to see them in action. In addition, you can view the HTML and other documents that the examples use. The examples are fully documented and easy to understand.

This site is a must-visit site; you can reach it at http://www2.eff.org/~erict/Scripts/. Table B.3 lists some of the samples and describes what they do.

Table B.3  Selina Sol's CGI Script Examples

ExampleDescription
Selena Sol's Electronic Outlet 2.0 (database) Complete set of files to implement a databaselike shopping-cart system
Selena Sol's Electronic Outlet 2.0 (HTML) Same as preceding example, but HTML-based
Cool Runnings Music CatalogShopping-cart concept for catalogs
The Form ProcessorProcesses form input, using hidden variables
Database Manager 2.0Flat-file database management tool
Database Search Engine 1.0Search engine for Database Manager 2.0
Groupware CalendarCalendar that can be read/modified by group
Keyword Search Engine 3.0Traverses HTML documents, searches for keyword, and returns output
authentication-lib.plAuthentication perl module
date.plDate-based perl module

Reach for the Stars at www.stars.com

This site is a very comprehensive resource, self-described as a "Web developer's encyclopedia." The site is located at http://www.stars.com. Useful documents include tutorials on HTML, CGI, HTTP, databases, and style guidelines.

When you access the Library of Web Development at http://WWW.Stars.com/Vlib/, you will think that you have died and gone to some version of a pleasant afterlife. Accessing the encyclopedia only confirms this thought. This site is an incredibly rich source of links to virtually any Web development topic that you can think of. The CGI page has 69 links, the HTML has 55 links, and so on.

This site is a definite must to visit, especially when you have time to do a little link-hopping and exploring or when you need to find a Web development resource.

CGI Scripts to Go

Another excellent resource for CGI scripts, this site has several CGI script examples, listed by category. The site uses HTML tables to provide the name of the script's author, a description of the script, the type of script, the language, and a link to the file(s). You can reach the site at http://www.virtualville.com/library/scripts.html. The site also contains an introduction to CGI at http://www.virtualville.com/library/cgi.html.

The categories listed at the site are:

PureAmiga

Lest you think that all CGI scripting with Perl is done only in UNIX or Windows NT, this site has many excellent examples of CGI scripting, including animation, bulletin boards, calendars, counters, and mail. You can reach the site at http://www.netlink.co.uk/users/PureAmiga/pcgi/index.html.

MacPerl

Some helpful MacPerl scripts are available at Adam's Perl Page, located at http://www.marketspace.com.au/~adam/. You can find the MacPerl home page at http://err.ethz.ch/~neeri/macintosh/perl.html, a MacPerl primer at http://www.unimelb.edu.au/~ssilcot/macperl-primer/home.html, and the MacPerl FAQ at ftp://ftp.netcom.com/pub/ha/hal/MacPerl/faq.html.

Perl for Win32

A helpful site for information on the Perl for Win32 port is http://www.perl.hip.com/PerlFaq.htm. The company that maintains this site also provides what is considered to be the most stable port for Windows NT and Windows 95.

In addition, a Dynamic Link Library (DLL) called PERLS.DLL is available at http://www.perl.hip.com/perlis.htm, This library works with the Microsoft Internet Information Server to improve the efficiency of CGI access with Perl. Notice that the release of this DLL might still be a beta release.

An Instantaneous Introduction to CGI Scripts and HTML Forms

This site, which contains a nice little introduction to CGI and forms, can be reached at http://kufacts.cc.ukans.edu/info/forms/forms-intro.html. The site not only describes the process, but also provides graphics that demonstrate how HTML forms and CGI interact.

CGI Documentation by NCSA

If you want to learn something, sometimes you have to go back to the source. This site, at http://hoohoo.ncsa.uiuc.edu/docs/cgi/, provides a CGI overview. The site also includes tips on writing secure CGI scripts-an activity that must always concern CGI programmers.

Server-Side Includes

Yahoo maintains a site that covers server-side includes (SSI). You can reach the site at http://www.yahoo.com/Computers_and_Internet/Internet/World_Wide_Web/HTTP/Servers/Server_Side_Scripting/ Server_Side_Includes_SSI_/. (Access probably will be faster if you access Yahoo at www.yahoo.com and then follow the links until you access this site, rather than try to type the entire URL.)

From this site, you can access a helpful tutorial on SSI, located at http://www.carleton.ca/~dmcfet/html/ssi1.html. Additionally, although SSI works with a Web server such as NCSA HTTPd (http://hoohoo.ncsa.uiuc.edu/docs/tutorials/includes.html), it does not work with the CERN server. You can, however, access a Perl module, fakessi.pl, at http://sw.cse.bris.ac.uk/WebTools/fakessi.html. This module provides SSI-like functionality.

Sites Containing General Perl Information

This section lists sites that contain references to standard Perl material that may not be Web- or CGI-related but that can be used regardless of application type.

Basic Perl Documentation

When you are working with Perl, you will want to review some of the basic Perl documentation. Check out the following sites:

CPAN Sites

CPAN stands for Comprehensive Perl Archive Network. Table B.4 lists the CPAN sites.

Table B.4  CPAN Mirror Sites

SiteURL
North America: Canadaftp://enterprise.ic.gc.ca/pub/perl/CPAN/
North America: Californiaftp://ftp.digital.com/pub/plan/perl/CPAN/
North America: Californiaftp://ftp.cdrom.com/pub/perl/CPAN/
North America: Coloradoftp://ftp.cs.colorado.edu/pub/perl/CPAN/
North America: Floridaftp://ftp.cis.ufl.edu/pub/perl/CPAN/
North America: Illinoisftp://uiarchive.cso.uiuc.edu/pub/lang/perl/CPAN/
North America: New Yorkftp://ftp.rge.com/pub/languages/perl/CPAN/
North America: Oklahomaftp://ftp.uoknor.edu/mirrors/CPAN/
North America: Texasftp://ftp.sterling.com/programming/languages/perl/
North America: Texasftp://ftp.sedl.org/pub/mirrors/CPAN/
North America: Texasftp://ftp.metronet.com/pub/perl/
Africaftp://ftp.is.co.za/programming/perl/CPAN/
Australiaftp://coombs.anu.edu.au/pub/perl/
Australiaftp://ftp.mame.mu.oz.au/pub/perl/CPAN/
New Zealandftp://ftp.tekotago.ac.nz/pub/perl/CPAN/
Europe: Austriaftp://ftp.tuwien.ac.at/pub/languages/perl/CPAN/
Europe: Belgiumftp://ftp.kulnet.kuleuven.ac.be/pub/mirror/CPAN/
Europe: Czech Republicftp://sunsite.mff.cuni.cz/Languages/Perl/CPAN/
Europe: Denmarkftp://sunsite.auc.dk/pub/languages/perl/CPAN/
Europe: Finlandftp://ftp.funet.fi/pub/languages/perl/CPAN/
Europe: Franceftp://ftp.ibp.fr/pub/perl/CPAN/
Europe: Franceftp://ftp.pasteur.fr/pub/computing/unix/perl/CPAN/
Europe: Germanyftp://ftp.leo.org/pub/comp/programming/languages/perl/CPAN/
Europe: Germanyftp://ftp.rz.ruhr-uni-bochum.de/pub/CPAN/
Europe: Greeceftp://ftp.ntua.gr/pub/lang/perl/
Europe: Hungaryftp://ftp.kfki.hu/pub/packages/perl/CPAN/
Europe: Italyftp://cis.utovrm.it/CPAN/
Europe: The Netherlandsftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
Europe: Polandftp://ftp.pk.edu.pl/pub/lang/perl/CPAN/
Europe: Polandftp://sunsite.icm.edu.pl/pub/CPAN/
Europe: Portugalftp://ftp.ci.uminho.pt/pub/lang/perl/
Europe: Spainftp://ftp.etse.urv.es/pub/mirror/perl/
Europe: Spainftp://ftp.rediris.es/mirror/CPAN/
Europe: Swedenftp://ftp.sunet.se/pub/lang/perl/CPAN/
Europe: Switzerlandftp://ftp.switch.ch/mirror/CPAN/
Europe: United Kingdomftp://ftp.demon.co.uk/pub/mirrors/perl/CPAN/
Europe: United Kingdomftp://sunsite.doc.ic.ac.uk/packages/CPAN/
Europe: United Kingdomftp://unix.hensa.ac.uk/mirrors/perl-CPAN/
Japanftp://ftp.lab.kdd.co.jp/lang/perl/CPAN/
Taiwanftp://dongpo.math.ncu.edu.tw/perl/CPAN/
South America: Chileftp://sunsite.dcc.uchile.cl/pub/Lang/perl/CPAN/

The CPAN sites have a subdirectory labeled /MODULES, which contains references to various Perl modules that are stored at each of the CPAN sites. To access a list of the modules, access the subdirectory at /modules/01modules.index.html. You can find a description of a standard for development for the modules at /modules/00modlist.long.html. The modules are listed by author, category, and by module.

An additional subdirectory to check out is the /SCRIPTS subdirectory at each CPAN site. This subdirectory is itself divided into subdirectories, each of which represents a different category. Each category can have one to many Perl scripts that you can examine, use, and reuse.

DBI

DBI, which is the Perl Database Interface, is a database API for Perl. The best place to access information about this interface is http://www.hermetica.com/technologia/DBI/index.html. You can download the most recent copy at http://www.hermetica.com/technologia/DBI/DBI/index.html. In addition, you can access any of the existing drivers from this site. Some of the available drivers are for the Oracle, Sybase, mSQL, Informix, and Quickbase databases. Plans are currently under way to implement an interface for ODBC.

An additional site for information on DBI is located at http://www.fugue.com/dbi/. You can also subscribe to three DBI mailing lists at this location.

The gd.pm Graphics Library

gd is a graphics library that was originally written (and still is written) in C, but a version of gd has been ported to Perl. You can access this library at http://www-genome.wi.mit.edu/ftp/pub/software/WWW/GD.html. This library allows you to create three classes: Image, Font, and Polygon.

sgmls.pm

This Perl library parses the output of the sgmls and nsgmls parsers, which you can find at http://www.jclark.com/sp/index.htm. The Perl library is located at http://www.uottawa.ca/~dmeggins/SGMLSpm/definition.html. A sample application, sgmlspl, is documented; you can reference it at http://www.uottawa.ca/~dmeggins/sgmlspl/definition.html.