I am writing a perl cgi script.
Are you? I was almost sure that you had just copied some code from a very old document on the web.
all I get is the script itself in the browser.
That problem has nothing to do with the script in itself, but it is a web server issue.
In the options for the directory on my server I have included ExecCGI and also the script has read/execute access for anybody
Sounds right. Did you upload the script in ASCII mode? Does the server understand the .cgi file extension, or was it configured to only accept a .pl extension?
If that doesn't help, please follow Chris's advice and use a minimal script when trying to make the server work.
Besides the immediate problem, the code you showed is very old, and I have a feeling that you need a re-start as regards CGI scripts written in Perl. Take a look at the suggestions at the top of
http://cgi.resourceindex.com/Documentation/CGI_Tutorials/
A few comments on the Perl code:
#! /usr/bin/perl
That line is almost okay. It's ususally written without the space, though (I don't know if that makes a difference.)
#! /usr/bin/perl
print "Content-type: text/html\n\n";
&ReadParse;
It would be wise to replace those lines with:
use CGI::Carp 'fatalsToBrowser'; use strict; use warnings; use CGI;
my $query = new CGI; print $query->header;
my %in = $query->Vars;
print "<title> The Response</title>"; print "Here is the form data:<ul>";
foreach $key (keys %in) {
Make that
foreach my $key (keys %in) { ------------^^
(When using strict, your variables need to be declared, usually with my().)
print "<li>$key: $in{$key}"; }
print "and here are all the environment variables:<ul>"; foreach $key (keys %ENV) {
... and that
foreach my $key (keys %ENV) { ------------^^
print "<li>$key: $ENV{$key}"; } print "</ul>";
If you make those changes, you can drop the whole ReadParse() subroutine. That routine is Perl 4 code, and today we use Perl 5. ;-)
-- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>