Skip Menu |

This queue is for tickets about the Monitoring-Plugin CPAN distribution.

Report information
The Basics
Id: 107370
Status: resolved
Priority: 0/
Queue: Monitoring-Plugin

People
Owner: Nobody in particular
Requestors: debian.axhn [...] manchmal.in-ulm.de
Cc:
AdminCc:

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



Subject: Please provide a setter for "shortname"
Date: Mon, 28 Sep 2015 00:50:06 +0200
To: bug-Monitoring-Plugin [...] rt.cpan.org
From: Christoph Biedl <debian.axhn [...] manchmal.in-ulm.de>
Hello, one of my checks behaves quite differently depending on the parameter values, and the "shortname" too should rather be different depending on this. Therefore I'd like to override the shortname value at run-time, not just in a Monitoring::Plugins constructor. Poking $mp->{'shortname'} is possible and does the trick, but that's really bad style. A simple setter was the sane solution. Regards, Christoph
Download signature.asc
application/pgp-signature 819b

Message body not shown because it is not plain text.

Hi, I'd happily apply pull requests in that direction on github: https://github.com/monitoring-plugins/monitoring-plugin-perl This friday a bug sprint will place https://www.monitoring-plugins.org/news/bug-squashing-fall-2015.html which would be a perfect timing to help the project. Thanks, Sven
Subject: Re: [rt.cpan.org #107370] Please provide a setter for "shortname"
Date: Thu, 1 Oct 2015 00:00:42 +0200
To: Sven Nierlein via RT <bug-Monitoring-Plugin [...] rt.cpan.org>
From: Christoph Biedl <debian.axhn [...] manchmal.in-ulm.de>
Sven Nierlein via RT wrote... Show quoted text
> I'd happily apply pull requests in that direction on github: > https://github.com/monitoring-plugins/monitoring-plugin-perl
Hope you take patches the old way, too. Since, big surprise, the feature is already there, tt's just not documented. That can be changed. Christoph --- a/lib/Monitoring/Plugin.pm +++ b/lib/Monitoring/Plugin.pm @@ -412,6 +412,32 @@ =back +=head2 GETTER/SETTER + +The following internal variables can be retrieved or set by calling a +method with the respective name. Expect for C<shortname>, don't change +values unless you know what you're doing. + +Examples: + + use Data::Dumper; + print Dumper($plugin->perfdata); + $plugin->shortname('DifferentName'); + +=over + +=item shortname + +=item perfdata + +=item messages + +=item opts + +=item threshold + +=back + =head2 OPTION HANDLING METHODS C<Monitoring::Plugin> provides these methods for accessing the functionality in C<Monitoring::Plugin::Getopt>.
Sure, i just merged your patch. Thanks.