Résumé
CGI Programming with Tcl illustrates the many advantages Tcl holds for CGI programmers and demonstrates how to create powerful CGI applications. This book presents a series of increasingly sophisticated applications, beginning with a simple Hello World application and culminating in Web-based interfaces to back-end databases such as Oracle. Through these examples, you will learn Tcl programming essentials and valuable CGI programming techniques. Specific topics covered include:
- A complete review of the CGI specification
- How to build and process HTML forms
- Debugging your CGI programs
- Processing form data with CGI programs
- Server Side Includes--allows you to embed commands inside your HTML files Accessing databases built entirely with Tcl
- Image maps--creating clickable images for navigating links
- Magic cookies and the privacy issues surrounding them
- Using OraTcl to provide an interface to an Oracle database
- Using the Tcl browser plug-in to run code inside your browser
- Using Tcl's socket support for building a Web-based client/server chat room
An experienced programmer unfamiliar with Tcl can learn the language by reading this must-have reference. Tcl's straightforward syntax and similarity to C make it possible for any programmer to work through the examples. Furthermore, Appendix C provides a Tcl reference.
The accompanying CD-ROM contains complete source code for all the examples in the book, as well as a CGI library that makes it easy to generate CGI programs that dynamically produce HTML Web pages.
Table of contents
- Preface
- Chapter 1 The Internet
- A Brief History
- Wide Area Networks
- Ethernet
- Ethernet Data Frames
- Internetworking and the Internet
- Internet Protocol Layers
- The Internet Protocol (IP)
- Packet Switching
- The Transmission Control Protocol (TCP)
- Fragmentation
- The Three-Way Handshake
- User Datagram Protocol (UDP)
- UNIX and the Internet
- Internet Addresses
- Address Space
- CIDR Addresses
- Ports
- The Universal Resource Locator (URL)
- Defining the World Wide Web
- The Client-Server Model
- What Is a Web Server?
- Documenting the Development
- The RFC Series
- The Internet Standards Track
- Anyone Can Join
- Address Management
- Who Uses the Web?
- Chapter Summary
- Chapter 2 The Common Gateway Interface
- What's in a Name?
- Analyzing Web Transactions
- Static Web Transactions
- Dynamic Web Transactions
- The CGI Interface
- The GET Method
- The POST Method
- Environment Variables
- The HTTP Specification
- A Stateless Protocol
- The HTTP Request
- The HTTP Response
- Status Codes
- Chapter Summary
- Chapter 3 Getting Started
- Obtaining and Installing Tcl
- Understanding Your Web Server's Configuration
- Installing the CD
- Using the cgi.tcl Library
- Modularity and the Tcl Package Facility
- Naming Conventions
- Namespaces
- Chapter Summary
- Chapter 4 Hello World
- A Word about Tools
- Example 1: The HTML Version
- The CGI Approach
- The Hello World Form
- Obtaining the Form Data
- Debugging CGI Programs
- Command Line Execution
- Set Up the Environment Variables
- Displaying User Input
- Using Embedded puts Commands
- Trapping Errors with catch
- Interactive Debugging
- The Debug Command
- Tcl Debuggers
- Chapter Summary
- Chapter 5 A Web-Based Directory Browser
- Security Considerations
- Obtaining the Client's IP Address
- Restricting Access Using REMOTE_ADDR
- Guarding the Back Door
- Using QUERY_STRING for State Information
- Building the Directory Screen
- Enhancing the Browser
- Hiding the Absolute Path
- Adding the Icons
- Providing the "Up One Level" Icon
- Chapter Summary
- Chapter 6 The Mortgage Calculator
- The Formulas
- Monthly Payment
- Amortization Schedule
- The mort.tcl Package
- Package Structure
- The mort::payment Procedure
- The mort::schedule Procedure
- Designing Web Pages
- The Mortgage Calculator Screen
- The Payment Calculator screen
- The Amortization Schedule
- A Cleaner Display
- Chapter Summary
- Chapter 7 Counting Your Hits
- The counter.tcl Package
- The counter_get_count Procedure
- The counter_display Procedure
- More Tricks
- The Hidden Field
- Chapter Summary
- Chapter 8 Server Side Includes
- Understanding Server Side Includes
- Configuring Your Web Server
- Server Side Include Directives
- SSI Examples
- Inserting System Variables into Your Documents
- Inserting Text into Your Documents
- File Statistics
- Executing External Programs
- The Mortgage Calculator Revisited
- Customizing the SSI Output
- Chapter Summary
- Chapter 9 Image Maps
- Server Side Image Maps
- Client Side Image Maps
- A File for Every Shape
- Building the Map
- The Gemstone Conference Room
- Processing the Request
- Chapter Summary
- Chapter 10 Putting Data Behind Your Forms
- The Flat File Database
- A Look at the Flat File
- The Selection Screen
- The Results Screen
- The db.tcl Package
- Using db.tcl in Standalone Applications
- Including the db.tcl Package
- Creating and Populating the Database
- Reading Records from the Database
- Deleting Records from the Database
- Updating Records in the Database
- db.tcl Command Summary
- Using db.tcl in Client-Server Applications
- The Database Server Program: dbserver.tcl
- Authentication in the Client-Server Model
- Real CGI
- Off-Line Maintenance of Your Data
- Chapter Summary
- Chapter 11 Cookies Anyone?
- Cookies Anyone?
- The Cookie Controversy
- How to Bake Cookies
- The Cookie Viewer
- Creating a Cookie
- Creating Cookies with an Expiration Date
- Where Are Persistent Cookies Kept?
- Manually Expiring Cookies
- How Many Cookies Per Box?
- Chapter Summary
- Chapter 12 The Bug Tracker
- Authenticating Bug Tracker Users
- User Accounts in the db.tcl Package
- The bugt.cgi Program
- The Login Screen
- The Browser Window
- Logging into the Database
- Creating the Authentication Cookie
- The HTML Template
- Building the Browse List
- Building the Filter
- The View Entry Screen
- Using Hidden Fields
- The Edit Entry Screen
- The New Entry Screen
- Chapter Summary
- Chapter 13 Building Gateways to Your Data
- Database Overview
- The Flat File Database
- The Relational Model
- The Entity Relationship Diagram
- The OraTcl Package
- Connecting to the Oracle Database
- Oracle and Cursors
- Using SQL under OraTcl
- Building the Test Database
- Retrieving Query Results with the orafetch Command
- Examining the Database from the Tcl Shell
- OraTcl Inside Your CGI Scripts
- Getting the Company Profile
- Obtaining the Drive List
- Getting the Drive Statistics
- Chapter Summary
- Chapter 14 Expect in CGI Scripts
- A Quick Tour of Expect
- The send Command
- Matching Input with Expect
- The spawn Command
- The Web Login Application
- Chapter Summary
- Chapter 15 The Tcl Browser Plug-In
- What Is a Browser Plug-In?
- The Pros and Cons of Using the Browser Plug-In
- Obtaining and Installing the Plug-In
- Your First Tclet
- Referencing Script Files with the SRC Attribute
- The "HELLO WORLD" Form Application
- Security Policies
- Default Error Handling
- Building Your Own Error Handling
- Streams and the JavaScript Policy
- The Mortgage Calculator Revisited
- The Client-Server Approach
- Screen Validation with the trace Command
- The Monthly Payment Screen
- Reusing the Tclet's Main Window
- The Client-Side Application
- Chapter Summary
- Chapter 16 A Tcl Chat Room
- Understanding Tcl Sockets
- Creating the Server
- Accepting Client Connections
- Configuring the Client Connection
- Establishing the Callback Procedure
- Servicing the Client Connection
- The Client
- Putting Your Clients on the Web
- Examining the Tclet
- Chapter Summary
- Appendix A HTML Reference Guide
- Basic HTML Page Layout
- Most Commonly Used HTML Code
- Headings
- Lists
- Dot Points (Unordered Lists)
- Enumerated Lists (Ordered Lists)
- Tables
- Forms
- Appendix B Tcl Language Summary
- Working with Variables
- How Tcl Evaluates Commands
- Comment Lines and Line Separators
- Variable Substitution
- Command Substitution
- Backslash Substitution
- Grouping with Quotes
- Grouping with Braces
- Return Values in Tcl
- String Manipulation
- Tcl Lists
- Creating Lists: list, lappend, concat
- Lists: llength, lindex, lsearch
- Manipulating Lists: linsert, lreplace, lsort
- Tcl Arrays
- Multidimensional Arrays
- The array Command
- Getting Array Info: array exists, array names, array size
- Searching Arrays:
- Converting Arrays to Lists: array get
- Converting Lists to Arrays: array set
- Pattern Matching
- Control Flow Commands
- Conditional Statements
- Looping: for, foreach, while
- File Access Commands
- Opening and Closing Files: open, close
- Command Pipelines
- Connecting to Serial Devices
- Interfacing to the File System
- File I/O: puts, gets
- Procedures
- The return Command
- Forcing Errors with the return Command
- Catching Errors with the catch Command
- Default Argument Values in Procedures
- Passing Variable Number of Arguments to Procedures
- Passing by Reference with the upvar Command
- Network Communication
- Querying Tcl Internals
- Organizing Your Code
- The source Command
- The package Command
- Namespaces
- Appendix C cgi.tcl Reference
- Procedure Summary
- Understanding the cgi.tcl Output
- Library Call Reference
- Appendix D The Web Browser Plug-In
- Overview
- Obtaining and Installing the Plug-In
- Plug-in Configuration Files
- Making It Safe
- The Safe Interpreter
- The Plug-in Security Model
- Plug-in Features
- Browser Namespaces
- The Network Feature
- The Persist Feature
- The Stream Feature
- The Unsafe Feature
- The URL Feature
- Security Policies
- Understanding the Configuration File Format
- Examining the home Policy
- Understanding the Risks
- Integrity Risks
- Privacy Risks
- Loss of Reputation
- Annoyance and Resource Attacks
- The Plug-in Logging Facility
- The Plug-in Console
- Bibliography
- RFCs
- Books
- Index
L'auteur - David Maggiano
has worked with Motorola for more than sixteen years. He
has used Tcl and Expect to build complex regression test
suites that are used to test the embedded firmware shipped
with most of the Motorola Computer Group's systems
controller boards. In addition, for Web application
development, including interfaces to back-end databases, he
uses Tcl exclusively.
Caractéristiques techniques
PAPIER | |
Éditeur(s) | Addison Wesley |
Auteur(s) | David Maggiano |
Parution | 10/12/1999 |
Nb. de pages | 534 |
EAN13 | 9780201606294 |
Avantages Eyrolles.com
Consultez aussi
- Les meilleures ventes en Graphisme & Photo
- Les meilleures ventes en Informatique
- Les meilleures ventes en Construction
- Les meilleures ventes en Entreprise & Droit
- Les meilleures ventes en Sciences
- Les meilleures ventes en Littérature
- Les meilleures ventes en Arts & Loisirs
- Les meilleures ventes en Vie pratique
- Les meilleures ventes en Voyage et Tourisme
- Les meilleures ventes en BD et Jeunesse