squeak!
Syllabus Homepage
Course Overview
Course resources
Day 1
Day 2
Day 3
Day 4
Common errors
Internet Glossary
About Your Instructor
Credits: This site powered by the vi text editor, apache webserver, perl scripting, and Debian linux.
squeak!

CGI/Perl - Day 1

Admin

Texas state survey and Roll.

Overview

In this session you learn the basic concepts of CGI: what is happening and what are the terms. You will be able to recognize what your local cgi wizard is talking about, though you may not yet be able to "roll your own" yet.
  • Intro to intro: what you need to know to run cgi
    • how a browser and server work (this time!)
    • how the server's os works (next time!)
    • how your cgi language works (not!)
  • Recap (When will this end???)
    • How a browser works
      • Requesting a [copy of a] document GET
      • Incoming! What kind of file is this? (hint to browser: read the headers! Prompt user if if there's no defined mime type...)
      • If html, parse for html markup
      • download simultaneously, up to max connections
      • display however it thinks best, asap
      • drop connections to webserver as soon as they complete (you no longer have any relationship to the server)
    • How a server works
      • software v. hardware
      • daemon
      • serving docs
        • statelessness
        • the header info (especially mime types, http-equiv)
        • the file itself
        • statelessness
    • How CGI works
  • What does CGI mean?
  • Why CGI?
    • http is stateless, a common aspect of efficient retrieval environments.
      • You can simulate state by saving contextual information in ...
        • The request (cgi!) search engines, etc
        • The client with server backend (cookies!) shopping carts
    • you can have dynamic/interactive pages (stupid cgi tricks)
      • calculations
      • generated stuff like optimizing graphics
      • form parsing and validation
      • database backends
  • Why not [fitb]?
    • server-side
      • Active Server Pages .asp (MS; VBScript, VB)
      • Cold Fusion .cfm proprietary server-side embedded scripting language. ISAPI or Apache module. Cross platform.
      • PHP .php open source server-side embedded scripting language. ISAPI or Apache module. (CF-beater) Cross platform.
      • java .jsp, for example
    • client-side
      • javascript for light clientside scripting; compatibility issues. ECMAscript.
      • java applets, for example
  • Common cgi languages
    • shell
    • perl
      • Why perl?
        • most common cgi language (lemming effect)
        • Swiss Army Chainsaw of the www
        • nifty text handling
        • It's free
        • portable
      • simplest example
      • source
    • c
      • why c?
        • well known
        • seriously fast
        • easy on the server
        • gcc (free) on many servers
        • portable
      • simplest example
      • source
    • whatever else you've got
  • Common applications

Practicum: Hello, world

  1. run it from the command line
  2. run it from the browser
  3. tail those logs!

Environmental Variables

  • QUERY_STRING
  • HTTP_REFERER (not a typo)

a simple redirector

Location: \n\n

Homework

Read up on perl references.


http://www.mousetrap.net/syllabus/cgiperl/day1.html
$Id: day1.orb,v 1.6 2002/08/20 13:04:41 mouse Exp $

Remember, your login is based on your machine's hostname, not on any other number.
~/[initials] refers to the subdirectory under your homedir, named after your initials. Everything except for .dotfiles will be stored in your ~/[initials] directory.


© 1995-2001 jason carr
Distributed under the terms of the GNU Free Documentation License.