BN.com Gift Guide

The CGI/PERL Cookbook

Overview

Custom subroutine library for developing your own CGI programs
* Line-by-line explanations of 20 of the most popular CGI programs and subroutines that are essential to your Web site
* Compatible with Perl 4 and 5
* Tested under WindowsR(r), UNIXR(r), and MacOSR(r)

If you want to make your Web site as interactive as possible, as soon as possible, you've come to the right ...

See more details below
Available through our Marketplace sellers.
Other sellers (Paperback)
  • All (19) from $1.99   
  • New (3) from $8.50   
  • Used (16) from $1.99   
Close
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any BN.com coupons and promotions
$8.50
Seller since 2005

Feedback rating:

(1625)

Condition:

New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

New
New

Ships from: Fort Worth, TX

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$50.00
Seller since 2014

Feedback rating:

(194)

Condition: New
Brand new.

Ships from: acton, MA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
$50.00
Seller since 2014

Feedback rating:

(194)

Condition: New
Brand new.

Ships from: acton, MA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
Page 1 of 1
Showing All
Close
Sort by
Sending request ...

Overview

Custom subroutine library for developing your own CGI programs
* Line-by-line explanations of 20 of the most popular CGI programs and subroutines that are essential to your Web site
* Compatible with Perl 4 and 5
* Tested under WindowsR(r), UNIXR(r), and MacOSR(r)

If you want to make your Web site as interactive as possible, as soon as possible, you've come to the right place! This book/CD powerhouse arms you with 20 of today's most-demanded CGI programs and subroutines, designed and written especially for this book, each ready to load and use. At the same time, it offers you a quick, painless, and unique hands-on way to learn basic and advanced CGI/Perl programming.

The CGI/Perl Cookbook begins with a concise overview of CGI programming for beginners, followed by a guide to installing CGI programs on UNIX, PC, and MacOS Web servers. The rest of the book is devoted to line-by-line, feature-by-feature explanations of seven cutting-edge CGI programs; including a search engine, password protection, advanced form processing, a shopping cart, customized bulk e-mail, advanced visitor feedback, and more; as well as 13 subroutines for e-mail support, file encoding, credit card validation, e-mail address checking, error handling, and text encryption. You also get a usage guide, installation instructions, and professional CGI and Perl programming tricks and customization tips for each program and subroutine.

The CD-ROM is a gold mine of ready-to-use software and valuable information. You get:
* All the CGI programs from the book-code and ready-to-run versions
* The complete Matt's Script Archive
* A collection of the best scripts from across the Web-source code included
* The complete Perl programming manual
* The most recent Windows, UNIX, and MacOS versions of Perl

Read More Show Less

Editorial Reviews

Booknews
Designed to teach the basics of CGI programming necessary for highly interactive web sites, this volume offers line-by-line breakdowns of seven CGI programs including a search engine, password protection, advanced form processing, a shopping cart, customized bulk e-mail, and advanced visitor feedback. Also included is a library of 13 sub routines for e-mail support, file encoding, error handling and other purposes. CD-ROM includes code and ready to run CGI programs from the book; the contents of "Matt's Script Archive" Web site; the Perl programming manual; and recent Windows, UNIX, and MacOS versions of Perl. Annotation c. by Book News, Inc., Portland, Or.
Read More Show Less

Product Details

  • ISBN-13: 9780471168966
  • Publisher: Wiley
  • Publication date: 10/24/1997
  • Series: Cookbooks Series , #2
  • Edition description: BK&CD-ROM
  • Edition number: 1
  • Pages: 656
  • Product dimensions: 7.48 (w) x 9.14 (h) x 1.44 (d)

Meet the Author

CRAIG PATCHETT is a professional programmer and experienced computer book author.

MATTHEW WRIGHT is the creator of the popular "Matt's Script Archive" and "CGI Resource Index" Web sites.

Read More Show Less

Read an Excerpt


Chapter 3: Installing CGI Programs

The programs and subroutines written for this book are provided in a ready-to-run format that, in most cases, only require you to modify a few configuration variables before they'll work on your server. You do need to install them first, however, and while each program chapter includes its own section covering installation details specific to that particular program, there are some general procedures that apply to them all. This chapter will go over those procedures with you and walk you through the process of installing a generic CGI program on your server. If you're already familiar with this process, then you can skip this chapter and go right to the first program in Chapter 4 (or to whichever program interests you most).

Overview

Many people who haven't used CGI programs before (or who have used programs that were installed by someone else) seem to have the misconception that installing one requires some kind of technical degree. This probably originated with early CGI programmers who wanted to protect their consulting income by making the whole process seem a lot more complicated than it really is. The truth is that installing a CGI program requires three simple steps, regardless of what operating system and Web server you're using:

1. Copy the program to your server.

2. Move the program into the appropriate directory.

3. Make sure your server knows about and can access the program.

That's pretty much all there is to it. The programs in this book also depend on some required support files that need to be copied to the server, but the process for doing so uses these same three steps. Since the exact implementation of these steps varies from platform to platform, we've included specific instructions for Unix, Windows, and MacOS servers.

A Few Assumptions

Because we have a limited number of pages to fill and a lot of information to pack into them, we have had to make a few basic assumptions for this chapter regarding your familiarity with your Web server. If any of these assumptions don't hold true for you, then you can rectify the situation by asking your ISP's system administrator a few questions or by consulting your server's documentation if you're running your own server.

You Have Access to a Web Server

This may sound like an obvious assumption, but some people don't realize that you cannot run a CGI program unless it is installed on a Web server. This means that either you have an account with an Internet Service Provider (ISP) that allows you to install Web pages and CGI programs on their server, or that you own or have access to a computer that is connected to the Internet and running Web server software. (Craig used CTSNet at www.cts.com during the development of the book and Matt used World Wide Mart at www.worldwidemart.com. All of the code has been tested on their servers already, so if you need to find an ISP we highly recommend both.)

For debugging purposes it is also helpful (although not required) if you have telnet access to a shell account on your server. This allows you to test the programs on the server itself rather than testing them on your local computer. If you're not sure whether or not you have telnet access, check with your ISP.

Perl Is Installed on Your Server

Although we have provided copies of Perl for a variety of platforms on the accompanying CD-ROM, it is beyond the scope of this book to cover the installation process. We will therefore assume that you are either using a server that already has Perl installed or that you are capable of installing Perl yourself from the CD-ROM (Readme files should be included with each version that explain the process.) If you're using a Unix-based server, then we also assume that you know where the Perl executable is located on your server. You can find out by checking with your system administrator or by using one of the following commands from the Unix shell prompt (some servers may not support these commands):

which perl
where is perl

You Have Access to a CGI Directory

Depending on the type of server you're using, the platform it is running on, and the way it has been configured, CGI programs may need to reside in a special directory in order to run. (Some servers allow you to keep CGI programs anywhere on the server's Web space as long as the filename ends with . cgi.) Traditionally this directory is named cgi-bin (especially on Unix servers), but it can have any name as long as the server is configured to recognize it. The process for doing so varies from server to server but in all cases must be performed by the system administrator. If you are using an ISP for your Web account, then you will need to ask the system administrator where to install your CGI programs. Otherwise please refer to your server software's documentation for instructions on how to configure a directory for CGI access.

NOTE: You cannot simply create a directory named cgi-bin, place a CGI program in it, and expect it to run. Your server must be configured by the system administrator to recognize a directory before it can be used for CGI access.

You Know How to Transfer Files to Your Web Server

Unless you have access to your Web server through your computer's file system, you will most likely need to transfer the programs in this book from the accompanying CD-ROM (or our Web site) to your server using an FTP program. We assume that you already know how to do this and have probably done so with HTML pages in the past. If not, you will need to get instructions from your ISP on how to go about it. (It's easy.)

On the CD-ROM, you'll notice that we provide Unix, Windows, and MacOS versions of each program and their supporting files. These versions differ only in the characters used to terminate each line in the file. (Each platform is different.) If you are transferring files directly from the CD-ROM, then make sure you transfer them from the directory that corresponds to the platform your server is running on. If you open and save these files on a different platform than the one your server is running on (i.e., your server is on a Unix machine and your home computer is a Mac), make sure you edit the version for your server's platform and that your editing program doesn't change the line breaks when it saves the file. You should also make sure that when you transfer the files to your server, you do so in ASCII mode as opposed to binary mode. (See the instructions for your FTP program if you're not sure how to do this.) In many cases this will take care of any line break problems.

Installing CGI Programs

Thanks to the standardized CGI protocol, the difference in the way CGI programs are installed on different platforms is small, as you will see in the following summaries.

Unix Servers

Installing a CGI program on a Unix-based server is a little more involved than on other platforms, but it is still a relatively straightforward process. Once the program has been copied into the appropriate directory, the only remaining step is to make sure that the program file has the correct access permissions (these dictate who can read from, write to, or execute the file).

Setting File Permissions

File permissions are set using Unix's chmod, command, the format for which is as follows:

chmod permissions filename

permissions is a three-digit number that indicates the type of permissions to give to the file. This number confuses a lot of people who aren't used to Unix, but it is actually very easy to understand once you know what it means.

The first digit defines what permissions the owner of the file has (i.e., the person who created the file), the second dictates what permissions the group that the owner belongs to has, and the third dictates what permissions everyone else has. Each category of permission (read, write, execute) is assigned a numeric value. Read permission is 4, write permission is 2, and execute permission is 1 (execute permission for a directory means that the directory can be searched). If you want the owner of the file to have permission to read, write, and execute the file, then you use a 7 (4 + 2 + 1) for the second digit. If you want the group to have permission to read and execute only, then you use a 5 (4 + 1) for the third digit. An example chmod command that gave full permissions to the owner and read and execute permissions to the group and everyone else would look like this:

chmod 755 filename

Typically these (7 5 5) are the permissions settings you will want to give to your CGI programs. (Required, template, and data files don't need to be executable, so you will use 644 with them.) You may also want to create an empty index.html file in the same directory as you CGI programs and set its permissions to 7 00. This will prevent people from getting access to your programs by using the URL of your CGI directory.

NOTE: Don't forget to set the access permissions for any directories or subdirectories you create when setting up your program. Otherwise you will not be able access your files properly, even if their permissions are set correctly.

Running the Program

Once your program is in the right directory with the file permissions set properly, it should be all set to run. You can test it by entering the URL of the directory it is saved in (check with your system administrator if you don't know what this URL is), followed by the name of the program file, into your browser.

Windows Servers

The installation process for Windows-based servers is the simplest of the three. The process of installing the Windows version of Perl automatically associates the cgi and pl extensions with the application, so your programs will be executable as soon as they are copied to your server's hard drive. The only extra step you need to worry about is copying them into a directory that is accessible by the server. If you are not sure what directories this includes, you should check with your system administrator. Once the program is in a valid directory, you can run it by opening the URL in our browser

MacOS Servers

The installation process for MacOS-based servers is also very straightforward. just follow these steps for each CGI program you want to install (required files can simply be copied to the appropriate directory):

1. Run MacPerl and open the CGI program.

2. Select Save As... from the File menu.

3. Select CGI Script from the popup, menu at the bottom of the Save dialog box.

4. Name and save the file.

This procedure will create an executable file that can be called the same as any other CGI program. At this point you can test the program by entering its URL into your browser's location input area.

NOTE: If you have an older version of MacPerl and don't see CGI Script as a choice in step 3, you will need to either update the version you're using or download the PCGI package from ftp:// err.ethz.ch/pub/neeri/macperi and copy the file CGI Script into the MacPerl Extensions folder in the MacPerl folder.

Installing Required Files

Regardless of what platform your server is running on, required files can be installed in any directory as long as you set the $REQUIRE_DIR configuration variable in each program to point to that directory. If your server is Unix-based you will also need to make sure the permissions are set correctly for the directory and the required files.

Installing Support Files

Most of the programs in the book run in conjunction with several supporting files, which may include HTML files, template.files, and/or configuration files. A suggested directory structure (along with the appropriate file and directory permissions for Unix users) for each program is included in the Installation section of the corresponding chapter. Sample support files are included for each program on the accompanying CD-ROM.

Troubleshooting

There are several things that can go wrong in the process of installing CGI programs, and even the most seasoned CGI users make mistakes every now and then. The three most common installation errors will cause your Web server to generate an error message that will be displayed in your browser. Each of these errors is defined in the following sections, along with the steps you'll need to take to remedy the situation.

"403 Forbidden" Error

This message indicates that the file permissions for the program are probably set incorrectly. Remember to set the permissions for the directory and/or subdirectory your program file is in as well as for the program file itself.

"404 Not Found" Error

If you get this message after attempting to access a program, then you've probably entered an invalid URL for the program. Double check the URL you're using and make sure you have specified the correct name and location of the program file. (Remember that uppercase letters are different than lowercase letters to Unix.)

"500 Server Error" Error

This error indicates that the program is not producing output that the server understands and generally indicates a problem with the program itself. You can check your server's error log for a more detailed explanation of the problem (check with your system administrator to find out where the error log is kept). If you get this error with one of the programs in this book, then there is probably a problem with one of the configuration variables in the program. Double-check each variable to make sure you didn't accidentally omit a closing quote or semicolon at the end of the line. Then try some of the debugging techniques presented in Appendix A to see if you can locate the problem. If not, please check the book's Web site to see if anyone else has had the same problem and/or let us know about the problem by filling in the bug report at the book's Web site (www.wiley.com/compbooks/cgi-perl). We'll do our best to take care of it as quickly as possible.

Read More Show Less

Table of Contents

GETTING STARTED.

Using This Book.

Using CGI and Perl.

Installing CGI Programs.

THE PROGRAMS.

Managing Files: Fileseek.CGI.

Gathering Input: Formhandler.CGI.

Spreading the Word: Broadcaster.CGI.

Doing Business: Webshop.CGI.

Getting Opinions: Feedback.CGI.

Keeping Track: Pagecontrol.CGI.

Restricting Access: Authenticate.CGI.

Getting Support: The Subroutines.

Appendices.

Bibliography.

Index.

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted May 16, 2000

    The CGI/PERL Cookbook

    An excellent resource for learning CGI scripting. It covers such full-featured CGI applications as advanced form handling, authentication, file search, user feedback, shopping cart and more. Also included is a library of 13 utility subroutines that include email for any platform, date formatting, template parsing, and much more. All scripts and subroutines are ready to use and include line-by-line explanations of their code.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)