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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call a script and return results to original script

Status
Not open for further replies.
Oct 27, 2002
21
0
0
US
I have an html page that sends some variables to a perl script "script.cgi" and I am wanting to call an expect script from within the script.cgi and get the results of the expect script returned back into the script.cgi and allow it to continue processing. I have a few scripts that redirect to other scripts using the system() call, but not sure and haven't found any documents on starting a script, calling another script and returning to the original script to continue processing. Is this doable. I know I can just implement the expect module, but have not had much success with the documents on that and since I already have a fully functional expect script figured it would be easier just to call it and have it feed its results to a file that can be further called from the original script.

Hope that wasn't too confusing. The overall script I am working on will login to multiple devices and multiple device types and return results of executed commands. I use the expect script on our load balancers beccause we hvae two versions and one does not allow non interactive login and I have gotten it working with an expect script.

Thanks in Advance.

Wally
 
You can use qx to run any command and get the result back. A perl script is just another command. So
Code:
use strict;
use warnings;

my @stuff = qx{perl myscript.pl};

print @stuff;

Steve

[small]"Every program can be reduced by one instruction, and every program has at least one bug. Therefore, any program can be reduced to one instruction which doesn't work." (Object::perlDesignPatterns)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top