Skip Menu |

This queue is for tickets about the Nagios-Plugin-WWW-Mechanize CPAN distribution.

Report information
The Basics
Id: 57641
Status: open
Priority: 0/
Queue: Nagios-Plugin-WWW-Mechanize

Owner: Nobody in particular
Requestors: jlmartinez [...]

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)

Subject: Announce as nagios-plugin
Download (untitled) / with headers
text/plain 1012b
Hi, Plugins that use Nagios::Plugin::WWW::Mechanize announce their user agent as "WWW-Mechanize/X.XX". It would be nice that Nagios::Plugin::WWW::Mechanize would set the user agent to something related to the plugin, instead, like: "plugin-name/X.XX (nagios-plugin-www-mechanize x.xx)" where: plugin-name is the shortname of the plugin X.XX is the version that it reports via plugin -V x.xx is the version of Nagios::Plugin::WWW::Mechanize For the moment I'm doing something like this after calling ->getopts my $ua = $np->opts->_revision . " (nagios-plugin-www-mechanize ${Nagios::Plugin::WWW::Mechanize::VERSION})"; $np->mech->agent($ua); I'm breaking encapsulation because I didn't find a way to get the version of the plugin. I wanted it to be something like: my $ua = lc($np->shorname) . '/' . $np->version . " (nagios-plugin-www-mechanize ${Nagios::Plugin::WWW::Mechanize::VERSION})" It would be nice if Nagios::Plugin::WWW::Mechanize would handle it for "free" ;) Cheers, Jose Luis Martinez
Download (untitled) / with headers
text/plain 462b
On Wed May 19 14:18:40 2010, JLMARTIN wrote: Show quoted text
> my $ua = lc($np->shorname) . '/' . $np->version . " > (nagios-plugin-www-mechanize ${Nagios::Plugin::WWW::Mechanize::VERSION})"
You know, reading the docs, it mentions if $opts{mech} is specified and is an object. By declaring your own WWW::Mechanize object, you can specify your own UserAgent: my $mech = WWW::Mechanize->new( agent => 'wonderbot 1.01' ); Nagios::Plugin::WWW::Mechanize->new( mech => \$mech )

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to