473,398 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Different responses from different systems

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]
Jul 19 '05 #1
3 1622
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
<Ti*****************@removenetscape.net>, 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]


Jul 19 '05 #2
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

Jul 19 '05 #3
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
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ayesha Ahsan | last post by:
Hi, I use Runtime.getRuntime().exec(command) to make my system call. For Windows based Dos, i add "cmd /c" before I type in my system call. So for example make the system call "dir": String...
137
by: Philippe C. Martin | last post by:
I apologize in advance for launching this post but I might get enlightment somehow (PS: I am _very_ agnostic ;-). - 1) I do not consider my intelligence/education above average - 2) I am very...
1
by: Avanish Pandey | last post by:
Hello All We have 3 differen services (in 3 different server) Service A,B,C . We want to implement distributed transaction when call methods of B and C from A. Is it possible? if yes then how? ...
5
by: sql-db2-dba | last post by:
We have DB2 UDB v8.1 fixpak3 on AIX 5. Production and Development configuarations (at least for DB2) are identical albeit production is a 2-way server while development has only one processor....
3
by: Kevin C | last post by:
I am load balancing between 2 servers. Both servers report as running 1.1 of the framework but I am getting 2 different responses from each server: Note the difference in the javascript postback...
17
by: romixnews | last post by:
Hi, I'm facing the problem of analyzing a memory allocation dynamic and object creation dynamics of a very big C++ application with a goal of optimizing its performance and eventually also...
9
by: AimeeRae | last post by:
Ok. Another tricky Access question. Same database, different querry. I have a table called tbl_Responses and my tbl_Airing…similar to my question about linking Airings to Rates, I now need to...
7
by: Gilles Ganault | last post by:
Hello I was wondering: Are template engines like CakePHP and Smarty, or caches like APC etc. worth it, even if the contents of the SELECT from MySQL differs from user to user? Thank you.
87
by: pereges | last post by:
I have a C program which I created on Windows machine. I have compiled and executed the program on windows machine and it gives me the consistent output every time i run it. for eg. input a = 2,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.