Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

SAVING THE STATE OF THE SCRIPT TO A FILE: $query->save(\*FILEHANDLE)
and reading it
my $q = CGI->new(\*IN);
so when you use the list form of system, system $^X, 'scriptB.pl', 'some/file/something';


Comment on Re: How to pass form data from a CGI script to its child process?
Select or Download Code
Re^2: How to pass form data from a CGI script to its child process?
by Nocturnus (Sexton) 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 B.pl from where it should read the parameters (HTTP form data or file / STDIN). That was easy to solve, though:

    A.pl will call B.pl with an additional command line parameter. If B.pl 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,

    Nocturnus

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2014-11-24 09:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (137 votes), past polls