[Nagiosplug-devel] multiple options with same argument.

Thomas Guyot-Sionnest dermoth at aei.ca
Fri Jul 10 04:39:27 CEST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/07/09 05:27 PM, shadih rahman wrote:
> All,
>   how do you parse multiple of same argument in Nagios::Plungin.  I am
> calling my check as this
> 
> perl check_htturl -H wind.columbia.edu <http://wind.columbia.edu> -u
> username -p pass -P /login -q me -q you
> 
> when I print -q it should print me&you but its not doing that.   This is
> my code.  Please advise on this.  Thanks
> 

Nagios::Pluin uses Getopt::Long to parse arguments, so its parameters
are pretty much the same. While I doubt you can force N::P to return an
array you can have Getopt::Long return a array reference.

> $plugin->add_arg(
>                  spec       => 'query|q=s',
>                  help       => "additional query to inject",
>                  label      => [ 'query' ],
>                  required   => 0,
>              );

try with:  spec       => 'query|q=s@'

Since it'll be a ref don't forget to deference it when you get it from
$plugin->opts->query

- --
Thomas
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFKVqnf6dZ+Kt5BchYRAqyxAJ0YH3qpu5FZxWDzp+mXu2SAc0oyMgCfYwzy
nD7sZohL3qGiv8XnWkPcJjg=
=E5N0
-----END PGP SIGNATURE-----




More information about the Devel mailing list