Re: [Arsperl-users] Manually passing arguments to a cgi program
Brought to you by:
jeffmurphy
|
From: Bowman, B. A <Bow...@st...> - 2007-11-13 18:42:42
|
When you run a perl script from the command line, you omit the "?" and
add all of your param=3Dvalue pairs after it. Like this:
./myscript.pl param1=3Dvalue1 param2=3Dvalue2 param3=3Dvalue3
Then inside the script, you can access these values with the @ARGV
array. You will have to manually split them because they will have the
equal sign still. The @ARGV array will look like this:
$ARGV[0] =3D "param1=3Dvalue1"
$ARGV[1] =3D "param2=3Dvalue2"
$ARGV[2] =3D "param3=3Dvalue3"
With a loop lie this, you can get them into the Hash (%Params):
my (%Params,$ame,$value);
foreach (@ARGV) {
($name,$value) =3D split("=3D",$_);
$Params{$name} =3D $value;
}
Now you will get the hash:
$Params{"param1"} =3D "value1";
$Params{"param2"} =3D "value2";
$Params{"param3"} =3D "value3";
The above will not handle array inputs, but you get the idea.
The below recommendation is to access the cgi script on another server
via the command line using http.
-----Original Message-----
From: ars...@ar...
[mailto:ars...@ar...] On Behalf Of Axton
Sent: Tuesday, November 13, 2007 12:44 PM
To: ARSperl User Discussion
Subject: Re: [Arsperl-users] Manually passing arguments to a cgi program
man wget
see the --post-data option
Axton Grams
On Nov 13, 2007 12:17 PM, Steve McDonald
<ste...@ch...> wrote:
>
>
> Can anyone help me with the syntax for passing arguments to a cgi=20
> program via the unix command line? Someone else is writing the web=20
> interface to the program and I don't want to wait to get the debugging
started.
>
>
> Thanks!
> ----------------------------------------------------------------------
> --- This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a
browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/=20
> _______________________________________________
> Arsperl-users mailing list
> Ars...@ar...
> https://lists.sourceforge.net/lists/listinfo/arsperl-users
>
>
------------------------------------------------------------------------
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Arsperl-users mailing list
Ars...@ar...
https://lists.sourceforge.net/lists/listinfo/arsperl-users
|