Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Different responses from different systems

Reply
Thread Tools

Different responses from different systems

 
 
Tigerhillside
Guest
Posts: n/a
 
      02-22-2004
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]


 
Reply With Quote
 
 
 
 
Tigerhillside
Guest
Posts: n/a
 
      02-22-2004
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
<(E-Mail Removed)>, I read and responded

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


 
Reply With Quote
 
 
 
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      02-22-2004
Tigerhillside wrote:
> 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.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

 
Reply With Quote
 
Joe Smith
Guest
Posts: n/a
 
      02-23-2004
Tigerhillside wrote:

> #!/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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Voip PBX,Private Phone Systems,PBX Telephone Systems, Business Phone Systems broadbandera@gmail.com UK VOIP 9 07-24-2006 03:44 PM
Re: Voip PBX,Private Phone Systems,PBX Telephone Systems, Bu George Orwell UK VOIP 0 07-23-2006 05:35 PM
ASP.NET version - 2 different responses Kevin C ASP .Net 3 10-20-2004 08:04 PM
Any computer systems match good home systems? Richard DVD Video 7 08-24-2004 02:54 AM
java as a systems administration/systems programming language? Mike Java 2 06-17-2004 03:33 PM



Advertisments