Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Calling a perl script and passing parameters from html

by Jenda (Abbot)
on Nov 17, 2012 at 17:26 UTC ( #1004326=note: print w/replies, xml ) Need Help??

in reply to Calling a perl script and passing parameters from html

If the script doesn't take too long to execute and you do not need to process it's results then a wrapper script like this should be enough to get you up and running:

use strict; use CGI; use CGI; my $q = new CGI; @ARGV = (); foreach ($q->param()) { $value = $q->param($_); $value =~ s/"/\\"/g; push @ARGV, "--" . $_ . '="' . $value . '"'; } do 'path/to/the/';

All it does is it moves the parameters from the querystring or post into the @ARGV array (array of script parameters) in the format required by the script and then executes the script without starting a new process.

As long as the script prints its results to STDOUT they should be sent to the client browser.

Enoch was right!
Enjoy the last years of Rome.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2016-10-25 23:48 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (330 votes). Check out past polls.