From 75391608e1160fafb571225f263ea988934d33ba Mon Sep 17 00:00:00 2001 From: Sven Nierlein Date: Sat, 11 Apr 2015 12:51:33 +0200 Subject: fix "Redundant argument in sprintf" in perl 5.21 (RT #103214) Signed-off-by: Sven Nierlein --- lib/Monitoring/Plugin/Getopt.pm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'lib/Monitoring/Plugin') diff --git a/lib/Monitoring/Plugin/Getopt.pm b/lib/Monitoring/Plugin/Getopt.pm index db98567..1740830 100644 --- a/lib/Monitoring/Plugin/Getopt.pm +++ b/lib/Monitoring/Plugin/Getopt.pm @@ -152,9 +152,10 @@ sub _options # Add help_string to @options if ($help_string =~ m/%s/) { my $default = defined $arg->{default} ? $arg->{default} : ''; - # We only handle '%s' formats here, so escape everything else - $help_string =~ s/%(?!s)/%%/g; - push @options, sprintf($help_string, $default, $default, $default, $default); + # We only handle '%s' formats here + my $replaced = $help_string; + $replaced =~ s|%s|$default|gmx; + push @options, $replaced; } else { push @options, $help_string; } @@ -164,10 +165,11 @@ sub _options } # Output for plugin -? (or missing/invalid args) -sub _usage -{ - my $self = shift; - sprintf $self->_attr('usage'), $self->{_attr}->{plugin}; +sub _usage { + my $self = shift; + my $usage = $self->_attr('usage'); + $usage =~ s|%s|$self->{_attr}->{plugin}|gmx; + return($usage); } # Output for plugin -V -- cgit v1.2.3-74-g34f1