T
Tigerhillside
I have an odd problem with my perl script. The code follows, but
here is the problem. I have a simple script, s.pl, that sends
back the time as a web page and write the calling parameters to a
file. (This will, of course, do more eventually, I just want to
make sure that some other script properly calls this script.)
When I run s.pl from the command line on my windows system it
works just fine. The html returned is correct, the correct stuff
goes into the file. I then put it on my Apache server. When I run
it from the command line (perl s.pl abc=def) on that server I get
the following results in the file:
Sorry: Sat Feb 21 20:20:22 2004
page:
c_regex:
root_selected:
do: fileman
txt_input: perl s.pl abc=def
c_content:
work_path: html/cgi-bin
working_dir: /usr/home/web/users/a0017412/html/cgi-bin
c_case:
cmd_do: cmd_command
scope:
More oddly, when I call this from a browser I get the right stuff
in the file, but I get a 500 Internal Server Error returned. So
there is something odd going on, but I can't figure out what.
(BTW, I know there are easier ways to do the following, but I am
new to perl and have sort of grown and shrunk this script during
debugging.)
[begin code]
#!/usr/bin/perl -w
use CGI;
$query = new CGI;
use Time::localtime;
local *MYFILE;
my $myfilename;
$myfilename = "./a.txt";
open ( MYFILE, ">>$myfilename" ) || die("can't open datafile:
$!") ;
my $now;
$now = ctime();
print (MYFILE "\r\nSorry: $now\r\n" );
my $params;
$outQuery = new CGI;
print $query->start_html("Credit Card Problem Page");
print $outQuery->header;
print "Sorry: $now";
print $outQuery->end_html;
my %parmHash;
%parmHash = $query->Vars;
my($key, $value);
while ( ($key, $value) = each(%parmHash) )
{
if ( $key ne "session_id" ) {
print (MYFILE $key );
print (MYFILE ": " );
print (MYFILE $value );
print (MYFILE "\r\n" );
}
}
[end code]
here is the problem. I have a simple script, s.pl, that sends
back the time as a web page and write the calling parameters to a
file. (This will, of course, do more eventually, I just want to
make sure that some other script properly calls this script.)
When I run s.pl from the command line on my windows system it
works just fine. The html returned is correct, the correct stuff
goes into the file. I then put it on my Apache server. When I run
it from the command line (perl s.pl abc=def) on that server I get
the following results in the file:
Sorry: Sat Feb 21 20:20:22 2004
page:
c_regex:
root_selected:
do: fileman
txt_input: perl s.pl abc=def
c_content:
work_path: html/cgi-bin
working_dir: /usr/home/web/users/a0017412/html/cgi-bin
c_case:
cmd_do: cmd_command
scope:
More oddly, when I call this from a browser I get the right stuff
in the file, but I get a 500 Internal Server Error returned. So
there is something odd going on, but I can't figure out what.
(BTW, I know there are easier ways to do the following, but I am
new to perl and have sort of grown and shrunk this script during
debugging.)
[begin code]
#!/usr/bin/perl -w
use CGI;
$query = new CGI;
use Time::localtime;
local *MYFILE;
my $myfilename;
$myfilename = "./a.txt";
open ( MYFILE, ">>$myfilename" ) || die("can't open datafile:
$!") ;
my $now;
$now = ctime();
print (MYFILE "\r\nSorry: $now\r\n" );
my $params;
$outQuery = new CGI;
print $query->start_html("Credit Card Problem Page");
print $outQuery->header;
print "Sorry: $now";
print $outQuery->end_html;
my %parmHash;
%parmHash = $query->Vars;
my($key, $value);
while ( ($key, $value) = each(%parmHash) )
{
if ( $key ne "session_id" ) {
print (MYFILE $key );
print (MYFILE ": " );
print (MYFILE $value );
print (MYFILE "\r\n" );
}
}
[end code]