in reply to Re^3: replace use HTTP::Lite to run a perl file that was on another server
in thread replace use HTTP::Lite to run a perl file that was on another server
I think you are confused by the variable $CMD which is not the CMD line.
Maybe this looks better to you:
sub get_response { my ($cgi, $query) = shift; $ENV{QUERY_STRING} = $query; $ENV{REQUEST_METHOD} = 'GET'; $ENV{GATEWAY_INTERFACE} = 'CGI/1.1'; open(CGI, '-|', $cgi) or die "Can't exec $cgi, $!"; local $/ = undef; my $res = <CGI>; close(CGI) or die "Error running $cgi, $!"; return $res; }
Note: I used the 3 argument form of open as it is generally safer to use.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: replace use HTTP::Lite to run a perl file that was on another server
by huck (Prior) on Feb 21, 2017 at 03:27 UTC |