Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

running cgi from unix prompt

Status
Not open for further replies.

robertRRR

Programmer
Jun 3, 2003
1
NL
Hi ,

is it possible to run cgi which uses post parameter values from the unix prompt in stead of the webserver..
and if so how.. is this done..



thanks a lot,

robert
 
If you're using CGI.pm it's simple: supply name=value pairs on the command line. You can even

Code:
use CGI qw/ -debug /;

in which case it will prompt you interactively for name=value pairs at run-time.

gives more info.

Yours,


fish

"As soon as we started programming, we found to our surprise that it wasn't as
easy to get programs right as we had thought. Debugging had to be discovered.
I can remember the exact instant when I realized that a large part of my life
from then on was going to be spent in finding mistakes in my own programs."
--Maurice Wilk
 
Or if you know what name value pairs you are using you can leave the script as is and run via command line like:

perl script.cgi name=value name=value name=value
 
You could also accept a number of parameters at runtime

perl myscript.pl Atlanta San-Diego

and in the script
#!/usr/bin/perl

$city1=$ARGV[0];$city2=$ARGV[1];
...


HTH
Paul

It's important in life to always strike a happy medium, so if you see someone with a crystal ball, and a smile on their face ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top