Different responses from different systems

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]
 
T

Tigerhillside

BTW, I have gone through the troubleshooting steps and those
don't help. My script "works", that is, it compiles with strict,
gives no warnings, does what it is supposed to do, but still
gives the error.

In comp.lang.perl, Tigerhillside
 
G

Gunnar Hjalmarsson

Tigerhillside said:
when I call this from a browser I get the right stuff in the file,
but I get a 500 Internal Server Error returned.

See reply in the existing group alt.perl.
 
J

Joe Smith

Tigerhillside said:
#!/usr/bin/perl -w
use CGI;

use CGI::Carp 'fatalsToBrowser'; # Avoid "500 Server Error"
$myfilename = "./a.txt";

What directory is this file going to be created in?
Different web servers do different things.
You should use an absolute pathname, or do an
explicit chdir("/usr/home/web/users/a0017412/html").

-Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top