[Nagiosplug-devel] multiple options with same argument.
shadih rahman
shadhin71 at gmail.com
Fri Jul 17 22:49:07 CEST 2009
Thanks for the tip. It worked like a charm.
On Thu, Jul 9, 2009 at 10:39 PM, Thomas Guyot-Sionnest <dermoth at aei.ca>wrote:
> -----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-----
>
>
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________________
> Nagios Plugin Development Mailing List
> Nagiosplug-devel at lists.sourceforge.net
> Unsubscribe at
> https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
> ::: Please include plugins version (-v) and OS when reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
>
--
Cordially,
Shadhin Rahman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nagios-plugins.org/archive/devel/attachments/20090717/0cd73cc7/attachment.html>
More information about the Devel
mailing list