Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: How to pass form data from a CGI script to its child process?

by Anonymous Monk
on Aug 25, 2012 at 09:13 UTC ( #989704=note: print w/replies, xml ) Need Help??

in reply to How to pass form data from a CGI script to its child process?

I surely would have to write code which encodes the form data for the command line (all character sequences which might be treated specially by the shell would have to be transformed), and the form data might be very long, even longer than the maximum length which is allowed for a command line.

You could use CGI

and reading it
my $q = CGI->new(\*IN);
so when you use the list form of system, system $^X, '', 'some/file/something';

Replies are listed 'Best First'.
Re^2: How to pass form data from a CGI script to its child process?
by Nocturnus (Beadle) on Sep 05, 2012 at 07:31 UTC

    Thank you very much for your reply.

    I just did not know that the CGI module is able to do that. In the past, I have used the CGI module heavily and thought that I would know the most important things about it, but this obviously was an error.

    I have tested your proposition, and it works great. But now, there was the problem how to tell script from where it should read the parameters (HTTP form data or file / STDIN). That was easy to solve, though: will call with an additional command line parameter. If finds this command line parameter when called, it knows that it has been called from another script and that it should read STDIN for the CGI data; otherwise, it knows that it has been called directly from the user's browser and that it should read the CGI data from the HTTP data.

    Thanks again,


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://989704]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2017-11-20 16:16 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (288 votes). Check out past polls.