web services - How do I call perl cgi script from another perl cgi script -
I have a CGI script that takes some parameters like the following.
testScript.cgi? Arg = 1 & amp; Arg2 = some ting else and amp3; Other The above script works well and fully.
Now I have another Pearl CGI script mySecondScript.cgi It does its work, but with the arguments I have computed in this script, textScript.cgi < / Code>. How do I do that? Any elegant solution will be appreciated.
You probably want to use another program to call. You'll need something like this:
$ my output = get ("http: //someserver.somedomain/testScript.cgi? Argument = 1 & arg2 = SomeThingElse and arg3 = second thing" ); This will return the output from the CGI program (i.e., it generates ja html pages). If you want more control to get back, then you need to use it.
my $ ua = LWP :: UserAgent-> new; My $ resp = $ ua- & gt; Receive ("http: //someserver.somedomain/testScript.cgi? Argument = 1 and arg2 = SomeThingElse and arg3 = otherThing"); $ resp will be an object. Alternatively, if both of your programs are running locally, then it may be more convenient to rifure that important bits of TestScript.cgi are in a module that you simply load and mySecondScript You can use within CGI.
Comments
Post a Comment