--- Advance Design - Vance <[EMAIL PROTECTED]> wrote:
> Hello Curtis,
>
> I am just returning a complete html document from the perl file ...
Vance,
It sounds like that could be the problem. Generally, when printing a Web page from a
CGI script,
you need to supply a content-type header to let the user agent (browser, in this case)
know what
type of content it's dealing with. If you're not doing that, your Web server might be
doing that
for you and sending a default of 'text/plain', or perhaps it's not sending it at all
the the
browsers are using defaults? Tough to say what's going on here.
If you are not printing anything before the Web page, try printing the following:
print "Content-type: text/html\n\n";
That will add the content-type header.
Even better, try this (tougher to make a typo with this method):
use CGI qw/:standard/;
print header();
It sounds like you may be a little unsure as to what is meant by headers, so I'll try
to explain,
just in case.
Your browser, when you request a resource from a Web server, will issue a request.
There are many
different request methods, but for CGI programmers, you will primarily be dealing with
GET and
POST requests. A typical request sent from your browser to the server may resemble
the following:
POST /cgi-bin/somescript.cgi HTTP/1.1
Accept */*
Accept-Language: en-us
Accept-encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows NT)
Host: www.someserver.com
Connection: Keep-Alive
color=red&name=Ovid
Note that this request is split into two sections. The first section is comprised of
the headers
and the second section is the "entity body", or just "body". Since this is a POST
request (see
first line), "form" data is put in the entity body. If this were a GET request, there
would be no
body and the first line would be something like (note the query string moved from the
body)
GET /cgi-bin/somescript.cgi?color=red&name=Ovid HTTP/1.1
For a get request like the one above, you'll see something like the following in the
address bar
of your browser:
http://www.someserver.com/cgi-bin/somescript.cgi?color=red&name=Ovid
The Web server receives the request and passes your query information to the CGI
script. When the
CGI script responds, it is expected to send at least a Content-type header (unless
your using
non-parsed header scripts, which I won't go into now) or a status header (which I also
won't go
into now). Your Web server supplies the rest of the headers. Here's a typical
response: a Web
page sent by a script:
HTTP/1.1 200 OK
Date: Thu, 23 Sep 2001 06:23:19 GMT
Server: Apache/1.3.6 (Unix)
Last-Modified: Mon, 20 Sep 2001 08:19:56 GMT
ETag: "2f5cd-9640381-e1bd6"
Accept-Ranges: bytes
Content-length: 4295
Connection: close
Content-type: text/html
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>base-02.html</title>
etc.
Note that we again have headers and a body, just as an HTML document has a head and
body, but
we're talking apples and oranges here. Your script is expected to at least specify the
content-type (note the last line of the headers) and the Web server usually provides
the rest of
the headers. The two newlines between the headers allows your browser to know where
the headers
stop and the entity-body begins. Typically, when you "view source" in a Web browser,
you're
seeing *only the entity-body* of the document that's been returned.
Hope this clears up the confusion. For more information, you can read
http://www.easystreet.com/~ovid/cgi_course/.
Cheers,
Curtis Poe
=====
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
"Ovid" on http://www.perlmonks.org/
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]