Click Here!
home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Perl CGl Programming: No experience required.
(Publisher: Sybex, Inc.)
Author(s): Erik Strom
ISBN: 0782121578
Publication Date: 11/01/97

Bookmark It

Search this book:
 
Previous Table of Contents Next


Audio and Video

Audio and Video types will be interpreted by the Web server as video files in MPEG format or basic sound files, which at this writing means Sun Microsystems-type AU files. Many extensions have been written, but Microsoft-type WAV files are not yet part of the MIME standard—nor are MIDI files.

Image

The server will expect picture files in either GIF or JPEG (.jpg) format. The Image content-type is important because many new browsers, chiefly Netscape Navigator and Microsoft Internet Explorer, can translate (from MIME-encoding) and display these images directly.

Message

The Message type is an “encapsulated” message. If it is specified in the header, the data must be in the form of a fully formatted message that complies with RFC 822, the Internet Mail Header protocol.


TIP:  RFC stands for Request for Comment. The body of RFCs is where most of the standards of the Internet are defined.

Of the other two subtypes, Partial allows you to send a message in parts to a server that can only accept messages of a certain size. Juno’s free e-mail service is an example of this: It will reject messages larger than about 65,000 bytes.

The External-Body type allows the message to refer to an external source for data, such as a database on another system.

Multipart

View the document source of a message you have received with a file attached and you’ll see how the Multipart type works (see Figure 3.7). Mixed is the subtype used most often. It allows messages to contain more than one type of data. Your message will define a “boundary,” which is a coded string, then it will mark off the portions of the message—text here, MIME-encoded data here—with the coded boundary.


Figure 3.7:  The source text of a Multipart document

Text

This type is the easiest of all—just plain text, so no fancy formatting or translation is needed.

Oddly, the html subtype is not considered a standard MIME type, though it is among the most common uses of the type.


EXERCISE:  The Sambar Server: Building Your Web Site

You can improve the look and function of your budding Web site by expanding on the Perl and HTML software you wrote in this skill. Here’s how:

  Create your own home page, using the techniques of good design that you know from HTML, and replace the default Sambar home page with it. The Sambar server regards its root directory as the docs directory immediately following it. The default Sambar installation would put it in c:\Program Files\Sambar\docs. Replace the index.htm file in that directory with your new home page.
  Using the additional knowledge of Perl and CGI that you have gained from this skill, make another HTML page to display the environment variables and link to it from your new home page. Sambar’s default directory for CGI programs is c:\Program Files\Sambar\cgi-bin. Put your Perl script there.
  Try to think of ways in which you could improve on the design/display of the environment variables. For example, you could define each of the variable names as a hyperlink; clicking on the link would bring up the vari-able description.

Moving On

You’ve learned about the CGI environment and how to read and manipulate it in this skill. You’ve also learned a little more about MIME and its relationship with the World Wide Web.

In Skill 4, you will write your first real-world CGI program—an application that counts the number of people who have connected with your Web site.

Are You Experienced?

Now you can…

  identify some of the common environment variables used in CGI
  write a Perl program to display the values on a Web page through CGI
  manipulate Perl associative arrays with each, foreach, keys, sort, and while
  understand the common MIME content types and their subtypes


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited.