When you run a perl script from the command line, you omit the "?" and
add all of your param=value pairs after it.  Like this:

./myscript.pl param1=value1 param2=value2 param3=value3

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] =  "param1=value1"
$ARGV[1] =  "param2=value2"
$ARGV[2] =  "param3=value3"

With a loop lie this, you can get them into the Hash (%Params):

my (%Params,$ame,$value);
foreach (@ARGV) {
  ($name,$value) = split("=",$_);
  $Params{$name} = $value;
}

Now you will get the hash:

$Params{"param1"} = "value1";
$Params{"param2"} = "value2";
$Params{"param3"} = "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: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 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
<[EMAIL PROTECTED]> 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
> Arsperl-users@arsperl.org
> 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
Arsperl-users@arsperl.org
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
Arsperl-users@arsperl.org
https://lists.sourceforge.net/lists/listinfo/arsperl-users

Reply via email to