9780130284181

Perl How to Program : Introducing CGI and Python

by ; ; ;
  • ISBN13:

    9780130284181

  • ISBN10:

    0130284181

  • Edition: CD
  • Format: Paperback
  • Copyright: 2001-01-25
  • Publisher: Prentice Hall

Note: Supplemental materials are not guaranteed with Rental or Used book purchases.

Purchase Benefits

  • Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $159.80 Save up to $39.95
  • Buy Used
    $119.85
    Add to Cart Free Shipping

    USUALLY SHIPS IN 2-4 BUSINESS DAYS

Supplemental Materials

What is included with this book?

Summary

This new book by the world's leading programming language textbook authors carefully explains how to use Perl as a general-purpose programming language and how to program multi-tier, client/server, database-intensive, Internet-and-Web-based applications. Dr. Harvey M. Deitel and Paul J. Deitel are the principals of Deitel & Associates, Inc., the internationally recognized corporate training and content-creation organization specializing in C++, Javatrade;, C#, C, Visual Basicreg;, XMLtrade;, Python, Perl, Internet, World Wide Web and object technologies. The Deitels are also the authors of the world's #1 Java and C++ textbooks, Java How to Program, 3/e and C++ How to Program, 3/e. In Perl How to Program, the Deitels and their colleagues, Tem R. Nieto and David C. McPhie, discuss topics you need to build complete, Web-based applications including: CGI/HTML forms/XML/CGI.pm Control Structures/Arrays/Hashes Regular Expressions/Strings Objects/Encapsulation OOP/Inheritance/References Database/DBI/SQL/Signals/Contexts Security/Accessibility Typeglobs/File Globbing Networking/Sockts/Internet Protocols Cookies/Session Tracking Filehandles/Data Structures Process Control/Forking/Piping Subroutines/Modules/Packages/Overloading Web Automation/OLE Automation Server-Side Includes/Ties/Closures Graphics/GUI/Perl/TK Perl How to Program includes extensive pedagogic features: Hundreds of LIVE-CODEtrade; programs with screen captures that show exact outputs Extensive World Wide Web and Internet resources to encourage further research Hundreds of tips, recommended practices and cautions-all marked with icons

Author Biography

Dr. Harvey M. Deitel, CEO of Deitel & Associates, Inc., has 40 years in the computing field including extensive industry and academic experience. He is one of the world's leading computer science instructors and seminar presenters. Dr. Deitel earned B.S. and M.S. degrees from the Massachusetts Institute of Technology and a Ph.D. from Boston University. He has 20 years of college teaching experience including earning tenure and serving as the Chairman of the Computer Science Department at Boston College before founding Deitel & Associates, Inc. with his son Paul J. Deitel. He is author or co-author of several dozen books and multimedia packages and is currently writing many more. With translations published in Japanese, Russian, Spanish, Elementary Chinese, Advanced Chinese, Korean, French, Polish and Portuguese, Dr. Deitel's texts have earned international recognition. Dr. Deitel has delivered professional seminars internationally to major corporations, government organizations and various branches of the military.

Paul J. Deitel, Executive Vice President of Deitel & Associates, Inc., is a graduate of the Massachusetts Institute of Technology's Sloan School of Management where he studied Information Technology. Through Deitel & Associates, Inc. he has delivered Internet and World Wide Web courses and programming language classes for industry clients including Compaq, Sun Microsystems, White Sands Missile Range, Rogue Wave Software, Computervision, Straws, Fidelity, Cambridge Technology Partners, Lucent TecItnologies, Adra Systems, Entergy, CableData Systems, NASA at the Kennedy Space Center, the National Severe Storm Laboratory, IBM and many other organizations. He has lectured on for the Boston Chapter of the Association for Computing Machinery, and has taught satellite-based courses through a cooperative venture of Deitel & Associates, Inc., Prentice Hall and the Technology Education Network. He and his father, Dr. Harvey M. Deitel, are the world's best-selling Computer Science textbook authors.

Tem R. Nieto, Director of Product Development with Deitel & Associates, Inc., is a graduate of the Massachusetts Institute of Technology where he studied engineering and computing. Through Deitel & Associates, Inc. he has delivered courses for industry clients including Sun Microsystems, Compaq, EMC, Stratus, Fidelity, Art Technology, Progress Software, Toys "R" Us, Operational Support Facility of the National Oceanographic and Atmospheric Administration, Jet Propulsion Laboratory, Nynex, Motorola, Federal Reserve Bank of Chicago, Banyan, Schlumberger, University of Notre Dame, NASA, various military installations and many others. He has co-authored several books and multimedia packages with the Deitels and has contributed to virtually every Deitel & Associates, Inc. publication.

David Craig McPhie recently graduated from Harvard College magna cum laude with a B.A. in Physics, having completed extensive computer science course work in C, C++, Java and Lisp. His course work included a final project using CGI to implement an online word game ("Elggob") that won accolades from his instructors and peers. Prior to collaborating on Perl How to Program, David programmed a Monte Carlo electron path modeling application for AlliedSignal, Electron Vision Group in San Diego. His other computing experience includes software test script writing and implementation with SilkTest at Cakewalk Software, and debugging courtroom simulation software code at the Education Technology Department of Harvard Law School. David has now changed venues and is studying law at Harvard Law School. He maintains an interest in technology law, and continues to use Per in Web programming for student organizations. He and his wife Erin and daughter Emily live in Cambridge, MA.

Table of Contents

Contents vii
Illustrations
xviii
Preface xxx
Introduction to Computers, the Internet and the World Wide Web
1(25)
Introduction
2(1)
What Is a Computer?
3(1)
Computer Organization
4(1)
Evolution of Operating Systems
5(1)
Personal Computing, Distributed Computing and Client/Server Computing
5(1)
Machine Languages, Assembly Languages and High-level Languages
6(1)
Structured Programming
7(1)
Object-Oriented Programming
8(1)
Hardware Trends
9(1)
History of the Internet
10(1)
History of the World Wide Web
11(1)
History of Perl
11(2)
Perl Library
13(1)
General Notes About Perl and This Book
13(1)
A Tour of the Book
13(9)
Internet and World Wide Web Resources
22(4)
Introduction to Programming in Perl
26(34)
Introduction
27(1)
Simple Programs that Display Lines of Text
27(5)
A Simple Program: Printing a Line of text
27(2)
Executing the Program
29(1)
A Simple Program: Printing Several Lines of Text
30(2)
Another Simple Program: Adding Two Integers
32(2)
Memory Concepts
34(1)
Scalar Values and Scalar Variables
35(1)
Arithmetic Operators
36(4)
Assignment Operators
40(1)
Increment and Decrement Operators
41(2)
Decision Making: Equality and Relational Operators
43(4)
Confusing Equality (==) and Assignment (=) Operators
47(2)
String Operators
49(1)
Numeric and String Contexts
50(2)
Internet and World Wide Web Resources
52(8)
Control Structures: Part I
60(34)
Introduction
61(1)
Algorithms
61(1)
Pseudocode
62(1)
Control Structures
62(2)
if and unless Selection Structures
64(3)
if/else and if/elsif/else Selection Structures
67(3)
while and until Repetition Structures
70(2)
do/while and do/until Repetition Structures
72(2)
Formulating Algorithms: Case Study 1 (Counter-controlled Repetition)
74(3)
Formulating Algorithms with Top-down, Stepwise Refinement: Case Study 2 (Sentinel-controlled Repetition)
77(5)
Formulating Algorithms with Top-down, Stepwise Refinement: Case Study 3 (Nested Control Structures)
82(4)
Internet and World Wide Web Resources
86(8)
Arrays and Hashes
94(41)
Introduction
95(1)
Additional Data Types
95(1)
Lists and List Context
96(1)
Arrays
96(3)
Creating and Manipulating an Array
99(1)
Repetition with the for Structure
100(3)
Additional Examples of Creating Arrays
103(4)
Array Manipulation
107(4)
Array Functions
111(4)
List Functions
115(1)
Searching Sorted Arrays
116(6)
Linear Search
116(2)
Binary Search
118(4)
Introduction to Hashes
122(1)
Creating and Manipulating a Hash
122(3)
Hash-related Functions
125(4)
Internet and World Wide Web Resources
129(6)
Control Structures: Part II
135(35)
Introduction
136(1)
foreach Repetition Structure
136(3)
Special Variable $_
139(1)
Loop Control Shortcuts: grep and map
140(2)
Case Study: Computing Mean, Median and Mode
142(4)
Loop Controls: The next Statement
146(1)
Loop Controls: The last Statement
147(1)
Loop Controls: The redo Statement
148(1)
Block Labels
149(1)
Bare Blocks
150(1)
Logical Operators
151(4)
Using Logical Operators for Flow Control
155(2)
Error Functions: die and warn
157(1)
Summary of Structured Programming
158(12)
Subroutines and Functions
170(46)
Introduction
171(1)
Subroutines in Perl
171(2)
Built-in Math Functions
173(1)
User-defined Subroutines
174(2)
Argument Lists
176(2)
Returning Values
178(2)
Other Ways to Invoke a Subroutine
180(3)
Random-Number Generation
183(4)
Example: A Game of Chance
187(3)
Recursion
190(3)
Example Using Recursion: Fibonacci
193(3)
Recursion vs. Iteration
196(1)
Scope Rules: Global, Lexical and Dynamic
197(3)
Namespaces, Packages and Modules
200(6)
Defining a Package and Importing it with require
200(3)
Modules and the use Statement
203(2)
Other Features of the use Statement
205(1)
Pragmas
206(10)
Introduction to the Common Gateway Interface (CGI)
216(37)
Introduction
217(1)
A Simple HTTP Transaction
217(3)
A Simple CGI Script
220(4)
Using CGI.pm to Generate HTML
224(3)
Sending Input to a CGI Script
227(2)
Using HTML Forms to Send Input
229(6)
Using CGI.pm to Create Forms and Read Input
235(3)
Other Headers
238(1)
Example: An Interactive Portal
239(4)
Internet and World Wide Web Resources
243(10)
Regular Expressions
253(31)
Introduction
254(1)
Matching Operator m//
254(2)
Substitution Operator s///
256(1)
Special Characters and Character Classes
257(2)
Alternation
259(2)
Quantifiers
261(2)
Quantifier Greediness
263(1)
Assertions
264(2)
Backreferences
266(3)
More Regular-Expression Modifiers
269(1)
Global Searching and the /g Modifier
270(1)
Example: Form Verification
271(5)
Internet and World Wide Web Resources
276(8)
String Manipulation
284(35)
Introduction
285(1)
Quotes and Quote Operators
285(3)
``Here'' Documents
288(2)
Basic String Functions
290(2)
chop and chomp functions
292(3)
index and rindex Functions
295(2)
Function join
297(1)
Function split
298(2)
tr/// Translation Operator
300(2)
Formatting Outputs with printf and sprintf
302(3)
Printing with Field Widths and Precision
305(2)
Using Flags in the printf Format Control String
307(3)
Evaluating Strings as Perl Code
310(9)
File Processing
319(26)
Introduction
320(1)
Data Hierarchy
320(2)
Filehandles
322(1)
Opening and Closing Filehandles
323(2)
Using Filehandles
325(2)
@ARGV Special Variable
327(1)
Other Ways to Read from Files
328(1)
Implementing a Random-Access File
329(3)
Example: Web-Page Log Generator
332(3)
Example: Guestbook
335(2)
Internet and World Wide Web Resources
337(8)
File and Directory Manipulation
345(19)
Introduction
346(1)
File Tests and sysopen
346(3)
Permissions
349(1)
File Manipulation
350(3)
Hard Links and Symbolic Links
353(1)
File Globbing
354(1)
Directory Handles and Manipulation
354(1)
Example: Web Site Recent-Update Page
355(9)
Formatting
364(35)
Introduction
365(1)
Creating Formatted Reports
365(3)
Top-of-Form Processing
368(2)
Multiple-Line Format Fields
370(3)
Format Variables
373(4)
Case Study: Outputting a Database
377(3)
Case Study: Web Log Analyzer
380(19)
References
399(40)
Introduction
400(1)
References
400(2)
References to Nonscalars
402(3)
Anonymous Structures
405(3)
Closures
408(2)
References as Function Arguments
410(4)
Nested Data Structures
414(5)
Garbage Collection and Circular References
419(1)
Symbolic References
420(3)
Typeglobs
423(4)
Referencing Filehandles
427(2)
Uses for References
429(3)
Internet and World Wide Web Resources
432(7)
Objects and Modules
439(39)
Introduction
440(1)
Using a Class
441(2)
Creating a Simple Class
443(3)
Inheritance
446(5)
Overriding Methods
451(5)
Other Class Relationships: Multiple Inheritance, Composition and Containment
456(2)
Base Class Universal
458(1)
Encapsulation: Public vs. Private
459(1)
Closure Method
460(3)
Implicit Functions
463(2)
Autoload Function
465(3)
Tied Variables
468(2)
Internet and World Wide Web Resources
470(8)
Databases: SQL and Perl Database Interface (DBI)
478(47)
Introduction
479(1)
Relational Database Model
480(1)
Relational Database Overview: Employee.mdb
481(1)
Structured Query Language (SQL)
482(9)
Basic Select Query
483(1)
Where Clause
484(2)
Order By Clause
486(2)
Inserting a Record
488(1)
Updating a Record
489(1)
Deleting a Record
490(1)
Introduction to DBI
491(1)
Working with DBI
491(3)
Manipulating a Database with DBI
494(4)
DBI and the Web
498(10)
DBI Utility Functions
508(1)
MySQL Server
508(10)
Internet and World Wide Web Resources
518(7)
Session Tracking and Cookies
525(34)
Introduction
526(1)
Uses of Storing Data
526(1)
Methods of Storing Data
526(1)
Query Strings
527(4)
Hidden Fields
531(3)
Cookies
534(4)
Server-side Files
538(4)
Example: Shopping Cart
542(17)
Web Automation and Networking
559(29)
Introduction
560(1)
Introduction to LWP
560(1)
LWP Commands
561(3)
The LWP::Simple Module
564(1)
HTML Parsing
565(2)
Introduction to Advanced Networking
567(1)
Protocols
568(1)
Transport Control Protocol (TCP)
568(4)
Simple Mail Transfer Protocol (SMTP)
572(3)
Post Office Protocol (POP)
575(4)
Searching the World Wide Web
579(9)
Process Management
588(27)
Introduction
589(1)
The fork command
590(4)
The system and exec functions
594(3)
Controlling the Input and Output of Processes
597(4)
Communicating Between Processes
601(3)
Signal Handling
604(2)
Sending Signals
606(2)
OLE Automation
608(7)
Security
615(69)
Introduction
616(1)
What Makes a Program Insecure
617(1)
Using User Data with Shell Commands
618(4)
Defensive Programming
622(2)
Taint Mode
624(2)
Printing User Input to a Web Page
626(6)
Denial-of-Service Attacks
632(3)
Other Security Attacks
635(3)
Using Hidden Fields
638(6)
Introduction to Cryptography Theory
644(1)
Using Encryption
645(4)
Secret-key Cryptography
649(2)
Public-Key Cryptography
651(3)
Key Agreement Protocols
654(1)
Key Management
654(1)
Digital Signatures
655(1)
Public-Key Infrastructure, Certificates and Certification Authorities
656(2)
Cryptanalysis
658(1)
Security Protocols
659(2)
Secure Sockets Layer (SSL)
659(1)
Secure Electronic Transaction™ (Set™)
660(1)
Network Security
661(2)
Firewalls
661(1)
Kerberos
662(1)
Biometrics
663(1)
Steganography
663(2)
Internet and World Wide Web Resources
665(19)
Data Structures
684(37)
Introduction
685(1)
Self-referential Structures
685(1)
Linked Lists
686(10)
Doubly Linked Lists
696(5)
Stacks and Queues
701(3)
Trees
704(7)
Hashes
711(10)
Graphics/Tk
721(22)
Introduction
722(1)
GD Module: Creating Simple Shapes
722(3)
GD Module: Image Manipulation
725(1)
Chart Module
726(2)
Introduction to GUI
728(1)
Introduction to Tk
728(2)
Tk: GUI Components
730(4)
Tk Case Study: A GUI Application
734(9)
Extensible Markup Language (XML)
743(66)
Introduction
744(1)
Perl and XML
745(1)
Structuring Data
746(6)
XML Namespaces
752(2)
Document Type Definitions (DTD) and Schema
754(5)
Document Type Definitions
754(2)
W3C XML Schema
756(3)
Customized Markup Languages
759(3)
MathML
760(1)
WML
761(1)
XBRL
762(1)
ebXML
762(1)
FpML
762(1)
Other Markup Languages
762(1)
Document Object Model (DOM)
762(2)
XML::DOM
764(5)
DOM Methods
769(3)
Simple API for XML (SAX)
772(1)
Parsing XML with XML::Parser
773(4)
Data::Dumper and XML
777(1)
Extensible Style Language (XSL)
777(5)
Generating XML in Perl
782(2)
Case Study: Message Forums with Perl and XML
784(16)
Displaying the Forums using XML::Parser
785(4)
Using XML::DOM to Add Forums and Messages
789(3)
Alterations for Non-XSL Browsers
792(8)
Internet and World Wide Web' Resources
800(9)
Accessibility
809(26)
Introduction
810(1)
Providing Alternatives for Multimedia Content
810(9)
Maximizing Readability by Focusing on Structure
819(1)
Accessibility in HTML Tables
820(3)
Accessibility in HTML Frames
823(1)
Using Voice Synthesis and Recognition with VoiceXML™
823(4)
JAWS® for Windows
827(1)
Other Accessibility Tools
828(1)
Internet and World Wide Web Resources
828(7)
Bonus: Introduction to HyperText Markup Language 4: Part I
835(23)
Introduction
836(1)
Markup Languages
836(1)
Editing HTML
837(1)
Common Elements
837(3)
Headers
840(1)
Linking
841(3)
Images
844(3)
Special Characters and More Line Breaks
847(2)
Unordered Lists
849(1)
Nested and Ordered Lists
850(3)
Internet and World Wide Web Resources
853(5)
Bonus: Introduction to HyperText Markup Language 4: Part II
858(33)
Introduction
859(1)
Basic HTML Tables
859(3)
Intermediate HTML Tables and Formatting
862(2)
Basic HTML Forms
864(3)
More Complex HTML Forms
867(7)
Internal Linking
874(2)
Creating and Using Image Maps
876(3)
<meta> Tags
879(1)
frameset Element
880(2)
Nested framesets
882(2)
Internet and World Wide Web Resources
884(7)
Bonus: Cascading Style Sheets™ (CSS)
891(32)
Introduction
892(1)
Inline Styles
892(1)
Creating Style Sheets with the style Element
893(3)
Conflicting Styles
896(3)
Linking External Style Sheets
899(2)
Positioning Elements
901(3)
Backgrounds
904(3)
Element Dimensions
907(2)
Text Flow and the Box Model
909(5)
User Style Sheets
914(4)
Internet and World Wide Web Resources
918(5)
Bonus: Introduction to Python Programming
923(62)
Introduction
924(2)
A first Python program
925(1)
Python keywords
926(1)
Basic Data Types, Control Structures and Functions
926(5)
Tuples, Lists and Dictionaries
931(5)
String Processing and Regular Expressions
936(5)
Exception handling
941(2)
Introduction to CGI programming
943(2)
Form Processing and Business Logic
945(6)
Cookies
951(5)
Database Application Programming Interface (DB-API)
956(4)
Setup
956(1)
Simple DB-API program
956(4)
Object-Oriented Programming
960(2)
Case Study: GUI Database Application
962(12)
Gadfly
962(1)
Tkinter
963(1)
Setup
963(1)
GUI Database Viewer Implementation
964(10)
Operator Precedence Chart
974(1)
Internet and World Wide Web Resources
975(10)
A HTML Special Characters 985(1)
B HTML Colors 986(3)
C ASCII Character Set 989(1)
D Operator Precedence Chart 990(3)
E Number Systems 993(13)
E.1 Introduction
994(3)
E.2 Abbreviating Binary Numbers as Octal Numbers and Hexadecimal Numbers
997(1)
E.3 Converting Octal Numbers and Hexadecimal Numbers to Binary Numbers
998(1)
E.4 Converting from Binary, Octal, or Hexadecimal to Decimal
998(1)
E.5 Converting from Decimal to Binary, Octal, or Hexadecimal
999(1)
E.6 Negative Binary Numbers: Two's Complement Notation
1000(6)
F Career Resources 1006(18)
F.1 Introduction
1007(1)
F.2 Online Career Services
1008(2)
F.3 Career Opportunities for Employees
1010(4)
F.3.1 Comprehensive Career Sites
1010(1)
F.3.2 Technical Positions
1010(1)
F.3.3 Contracting Online
1011(1)
F.3.4 Executive Positions
1012(1)
F.3.5 Students and Young Professionals
1012(1)
F.3.6 Other Online Career Services
1013(1)
F.4 Online Opportunities for Employers
1014(3)
F.4.1 Posting Jobs Online
1014(1)
F.4.2 Diversity in the Workplace
1015(1)
F.4.3 Recruiting Services
1016(1)
F.4.4 Testing Potential Employees Online
1017(1)
F.5 Internet and World Wide Web Resources
1017(7)
G Perl 6 Web Resources 1024(3)
G.1 Introduction
1024(1)
G.2 Future of Perl
1024(1)
G.3 Internet and World Wide Web Resources
1025(2)
Bibliography 1027(2)
Index 1029

Excerpts

PrefaceWelcome to Perl! This book is by an old guy and three young guys. The old guy (HMD; Massachusetts Institute of Technology 1967) has been programming and/or teaching programming for 40 years. The three young guys (PJD; MIT 1991, TRN; MIT 1992 and DCM Harvard 2000) have each been programming and/or teaching programming for many years. The old guy programs and teaches from experience; the young guys do so from an inexhaustible reserve of energy. The old guy wants clarity; the young guys want performance. The old guy seeks elegance and beauty; the young guys want results. We got together to produce a book we hope you will find informative, challenging and entertaining. Why We Wrote Perl How to ProgramDr. Harvey M. Deitel taught introductory programming courses in universities for 20 years with an emphasis on developing clearly written, well-designed programs. Much of what is taught in these courses is the basic principles of programming with an emphasis on the effective use of data types, control structures, arrays and functionalization. Our experience has been that students handle the material in this book in about the same manner as they handle it in introductory Pascal or C courses. There is one noticeable difference though: students are highly motivated by the fact that they are learning a leading-edge programming language and a leading-edge programming paradigm (object-based programming) that will be immediately useful to them as they leave the university environment and head into a world of e-business and e-commerce in which the Internet and the World Wide Web have a massive prominence.Our goal was clear: produce a textbook for introductory university-level courses in programming for students with little or no programming experience, yet offer the depth and the rigorous treatment of theory and practice demanded by traditional, upper-level programming courses to satisfy professionals' needs. To meet this goal, we produced a comprehensive book that patiently teaches the principles of control structures, object-based programming and Internet and World Wide Web programming in Perl. After mastering the material in this book, students will be well prepared to take advantage of the Internet and the Web as they take upper-level courses and venture into the rapidly changing business world.Perl How to Programis the ninth book in the Deitel/Prentice HallHow to Programseries. The key focus of this book is Web-based applications development. Our audiences want to build real-world, industrial-strength, Web-based applications. These audiences care about good looking Web pages. But they also care about client/server systems, databases and distributed computing.Many books about the Web are reference manuals with exhaustive listings of features. That is not our style. We concentrate on creating real applications. We provide the live-code examples on the CD accompanying this book so that you can run the applications and see the outputs.We are excited about the enormous range of possibilities the Internet and the Web offer. We performed extensive research for this book and located many Internet and Web resources (which we provide as live links on the CD-ROM that accompanies this book) to help you learn about Perl. These links include general information, tutorials and demonstrations.We have worked hard to create hundreds of useful live-code examples to help you master Perl programming quickly and effectively. All of the code examples are on the accompanying disk and are available for free download from our Web sites: www.deitel.com www.prenhall.com/deitelThe book's exercises range from simple recall questions to lengthy programming problems to major projects. Instructors requiring substantial term projects will find many appropriate problems listed in the exercises, especially in the la

Rewards Program

Write a Review