From: "mb" <[EMAIL PROTECTED]> > Is there a way to call a cgi script from another one(diff using html > header and forms). So that this script get params and return values > ... a kind of sub.
Depends. 1) If it's on the same server as your CGI and expects to be used that way you can run it via do() or require(). 2) If it's on the same computer, but has to be treated as a complete CGI, you may use system() or `` or open(PIPE, 'the_cgi.pl|'), open2() or open3(). You will probably need to change the contents of %ENV to pass it the right parameters. Eg. if you want to call /foo.pl?name=Jenda this way you will have to set use FindBin qw($Bin); $ENV{SCRIPT_NAME} = $ENV{PATH_INFO} = '/foo.pl'; $ENV{PATH_TRANSLATED} = $Bin . '/foo.pl'; $ENV{REQUEST_METHOD} = 'GET'; $ENV{QUERY_STRING} = 'name=Jenda'; before you start the foo.pl. (Some of those may not be used by the CGI in question. If you know for sure, you can skip them. Also I assume your code runs as a CGI, otherwise you'd have to set a few more to fool the other script into believing that it's being run as a CGI.) If you need to post data to the script you'll need to use open2() or open3() (read perldoc IPC::Open2 and perldoc IPC::Open3) and send the posted data to the other script's STDIN. 3) If the other script is on a different server you will use LWP (Either LWP::Simple or LWP::UserAgent, read the docs.) to send a normal HTTP request to the other server. Jenda =========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ========== There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain. I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]