[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cobalt-users] CGI on RaQ2 ... ???
- Subject: Re: [cobalt-users] CGI on RaQ2 ... ???
- From: "WebMost" <dbugger@xxxxxxxxxxx>
- Date: Thu Jan 20 08:28:04 2000
Ahoy Rusty
You ask:
_________________
Can anyone point me to some documentation on how the perl works on a RaQ2.
I have a perl script that will work from the shell over telnet (./test.cgi)
however the webserver reports that there was an error:
"The server encountered an internal error or misconfiguration and was
unable to complete your request"
The script is very simple for testing.
#!/usr/bin/perl
print "test\n";
__________________
The problem here is not how Perl works on the RaQ2. The problem is how CGI
works anywhere. It has to spit back something to the browser, not to the
shell.
Take a look at your little test script. It prints to STDOUT, not to the
browser. If you are running it via telnet, it prints "test" and you see it.
If you want to print to the browser, you are not looking at that screen, so
you must tell the output to be html. Otherwise, the script just ends and the
server has nothing to send to the user except an error message. That's why
the request was incomplete.
Try this:
__________________
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "test\n";
exit;
__________________
You see the difference? The "Content-type: text/html"; identifies the
output, and the two line returns "\n\n" make it happen.
Another way is:
_________________
#!/usr/bin/perl
print <<"end_test";
Content-type: text/html
test
end_test
exit;
__________________
This way, you don't require a "print" statement for each line, nor do you
have to escape quotes.
As for your second puzzlement, you write:
_________________
The preconfigured script "gform" works, however only after the file name was
changed to "gform.cgi"
__________________
Of course. This is because the server directives instruct the server to
regard files with the extension ".pl" or ".cgi" as CGI scripts. They do not
instruct the server to regard files without extensions as anything.
I suggest you get a good Perl book. Here's how you know if it is good:
Do not read ANY of the book to try to determine if it is the one for you. At
first, it will all be Greek to you. So long as it is not unduly obfuscated,
just pay attention to these three rules:
1) It should be four inches thick
2) The binding should be able to withstand years of thumbing through it
daily
3) MOST IMPORTANTLY: It must have a good index.
The index is really the crux of the matter. Can you look up, for instance,
tables of comparison operators and lists of functions with their syntax,
etc.? If nothing else, is the index BIG?
Don't worry. Someday soo, it will all be second nature to youj.
Aloha
Davis