Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

executing another perl model

Status
Not open for further replies.

jamsman

Technical User
Jul 22, 2005
38
DE
i need to run a perl module from within a script then get the information displayed in the web browser
any ideas??
 
#!/usr/local/apache/perl5/bin/perl -w
# rtsDumpBugTest.pl
use strict;
use CGI qw/:standard/;

push(@INC, "../lib/perl5");
require "rtsLib.pl";
my $dest ='"Public Queries/Projects/test/James_DTs"';
&printHeader;

print "<h1>DDTS Dump Bug<hr noshade></h1>\n";

start_html("DDTS DumpBug");
if (param()) {
my $Command='/test/;
my $result =(`$Command`);
print "<pre>$result</pre>\n";
print "<pre>$dest</pre>\n";
print "<pre>$Command</pre>\n";

}else{
print start_form();
print p("Enter Bug Number",textfield("bug"));
print p(submit("Submit"));
print end_form();
}

&printFooter;
print end_html;
 
You're requiring a file already.

Code:
use Module;
should be all you need

--Paul

cigless ...
 
note that start_html("DDTS DumpBug"); needs a print in front of it or your output will never reach the browser.

f

&quot;As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs.&quot;
--Maurice Wilkes
 
hi thanks for the suggestions but, i do get some out put to the browser if i use the print. Teh trouble im having is that the query does not seem to be executing so there is no results to print.

If i use the "Module;" code i get the brilliant error message of: 500 Internal server error

 
You'd really like command line access to the server to debug 500s (or access to it's logs). If you can run the script from the command line, you usually get a more informative error message. The same message would end up in the logs.

If you have neither access, try using Carp qw/fatalsToBrowser/ and replacing your use with a require - possibly in an eval block. That should route the error message to the browser rather than to the server logs by moving the loading of the module to run-time rather than compile time.

f

&quot;As soon as we started programming, we found to our surprise that it wasn't as easy to get programs right as we had thought. Debugging had to be discovered. I can remember the exact instant when I realized that a large part of my life from then on was going to be spent in finding mistakes in my own programs.&quot;
--Maurice Wilkes
 
thanks guys i now have it working turns out that my script was ok (or at least a new version was), cqperl was not installed on the web server so the cqperl query would not run

cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top