diff options
author | Sven Nierlein <sven@nierlein.de> | 2015-04-11 12:51:33 +0200 |
---|---|---|
committer | Sven Nierlein <sven@nierlein.de> | 2015-04-11 12:51:33 +0200 |
commit | 75391608e1160fafb571225f263ea988934d33ba (patch) | |
tree | 898f7e3a689a2021ed4d4cf0536308aaade51859 /lib/Monitoring/Plugin | |
parent | 4a52ac0ade65d6933ae1ca73d304534657031ca6 (diff) | |
download | monitoring-plugin-perl-75391608e1160fafb571225f263ea988934d33ba.tar.gz |
fix "Redundant argument in sprintf" in perl 5.21 (RT #103214)
Signed-off-by: Sven Nierlein <sven@nierlein.de>
Diffstat (limited to 'lib/Monitoring/Plugin')
-rw-r--r-- | lib/Monitoring/Plugin/Getopt.pm | 16 |
1 files changed, 9 insertions, 7 deletions
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 | |||
152 | # Add help_string to @options | 152 | # Add help_string to @options |
153 | if ($help_string =~ m/%s/) { | 153 | if ($help_string =~ m/%s/) { |
154 | my $default = defined $arg->{default} ? $arg->{default} : ''; | 154 | my $default = defined $arg->{default} ? $arg->{default} : ''; |
155 | # We only handle '%s' formats here, so escape everything else | 155 | # We only handle '%s' formats here |
156 | $help_string =~ s/%(?!s)/%%/g; | 156 | my $replaced = $help_string; |
157 | push @options, sprintf($help_string, $default, $default, $default, $default); | 157 | $replaced =~ s|%s|$default|gmx; |
158 | push @options, $replaced; | ||
158 | } else { | 159 | } else { |
159 | push @options, $help_string; | 160 | push @options, $help_string; |
160 | } | 161 | } |
@@ -164,10 +165,11 @@ sub _options | |||
164 | } | 165 | } |
165 | 166 | ||
166 | # Output for plugin -? (or missing/invalid args) | 167 | # Output for plugin -? (or missing/invalid args) |
167 | sub _usage | 168 | sub _usage { |
168 | { | 169 | my $self = shift; |
169 | my $self = shift; | 170 | my $usage = $self->_attr('usage'); |
170 | sprintf $self->_attr('usage'), $self->{_attr}->{plugin}; | 171 | $usage =~ s|%s|$self->{_attr}->{plugin}|gmx; |
172 | return($usage); | ||
171 | } | 173 | } |
172 | 174 | ||
173 | # Output for plugin -V | 175 | # Output for plugin -V |