diff options
Diffstat (limited to 'lib/Monitoring/Plugin')
-rw-r--r-- | lib/Monitoring/Plugin/Getopt.pm | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/Monitoring/Plugin/Getopt.pm b/lib/Monitoring/Plugin/Getopt.pm index 262e3c8..ca1cb61 100644 --- a/lib/Monitoring/Plugin/Getopt.pm +++ b/lib/Monitoring/Plugin/Getopt.pm | |||
@@ -382,15 +382,18 @@ sub arg | |||
382 | my $self = shift; | 382 | my $self = shift; |
383 | my %args; | 383 | my %args; |
384 | 384 | ||
385 | # Param name to required boolean | ||
386 | my %params = ( | ||
387 | spec => 1, | ||
388 | help => 1, | ||
389 | default => 0, | ||
390 | required => 0, | ||
391 | label => 0, | ||
392 | ); | ||
393 | |||
385 | # Named args | 394 | # Named args |
386 | if ($_[0] =~ m/^(spec|help|required|default|label)$/ && scalar(@_) % 2 == 0) { | 395 | if ($_[0] =~ m/^(spec|help|required|default|label)$/ && scalar(@_) % 2 == 0) { |
387 | %args = validate( @_, { | 396 | %args = validate( @_, { %params }); |
388 | spec => 1, | ||
389 | help => 1, | ||
390 | default => 0, | ||
391 | required => 0, | ||
392 | label => 0, | ||
393 | }); | ||
394 | } | 397 | } |
395 | 398 | ||
396 | # Positional args | 399 | # Positional args |