Thread: [Arsperl-users] Manually passing arguments to a cgi program
Brought to you by:
jeffmurphy
|
From: Steve M. <ste...@ch...> - 2007-11-13 17:38:00
|
Can anyone help me with the syntax for passing arguments to a cgi program via the unix command line? Someone else is writing the web interface to the program and I don't want to wait to get the debugging started. Thanks! |
|
From: Axton <axt...@gm...> - 2007-11-13 18:09:27
|
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 program > via the unix command line? Someone else is writing the web 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/ > _______________________________________________ > Arsperl-users mailing list > Ars...@ar... > https://lists.sourceforge.net/lists/listinfo/arsperl-users > > |
|
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
|
|
From: Joseph K. <jos...@gm...> - 2007-11-13 18:42:27
|
Steve, Are you using the CGI Perl module version 2.57 or later? If so, you can pass the parameters on the command line: ./foo.cgi ticket=25314 action=close user=joeuser key=5df83sk3 Another option is to use the debug flag in your cgi: use CGI qw( -debug ); This should make the script prompt you for the inputs when you run it like old versions of CGI.pm did. I have not tried this second method myself though. Joe Kubasek 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 program > via the unix command line? Someone else is writing the web 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/ > _______________________________________________ > Arsperl-users mailing list > Ars...@ar... > https://lists.sourceforge.net/lists/listinfo/arsperl-users > > |
|
From: Clayton S. <cla...@gm...> - 2007-11-13 20:15:46
|
Steve, Joe has the right idea. Just do as he says and you should be golden. The docs for the CGI module are on the command line at perldoc CGI or can be found online at search.cpan.org -- Clayton Scott cla...@gm... |