Perl and CGI for the World Wide Web: Visual QuickStart Guide / Edition 2

Paperback (Print)
Buy Used
Buy Used from BN.com
$18.74
(Save 25%)
Item is in good condition but packaging may have signs of shelf wear/aging or torn packaging.
Condition: Used – Good details
Used and New from Other Sellers
Used and New from Other Sellers
from $1.99
Usually ships in 1-2 business days
(Save 92%)
Other sellers (Paperback)
  • All (61) from $1.99   
  • New (2) from $50.00   
  • Used (59) 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
$50.00
Seller since 2014

Feedback rating:

(185)

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
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:

(185)

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

Overview

Perl is one of the most popular scripting languages for adding powerful interactive features to Web pages. Perl lets you place forms on your site that collect and process user input such as comments and product orders; enables visitors to search for information; and can integrate a database into your site, among its many other capabilities. Perl and CGI for the World Wide Web, 2nd Edition: Visual QuickStart Guide fully revised and updated since its original 1998 release, gets users to the core of CGI scripting with Perl. Even first-time programmers will be able to create useful, workable scripts from scratch, or adapt and customize existing scripts to their own needs. Hundreds of screen shots and clear, easy-to-understand directions make this the perfect Perl book for beginners, as well as a handy reference for those with previous programming experience.

Perl and CGI for the World Wide Web: Visual QuickStart Guide gets you to the heart of Perl scripting with CGI...

Read More Show Less

Editorial Reviews

Booknews
New edition of a resource that shows how to create useful new scripts or adapt existing ones to individual needs. Castro (author of several books about the Web) tells how to set up and install a local server in order to learn Perl and test scripts without signing up with a commercial Web host; place forms on Web sites that collect and process user input such as product orders and comments; use CGI.pm, the standard Perl module for analyzing incoming form data; and how to debug and use security techniques. Annotation c. Book News, Inc., Portland, OR (booknews.com)
Read More Show Less

Product Details

  • ISBN-13: 9780201735680
  • Publisher: Peachpit Press
  • Publication date: 5/29/2001
  • Series: Visual QuickStart Guide Series
  • Edition description: REV
  • Edition number: 2
  • Pages: 336
  • Product dimensions: 6.96 (w) x 8.94 (h) x 0.74 (d)

Meet the Author

Elizabeth Castro is the author of four best-selling editions of HTML for the World Wide Web: Visual QuickStart Guide. She also wrote the best-selling Perl and CGI for the World Wide Web: Visual QuickStart Guide, and XML for the World Wide Web: Visual QuickStart Guide.

Read More Show Less

Read an Excerpt

Chapter 1: Introduction

So what does it mean to program, anyway? Is it dangerous? And I don't mean that facetiously. Many people have a glorified idea of programming as this complicated thing that only pocket-protector carrying, certified nerds are clever enough to do. And if the rest of us try it we'll. probably screw something up, like erase our hard disks or something.

Maybe programmers like this mystique... certainly they don't seem to make it easy to break into the art of programming. Most books that you read about programming start off somewhere in the middle, assuming you've already done some programming somewhere, and that you're just learning a new language, with the basic concepts already under your belt.

This book starts at the very beginning. Even if you've never, ever programmed before, you'll be able to understand this book. At the same time, I won't bore you to tears with a lot of theory or lengthy explanations. And I won't treat you like an idiot. We'll get started right away, but we'll start at the beginning. You don't have to have any previous knowledge of Unix commands, you don't have to already know what a variable is, or what arrays are, or any of that incomprehensible programspeak: I'll teach you as we go along. Let's start!

What Is a Program?

If you've used a computer, you've used a program. Perhaps you've written a letter with Microsoft Word, played a game of Doom, or balanced your checkbook with Quicken. All of these programs were created by writing lines of commands, called code. Each line of code contains instructions that dictate what should happen given a certain kind of input. For example, somewhere in Word's code there is a line (or three) that says "if the user chooses Times 12 point, change the text so that it is displayed in Times 12 point".

Unfortunately, programs aren't written in English (or any other spoken language). Instead, they're written in languages that are easy for computers to understand. And since the computers are the ones that have to do most of the work, I suppose that makes sense. Some common programming languages are C, C++, Pascal, and, well, Perl.

Like spoken languages, computer languages have their own grammar, syntax, and even their own punctuation. Thankfully, computer languages are generally a lot easier to learn than, say, French or Japanese. Computer languages have few or no exceptions (no, "i before a except after c"), and the rules are generally straightforward and easy to follow. And, you don't have to worry about pronunciation!

And scripts?

Like a program, a script is a collection of lines of code that contain instructions for the computer. The basic difference is that programs are compiled so that they'll run more quickly on particular operating systems while scripts are just text files that are interpreted as necessary. Perl is a bit of a hybrid, since it is written in text format (like scripts) that are compiled each time you run them. The most important thing you need to know is that you don't have to do anything special to a Perl script before running it.

Why Perl?

With so many languages from which to choose, why do so many people use Perl to make their Web pages interactive? Perl-which stands for Practical Extraction and Report Language-wasn't even designed for the Web. In fact, it was created by Larry Wall in 1986 to create reports for the company where he was working. Since then, he (and others) have added to it and made it into a powerful, full-featured (perhaps overfeatured) programming language that does much more than provide the one solution for which it was created way back when.

In fact, nowadays, people use Perl to do a wide variety of things. But one of its most popular uses is to make Web pages interactive. There are Perl scripts for processing forms, creating guestbooks, creating Webbased bulletin boards, counting the number of times a Web page is visited, and much more.

Perl is particularly suited to Web-related tasks for three reasons. First, it is a powerful textmanipulation tool. You can take a long stream of characters (say, the information entered into a Web form) and quickly separate it into fields and data-that is, information that can be used, compiled, and stored. Second, Perl is easily moved (ported) from one platform to another. A script written on a Windows system can be easily copied to a Unix machine or Macintosh with few or no changes. Next, Perl has a reputation as a cool language-really! Perl programmers love to brag about how they can do anything with Perl, on one line, in several different ways. Finally, Perl is fun!

What about CGI?

If you already have a script written in Pert, what do you need CGI for? CGI-which stands for Common Gateway Interface-is a protocol (a way of doing things), not a programming language. That means that it's the usual way that servers talk to the programs that they interact with. Therefore, any script that sends or receives information from a server needs to follow the standards specified by CGI. When folks talk about CGI scripts (or if they're really cool, CGIs), they're talking about scripts written in a programming language-often, but not always, Perl-that follow the CGI protocol.

So, some Pert scripts are CGI scripts (the ones that follow the CGI protocol) and some are not. And some so-called CGI scripts are Pert scripts (the ones that are written in Pert), but some are not (they are also commonly found written in C, tcl, Visual Basic, and AppleScript).

In this book, you'll learn about creating Pert CGI scripts-specifically for getting, processing, and returning information through your Web pages. For information on learning more about non-Web related applications for Pert scripts, consult Appendix E, Perl and CGI Resources.

Security Issues

Letting complete strangers run programs on your server can constitute a security risk. When you give a CGI script access to files and directories on your server, you give the visitors that run those CGI scripts from their browsers access to those same files. Malicious computer crackers (hacker is considered a positive term in most programming circles) can take advantage of security holes to delete or modify files or to use your system to attack a third party. Even seemingly innocuous visitors can mess things up by unintentionally providing unexpected data.

It is extremely important that you take all of the necessary precautions (as discussed throughout this book) so that you don't leave your server vulnerable. I discuss security in more detail in Chapter 18, Security, starting on page 237....

Read More Show Less

Table of Contents

1. Introduction.

What is a Program? Why Perl? What about CGI? Security Issues. Perl and HTML. About This Book. What This Book is Not. What's New. The Perl and CGI VQS Guide Web Site.

2. Perl Building Blocks.

Perl Data. Operators and Functions. Quotation Marks. Quoting without Quotes. Statements, Blocks, and Scope. Declaring Private Variables. The Shebang Line. Creating a Perl CGI Script. Creating Output for a Browser. Documenting Your Script. Checking the Script's Syntax.

3. About Servers, Perl, and CGI.pm.

What is a Server? The Importance of Directories. Ask Your Web Host! Getting a Perl Interpreter. Getting CGI.pm.

4. Running Perl CGI on a Unix Server.

Which Perl are They Running? What About CGI.pm? Installing Scripts on Unix Servers. Uploading Your Script. Changing Permissions. Testing Your Unix Server.

5. Testing Scripts Locally on Windows.

Installing the Xitami or Sambar Server. Installing Personal Web Server. Installing IIS on Windows 2000. Displaying File Extensions. Testing Your Server (Part I). Installing the Perl Interpreter. Installing CGI.pm. Installing Scripts on Windows Servers. Testing Your Server (Part II).

6. Testing Scripts Locally on the Mac.

Installing Personal Web Sharing. The Root Web Directory. Carefully Sharing the Root Web Directory. Starting the Web Sharing Server. Testing the Server (Part I). Installing MacPerl. Installing CGI.pm. Installing Scripts on Mac Servers. Testing Your Server (Part II).

7. Getting Data from Visitors.

Labeling Incoming Data. Creating a Form. Creating Text Boxes. Creating Password Boxes. Creating Larger Text Areas. Creating Radio Buttons. Creating Checkboxes. Creating Menus. Creating the Submit Button. Resetting the Form. Using an Image to Submit Data. Creating a Link to a Script. Using a Link to Input Data to a Script.

8. Environment Variables.

Your Visitor's Browser and Platform. Viewing Available Environment Variables. Storing Data from Environment Variables.

9. Getting Data into the Script.

Getting Single-Valued Form Data. Getting Multiple-Valued From Data. Getting All the Form Element's Names. Getting All the Names and Values.

10. Simple Operations with Scalars.

Assigning a Value to a Scalar Variable. Multiplying, Dividing, Adding, Subtracting. Using More Than One Operator. Raising a Number to an Exponential Power. Using Mathematical Functions. Getting the Remainder of a Division. Connecting Strings Together. Repeating a String. Operating and Assigning in One Step. Incrementing (or Decrementing) a Variable.

11. Conditionals and Loops.

Comparing Numbers. Comparing Strings. Evaluating Conditions without Comparisons. Testing Two or More Comparisons at a Time. Creating a Basic Conditional Statement. Adding Options for False Conditions. Adding Multiple, Independent Conditions. Using Unless. Repeating a Block for Each Item in an Array. Loading the Default Variable. Repeating a Block While a Condition is True. Repeating a Block While a Condition is False. Executing the Block at Least Once. Repeating a Block a Given Number of Times. Nesting Conditional Statements. Skipping a Loop Iteration. Jumping Out of a Loop Altogether.

12. Working with Arrays.

Assigning a List to an Array Variable. Referring to a Particular Item in an Array. Referring to Multiple Items in an Array. Adding or Replacing an Item in an Array. Adding to the End or Beginning of an Array. Removing the Last Item from an Array. Removing the First Item from an Array. Replacing More Than One Item in an Array. Finding the Length of an Array. Modifying All the Members of an Array. Sorting Arrays. Reversing the Order of an Array's Contents.

13. Subroutines.

Creating a Simple Subroutine. Using a Simple Subroutine. Creating a Subroutine That Takes Input. Calling a Subroutine That Takes Input. Using a Subroutine's Return Value. Setting the Return Value Manually. Storing Subroutines in an External File. Calling Subroutines from an External File.

14. Working with Hashes.

Assigning a List to a Hash. Getting a Value by Using a Key. Adding or Replacing a Key-Value Pair. Getting Several Values Using Keys. Getting All of a Hash's Keys. Getting All of a Hash's Values. Getting Each Key and Value in a Hash. Getting the Pairs in a Specified Order. Removing Key-Value Pairs. Checking to See If a Key Exists.

15. Analyzing Data.

Finding Something. Finding and Replacing. Seeing and Using What was Found. Splitting a Value into Pieces. Constructing Search Patterns. Tips for Constructing Search Patterns. Matching a Single Character. Matching a String of Characters. Matching a Character from a Group. Matching a Character That's Not in the Group. Using Class Shorthands. Limiting the Locations. Choosing How Many to Match. Curbing a Quantifier's Greediness. Matching One Element or Another. More on Using What You Already Matched.

16. Remembering what Visitors Tell You.

About Hidden Fields. Adding Hidden Fields to a Form. Storing Collected Data in a Hidden Field. About Cookies. Looking at Your Browser's Cookies. Sending a Cookie. Setting a Cookie's Expiration Date. Limiting a Cookie to a Domain. Limiting a Cookie to a Part of Your Server. Limiting Cookies to Secure Connections. Reading and Using a Cookie. How (and Why) Visitors Refuse Cookies.

17. Formatting, Printing, and HTML.

Formatting Output with Perl. Creating a Format Pattern for Integers. Creating a Format Pattern for Non-Integers. Creating a Pattern for Strings. Changing the Case. Changing Characters. Finding the Length of a String. Finding Where Something is in a String. Extracting One String from Another. Cleaning up the End of a String. Formatting Output with HTML. Printing Several Lines at a Time. Simplifying Paths to Images and Links. Outputting Data in a Table.

18. Security.

Reading the Security FAQs. The Problem with Visitor Input. Protecting Calls to the Systems. Limiting Access to Files. Using CGI.pm to Limit Incoming Data. Keeping Information to Yourself. Avoiding Tainted Data. Cleaning and Using Outside Data.

19. Files and Directories.

Opening a File. Verifying File and Directory Operations. Writing to an External File. Getting Exclusive Access to a File. Reading Data from an External File. Closing a File. Renaming a File. Removing a File. Checking a File's Status. Opening a Directory. Reading the Contents of a Directory. Closing a Directory. Changing the Working Directory. Creating a Directory. Changing Permissions from within a Script. Removing a Directory. Getting Ready to E-mail Output. Sending Output via E-mail.

20. Uploading Files.

Creating a Form for Uploading Files. Getting the Name of the Uploaded File. Finding Out a File's MIME Type. Specifying Where the File Should be Saved. Reading in and Limiting the Uploaded Files.

Appendix A: Debugging.

Checking the Easy Stuff. Creating an Error Subroutine. Using Perl's Error Reporting. Viewing the System Error Log. Isolating the Problem. Following a Variable's Progress.

Appendix B: Using Other Folks' Scripts.

Using Other Folks' Scripts. Getting Other People's Scripts. Expanding Compressed Scripts. Configuring Borrowed Scripts. Customizing Borrowed Scripts.

Appendix C: Permissions on Unix.

Figuring Out the Permissions Code. Default Permissions. Who's the Owner?

Appendix D: Unix Essentials.

Telnetting to Your Unix Server. Executing Commands in Unix. Dealing with Paths in Unix. Changing the Working Directory. Finding Out Where You Are. Listing Directory Contents. Eliminating Files. Creating and Eliminating Directories. Decompressing Tar and Zipped Files. Getting Help with Unix.

Appendix E: Perl and CGI Resources.

Text Editors. Telnet Programs. Other Folks' Scripts. Learning More.

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 all of 3 Customer Reviews
  • Anonymous

    Posted October 29, 2002

    It's only fault is that it isn't long enough

    I bought this book with zero knowledge of Perl. I found the book priceless. It helped me crank out dozens of web server cgi scripts in a matter of days. My only complaint is that I wish it was longer and more thorough. Or I wish the author had a complementary book to follow in the same "easy to follow" format. This is a must have book for non-Unix Perl newbies especially.

    1 out of 1 people found this review helpful.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted September 27, 2001

    Simple without being childish

    This is a great book for someone who's really interested in learning Perl for writing CGI scripts, and who already has a decent basis in programming. When I purchased this book I already had a very basic understanding of some Perl concepts, and I just used this as a resource... it's fantastic!!!

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted August 13, 2001

    GO PERL

    I am a senior web-programmer for a Silicon Valley based internet company. I have read almost every book on PERL, PYTHON, CGI, and UNIX... and this author, this publisher, puts all the technical jargon, into readable lessons for today's web-programmer.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 3 Customer Reviews

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