in reply to Re^4: 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 would recommend the 3 argument form of open instead:

open(CGI, '-|', $cgi) or die "Can't exec $cgi, $!";

as it is generally safer.

Replies are listed 'Best First'.
Re^6: replace use HTTP::Lite to run a perl file that was on another server
by kcott (Archbishop) on Feb 21, 2017 at 06:49 UTC

    G'day RonW,

    Recommending the 3-argument form of open is sound advice; however, using a globally-scoped, package variable (i.e. CGI) is not. This would have been better:

    open my $pipe_from_cgi, '-|', $cgi or die ...

    — Ken

      I overlooked that. I was only focused on the 2 vs 3 arg forms of open. Yes, a globally scoped file handle is also not a good idea.