I have CGI working. Now I have a question about having one cgi script
execute another script (both simple enough to be appended below).
I can run either within Emacs, or from a commandline, and get the obvious
output. Running format_test I get the following output:
Content-type: text/html
<HTML><HEAD>
<TITLE>Arrays</TITLE>
</HEAD>
<BODY>
a 0.0550001 0.06 $0.06<br>
b 150.3449 150.34 $150.34<br>
c 1158.435 1158.43 $1,158.43<br>
mc -1158.435 -1158.43 $-1,158.43<br>
d 100256147.258 100256147.26 $100,256,147.26<br><br><br>
<PRE>\n12
13
2
3
</PRE>\n</BODY>
No surprises. However, when the same script is executed as a cgi script,
the output from array2d.pl is missing:
<HTML><HEAD>
<TITLE>Arrays</TITLE>
</HEAD>
<BODY>
a 0.0550001 0.06 $0.06<br>
b 150.3449 150.34 $150.34<br>
c 1158.435 1158.43 $1,158.43<br>
mc -1158.435 -1158.43 $-1,158.43<br>
d 100256147.258 100256147.26 $100,256,147.26<br><br><br>
<PRE>\n
</PRE>\n</BODY>
I do not get any error messages at all.
Why am I not getting any output at all from the child processes? I NEED to
be able to invoke another perl script, ideally from another directory
outside the Tomcat directory tree, have it complete successfully and return
a message to that effect. In due course, I will use the perl cgi package
and redirect the browser to a JSF page in my web app, hopefully maintaining
the session prviously established by my app.
Help getting this working would be greatly appreciated.
Thanks
Ted
====Appendix==========================
Here are two trivially simple scripts:
#array2d
# I used this to help a colleague learn the basics of using arrays in Perl.
use strict;
my @matrix;
my @vector = [1,2,3];
push (@matrix,@vector);
@vector = [11,12,13];
push (@matrix,@vector);
print "$matrix[1][1]\n";
print "$matrix[1][2]\n";
print "$matrix[0][1]\n";
print "$matrix[0][2]\n";
And here is the main CGI script (derived from a script I used to help a
colleague learn about formatting numbers in Perl)
#format_test.pl
#!c:/perl/bin/perl.exe
use strict;
print <<"END";
Content-type: text/html
<HTML><HEAD>
<TITLE>Arrays</TITLE>
</HEAD>
<BODY>
END
my $a = 0.0550001;
my $b = 150.3449;
my $c = 1158.435;
my $mc = -1158.435;
my $d = 100256147.258;
my $rv1a = sprintf("%.2f",$a);
my $rv1b = sprintf("%.2f",$b);
my $rv1c = sprintf("%.2f",$c);
my $rv1mc = sprintf("%.2f",$mc);
my $rv1d = sprintf("%.2f",$d);
my $rv2a = commify($rv1a);
my $rv2b = commify($rv1b);
my $rv2c = commify($rv1c);
my $rv2mc = commify($rv1mc);
my $rv2d = commify($rv1d);
print "a\t$a\t$rv1a\t\$$rv2a<br>\n";
print "b\t$b\t$rv1b\t\$$rv2b<br>\n";
print "c\t$c\t$rv1c\t\$$rv2c<br>\n";
print "mc\t$mc\t$rv1mc\t\$$rv2mc<br>\n";
print "d\t$d\t$rv1d\t\$$rv2d<br><br><br>\n\n\n";
my $output = `array2d.pl`;
print '<PRE>\n';
print "$output\n";
print '</PRE>\n';
print '</BODY>';
sub commify {
my $value = reverse $_[0];
$value =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g;
return scalar reverse $value;
}
--
View this message in context:
http://www.nabble.com/Another-question-about-CGI-on-Tomcat-6---access-tp19171791p19171791.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To start a new topic, e-mail: [email protected]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]