Hi
Im having trouble with the following code that seems to be behave
differently when called from the browser as opposed to the command
line. The calling script is a cgi that forks, with the child trying to
call another cgi script and pass arguments to it. It works fine from
the command line, and calls the required script and passes the
arguments correctly. However, when it is run on the browser, it calls
the script but does not pass the arguments to it.
The called script (included) is also a cgi, set up to accept
parameters via the param function. It accepts the parameters when the
calling script is run on the command line, but not when the calling
script is run on the browser.
I have also tried putting a '?' between the script name and the
arguments to get the "script.cgi?argument=1" format, and that didnt
work either.
Im not sure if the problem is in the system call, the use of CGI in
the called script, or somewhere else entirely. Any suggestions would
be extremely helpful...
Thanks in advance
Shailan
#### Calling script
if (my $pid = fork){
while (waitpid(-1,&WNOHANG) != $pid){
print ".";
sleep 2;
}
print qq{
</body>
</html>
};
exit;
}
else {
die "Cannot fork: $!\n" unless defined $pid;
#### Call the actual processing script.
print "Executing $program $args\n";
! system("perl", "$program", $args) or die "Call failed: $!";
#print $output;
exit;
}
#### End Calling script
#### Called script
#!/usr/local/bin/perl
use CGI;
use strict;
my $query = new CGI;
my $sleep_time = $query->param("sleep");
my @params = $query->param;
print "Content-type: text/html\n\n";
print qq{
<html>
<head><title>INF</title>
</head>
<body>
@params
};
for (my $i = 0; $i < 10; $i++){
print "Working\n";
sleep $sleep_time;
}
print qq{
Sleep time was $sleep_time<br>
Finished
</body>
</html>
};
exit;
#### End Called script 2 4720
The problem is the called CGI program is no longer a "CGI". It is just a
regular program. You should look for the parameters from the command line,
instead of using $query->param, which fetches the param from env var
QUERY_STRING, of course it is empty in this case.
So try to get the param from command line, like regular program in you
called "CGI" program like this,
$ARGV[0] $ARGV[1] ....
You will be doing fine
"Shailan" <sh*****@ureach.com> wrote in message
news:f8**************************@posting.google.c om... Hi
Im having trouble with the following code that seems to be behave differently when called from the browser as opposed to the command line. The calling script is a cgi that forks, with the child trying to call another cgi script and pass arguments to it. It works fine from the command line, and calls the required script and passes the arguments correctly. However, when it is run on the browser, it calls the script but does not pass the arguments to it. The called script (included) is also a cgi, set up to accept parameters via the param function. It accepts the parameters when the calling script is run on the command line, but not when the calling script is run on the browser.
I have also tried putting a '?' between the script name and the arguments to get the "script.cgi?argument=1" format, and that didnt work either.
Im not sure if the problem is in the system call, the use of CGI in the called script, or somewhere else entirely. Any suggestions would be extremely helpful...
Thanks in advance Shailan
#### Calling script
if (my $pid = fork){ while (waitpid(-1,&WNOHANG) != $pid){ print "."; sleep 2; }
print qq{ </body> </html> };
exit; } else { die "Cannot fork: $!\n" unless defined $pid;
#### Call the actual processing script.
print "Executing $program $args\n"; ! system("perl", "$program", $args) or die "Call failed: $!"; #print $output;
exit; }
#### End Calling script #### Called script
#!/usr/local/bin/perl
use CGI; use strict;
my $query = new CGI; my $sleep_time = $query->param("sleep"); my @params = $query->param;
print "Content-type: text/html\n\n"; print qq{ <html> <head><title>INF</title> </head> <body> @params };
for (my $i = 0; $i < 10; $i++){ print "Working\n"; sleep $sleep_time; }
print qq{ Sleep time was $sleep_time<br> Finished </body> </html> };
exit; #### End Called script
Thanks Alex...that clears it up.
"Alex Zeng" <al*******@digi-go.com> wrote in message news:<eN********************@comcast.com>... The problem is the called CGI program is no longer a "CGI". It is just a regular program. You should look for the parameters from the command line, instead of using $query->param, which fetches the param from env var QUERY_STRING, of course it is empty in this case.
So try to get the param from command line, like regular program in you called "CGI" program like this,
$ARGV[0] $ARGV[1] ....
You will be doing fine
"Shailan" <sh*****@ureach.com> wrote in message news:f8**************************@posting.google.c om... Hi
Im having trouble with the following code that seems to be behave differently when called from the browser as opposed to the command line. The calling script is a cgi that forks, with the child trying to call another cgi script and pass arguments to it. It works fine from the command line, and calls the required script and passes the arguments correctly. However, when it is run on the browser, it calls the script but does not pass the arguments to it. The called script (included) is also a cgi, set up to accept parameters via the param function. It accepts the parameters when the calling script is run on the command line, but not when the calling script is run on the browser.
I have also tried putting a '?' between the script name and the arguments to get the "script.cgi?argument=1" format, and that didnt work either.
Im not sure if the problem is in the system call, the use of CGI in the called script, or somewhere else entirely. Any suggestions would be extremely helpful...
Thanks in advance Shailan
#### Calling script
if (my $pid = fork){ while (waitpid(-1,&WNOHANG) != $pid){ print "."; sleep 2; }
print qq{ </body> </html> };
exit; } else { die "Cannot fork: $!\n" unless defined $pid;
#### Call the actual processing script.
print "Executing $program $args\n"; ! system("perl", "$program", $args) or die "Call failed: $!"; #print $output;
exit; }
#### End Calling script #### Called script
#!/usr/local/bin/perl
use CGI; use strict;
my $query = new CGI; my $sleep_time = $query->param("sleep"); my @params = $query->param;
print "Content-type: text/html\n\n"; print qq{ <html> <head><title>INF</title> </head> <body> @params };
for (my $i = 0; $i < 10; $i++){ print "Working\n"; sleep $sleep_time; }
print qq{ Sleep time was $sleep_time<br> Finished </body> </html> };
exit; #### End Called script This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Pjotr Wedersteers |
last post by:
Hi,
When I include a script in my html I don't get any output back in the
calling page.
The script is on a remote location for the html page. Example given:
myscript.php:
<?PHP
echo...
|
by: Roger |
last post by:
Are these two features available in VS.Net 2003 at all (maybe different
keys)...
F4 to go thru find-in-files search results (just like you F4 to go thru
build errors). In VC6, if output window...
|
by: Simula |
last post by:
I am developing an HTML javascript application and I want to preserve
state in a way that can be book-marked. I chose HTML anchors as a means
of preserving state. When the application changes...
|
by: Phil Stanton |
last post by:
When designing a new form or report, the Default ForeColor is often
something like -2147483640 which is the colour of Windows text (possibly
black) and the default backColor is -2147483643...
|
by: sugaray |
last post by:
Right now, the code I wrote below seems works fine, i know it's definitely
not the best solution, so if there are better solutions to
eschew from using goto statements to jump out of multiple loops...
|
by: kernelxu |
last post by:
hi,everybody.
I calling function setbuf() to change the characteristic of standsrd
input buffer.
some fragment of the progrem is:
(DEV-C++2.9.9.2)
#include <stdio.h>
#include <stdlib.h>
int...
|
by: |
last post by:
I have a breakpoint in an aspx page that I'm using to try to trap some code
to see what's going on. I'm translating a page that is working in a
traditional ASP page, which takes several session...
|
by: Cleo |
last post by:
Hi,
I am trying to call a WebService Method written in Weblogic from VB.NET and
I am getting the following error. I am using SOAP Caal s from VB.NET.
Please find the wsdl file and my code.
...
|
by: souporpower |
last post by:
Hello All
I am trying to activate a link using Jquery. Here is my code;
<html>
<head>
<script type="text/javascript" src="../../resources/js/
jquery-1.2.6.js"</script>
<script...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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,...
|
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...
| |