I've used LWP to call cgi scripts like that. This example is probably more
complicated than it needs to be, because I had to use the POST method to
call the scripts I was running behind the scenes:
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Headers;
...
my $em = new CGI;
$em->delete_all;
$em->param( name => $name ); ## define parameters you want to pass here
$em->param( email => $email );
$em->param( msg => $msg );
my $pass_path = $em->query_string;
my $location = "./another-that-returns-no-html.cgi";
my $agent = new LWP::UserAgent;
my $req = new HTTP::Request ("POST", $location);
$req->header('Accept' => 'text/html');
$req->content ($pass_path);
my $result = $agent->request( $req );
You can test the value of $result to make sure the script executed ok:
if ($result->headers_as_string=~m/Title\:\sSuccess/){
## it worked!
}else{
## didn't work
}
Todd F.
- Original Message -
From: "David Gilden" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 29, 2003 10:42 PM
Subject: calling other cgi's in PERL
> Can anyone enlighten me on how to do this:
> Goal: call different PERL scripts from current PERL script.
>
> Below is what I am trying to accomplish, but I am not sure I have the
syntax correct.
> (can't seem to find anything this in my PERL books)
> Thanks,
> Dave
> -
> #!/usr/bin/perl -w
>
> #some code...
>
>
> # have current cgi redirect the web browser to a html page
> print redirect("/index.html");
>
> # call another cgi -- that does something behind the scenes -- send an
email or somthing.
> print "./another-that-returns-no-html.cgi";
> exit;
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]