Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Invoking a cgi script from another cgi script using system()

by Anonymous Monk
on Dec 31, 2014 at 22:50 UTC ( #1111872=note: print w/replies, xml ) Need Help??


in reply to Invoking a cgi script from another cgi script using system()

you have to read the source for the CGI.pm module , someone may have edited it to enable/disable @ARGV processing

Although, if your cgi program consisted of

use MyApp; MyApp->runcgi;

then you wouldn't have to use system to call your cgi program, you could use MyApp .... regular perl programming

Replies are listed 'Best First'.
Re^2: Invoking a cgi script from another cgi script using system()
by bibliophile (Parson) on Jan 01, 2015 at 17:29 UTC

    Ah, yes. That's better :-)

    (In the real project, I'm going to pull the guts out of "b.cgi" into a new "c.pm", and have both a.pl and b.cgi use c.pm to do the heavy lifting, without needing to mess about with having a.pl capturing output from b.cgi)

    Thanks for the tip on CGI.pm, too. $DEBUG was actually set to 1 (meaning that this *should* have worked...) I still don't know why it didn't work, but I learned something new today, and that's always a win.

    Thanks.

      You could also write like this because webservers won't put stuff into @ARGV
      my $query = @ARGV ? CGI->new({ @ARGV }) : CGI->new;

      Invoke as

      system $^X, 'foo.cgi', qw/ key value key value /;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2020-10-27 20:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (258 votes). Check out past polls.

    Notices?