CGI Programming with Perl (3 days)





Synopsis

This course teaches the student to create Perl-based CGI scripts to provide dynamic content on web pages. In addition to standard form processing, such topics as server-side includes, cookies, and image maps will be covered.

One often-overlooked topic provided by this course is the use of HTML templates -- predefined web pages that can be "filled in" with data. This allows a web designer to do the actual HTML layout, freeing the programmer to concentrate on the data.

This fast-paced course emphasizes practical techniques and wherever possible uses standard, freely available software (e.g. Perl modules) to prevent "reinventing the wheel".



Target audience

This course is for web programmers.

Prerequisites

To successfully complete this course, the student must have a basic knowledge of Perl. No CGI experience is required.

Lab exercises

This course provides many hands-on labs which begin with simple CGI scripts which process URL information, building up to template-driven HTML output with form processing and correction

Course materials

Students will receive a course manual that includes useful appendixes; all files used in the class, as well as answers to exercises, are available online.

Course Outline

1.Perl Refresher

  • strict and warnings
  • References
  • Arrays and hashes
  • Objects
  • Files and text
  • Subroutines

2. CGI Overview

  • Before CGI
  • Static vs dynamic content
  • Understanding HTTP
  • Calling CGI Scripts
  • GET and POST methods
  • CGI output options
  • Alternatives to CGI

3.Using CGI.pm

  • Getting started
  • Function sets
  • Getting Parameters
  • Basic output
  • HTML Shortcuts
  • Creating links

4.HTML forms

  • Form widgets
  • Processing form data
  • Multi-select widgets
  • Multipart forms

5.Validating Input

  • Client-side vs server-side validation
  • Quick intro to JavaScript
  • Javascript functions
  • Validating forms

6.Template Toolkit

  • Why use templates?
  • What templates are available
  • Basic template creation
  • Painless template processing
  • Generating lists
  • Generating links

7.Multipage Applications

  • CGI and state
  • Hidden fields
  • Cookies
  • Embedded links
  • Errors and exceptions

8.Web site security

  • Authorization and authorization
  • Access control
  • Storing passwords
  • Authentication methods
  • using escapeHTML()
  • Creating sessions

9.Advanced Topics

  • Writing form data to files
  • Uploading files
  • Advanced headers
  • Database access


Downloadable files for this course:

Return to course list