T
Ted Byers
Using the latest IndigoPerl, I have two scripts that do not behave
alike. Both are in the perl-bin directory of the Apache server
distributed with IndigoPerl.
The first one appended below works fine. It shows the output from a
perl script located in a directory tree completely outside the
directory tree for IndigoPerl, as well as a system command (this is
Windows XP). I get the expected output by providing the URL "http://
localhost/perl-bin/format_test.pl" to the browser.
The second one just hangs, displaying the initial text, but the script
appears to stop at the point where TedsMakeNewPortfolios.pl is
invoked. it is as if an attempt is made to run my scrpt, and control
is never returned to the main script. Yes, an association between
perl and the 'pl' extension has been created, and if I invoke
TedsMakeNewPortfolios.pl from the commandline (e.g. using
"TedsMakeNewPortfolios.pl 522"), it works flawlessly. So why isn't my
TedsMakeNewPortfolios.pl being executed?
The ONLY difference I can see is that my script takes a commandline
parameter and the printenv_segment.pl does not, but I don't see why
that would be significant. I will run a test, though, assigning "C:\
\yohan\\PRODUCTION\\MakeNewPortfoliosETF\\TedsMakeNewPortfolios.pl
$id" to a local variable before trying to execute it, to see if that
makes a difference. But suggestions on how to get this to work would
be appreciated.
Thanks
Ted
======format_test.pl=================
#!c:/perl/bin/perl.exe
use strict;
use CGI qw/:standard/;
my $name = param('name');
my $id = param('id');
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>\n";
print "<br><p>name:\t$name<br>\n";
print "<br><p>id:\t$id<br>\n";
my $output = `C:\\ApacheAndPerl\\Apache2\\perl\\printenv_segment.pl`;
print "$output<br><br><br><br>";
$output = `dir`;
print '<PRE>';
print "$output<br>";
print '</PRE>';
print '</BODY></HTML>';
sub commify {
my $value = reverse $_[0];
$value =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g;
return scalar reverse $value;
}
=========portfolio_construction.pl===================
#!c:/perl/bin/perl.exe
use strict;
use CGI qw/:standard/;
my $name = param('name');
my $id = param('id');
print header,
start_html('Portfolio history construction'),
h1("Hello $name"),
p("id = $id");
print p("This may take a few minutes.");
print end_html;
my $output = `"C:\\yohan\\PRODUCTION\\MakeNewPortfoliosETF\
\TedsMakeNewPortfolios.pl $id"`;
alike. Both are in the perl-bin directory of the Apache server
distributed with IndigoPerl.
The first one appended below works fine. It shows the output from a
perl script located in a directory tree completely outside the
directory tree for IndigoPerl, as well as a system command (this is
Windows XP). I get the expected output by providing the URL "http://
localhost/perl-bin/format_test.pl" to the browser.
The second one just hangs, displaying the initial text, but the script
appears to stop at the point where TedsMakeNewPortfolios.pl is
invoked. it is as if an attempt is made to run my scrpt, and control
is never returned to the main script. Yes, an association between
perl and the 'pl' extension has been created, and if I invoke
TedsMakeNewPortfolios.pl from the commandline (e.g. using
"TedsMakeNewPortfolios.pl 522"), it works flawlessly. So why isn't my
TedsMakeNewPortfolios.pl being executed?
The ONLY difference I can see is that my script takes a commandline
parameter and the printenv_segment.pl does not, but I don't see why
that would be significant. I will run a test, though, assigning "C:\
\yohan\\PRODUCTION\\MakeNewPortfoliosETF\\TedsMakeNewPortfolios.pl
$id" to a local variable before trying to execute it, to see if that
makes a difference. But suggestions on how to get this to work would
be appreciated.
Thanks
Ted
======format_test.pl=================
#!c:/perl/bin/perl.exe
use strict;
use CGI qw/:standard/;
my $name = param('name');
my $id = param('id');
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>\n";
print "<br><p>name:\t$name<br>\n";
print "<br><p>id:\t$id<br>\n";
my $output = `C:\\ApacheAndPerl\\Apache2\\perl\\printenv_segment.pl`;
print "$output<br><br><br><br>";
$output = `dir`;
print '<PRE>';
print "$output<br>";
print '</PRE>';
print '</BODY></HTML>';
sub commify {
my $value = reverse $_[0];
$value =~ s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g;
return scalar reverse $value;
}
=========portfolio_construction.pl===================
#!c:/perl/bin/perl.exe
use strict;
use CGI qw/:standard/;
my $name = param('name');
my $id = param('id');
print header,
start_html('Portfolio history construction'),
h1("Hello $name"),
p("id = $id");
print p("This may take a few minutes.");
print end_html;
my $output = `"C:\\yohan\\PRODUCTION\\MakeNewPortfoliosETF\
\TedsMakeNewPortfolios.pl $id"`;