Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: CGI from another script

by ikegami (Patriarch)
on Sep 02, 2005 at 14:12 UTC ( [id://488654]=note: print w/replies, xml ) Need Help??


in reply to CGI from another script

The CGI spec specifies what you be on the command line, in the environment and on standard input. Among other things, it explicitely states "The command line is only used in the case of an ISINDEX query.", a type of request I haven't seen used since 1995.

Update: Untested:

my $response; { # Protect the parent script's environment. # I hope this doesn't remove %ENV's magic. local %ENV = %ENV; $ENV{SERVER_PROTOCOL} = 'HTTP/1.0'; $ENV{REQUEST_METHOD} = 'GET'; # To build URLs. $ENV{SERVER_NAME} = 'www.example.com'; $ENV{SERVER_PORT} = 80; $ENV{SCRIPT_NAME} = '/some_script.cgi'; # For /xxx.cgi/path delete $ENV{PATH_INFO}; delete $ENV{PATH_TRANSLATED}; # Unset these for POST. $ENV{QUERY_STRING} = 'blah=foo&larh=bar'; # Set these for POST. delete $ENV{CONTENT_TYPE}; delete $ENV{CONTENT_LENGTH}; $ENV{REMOTE_ADDR} = '127.0.0.1'; # Need to place data on child's STDIN for POST. # Need to place data on paramater line for ISINDEX queries. $response = `perl some_script.cgi`; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://488654]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-03-28 11:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found