Gossamer Forum
Home : General : Perl Programming :

Call another CGI from within a CGI

Quote Reply
Call another CGI from within a CGI
Hi,

What exactly is the syntax if I want
to call a second cgi (test.cgi) from
within a first cgi and pass a variable
$waldo ?

Thanks
Quote Reply
Re: Call another CGI from within a CGI In reply to
You mean the first cgi file contains all the configuration, while the second cgi file is the program?

You just put require "conf.pl"; in your second cgi file.
Quote Reply
Re: Call another CGI from within a CGI In reply to
No, I need to pass on a search query from a first script to a second one. each script is self-contained, all I need to do is to merge the results from the first cgi with the reults from the second cgi onto one single page.... Any more thoughts ?
Quote Reply
Re: Call another CGI from within a CGI In reply to
Option 1
In cgi#2
require "/path/to/cgi#1";
print "$waldo\n";

Option 2
In cgi#1
print "<form action="URL to cgi#2" method="post">\n";
print "<input type="hidden" name="Waldo" value="$waldo">\n";
print "<INPUT TYPE="submit" VALUE="Send Waldo to cgi#2">\n";

In cgi#2
print "$in{'Waldo'}\n";