fixed -m for systems without perldoc
authorMatthias Förste <foerste@schlittermann.de>
Tue, 24 May 2011 09:40:39 +0200
changeset 112 5a51a3757f5e
parent 111 c76989cccf62
child 113 30bd047cd057
fixed -m for systems without perldoc
dnsnagios/check_dnssec
--- a/dnsnagios/check_dnssec	Mon May 23 14:41:49 2011 +0200
+++ b/dnsnagios/check_dnssec	Tue May 24 09:40:39 2011 +0200
@@ -48,14 +48,23 @@
     UNKNOWN  => 3
 };
 
+sub version($$);
+
 Getopt::Long::Configure('no_ignore_case_always');
+
 GetOptions(
     "w|warning=i"    => \$opt->{warning},
     "c|critical=i"   => \$opt->{critical},
     "H|index-host=s" => \$opt->{'index-host'},
     "Z|index-zone=s" => \$opt->{'index-zone'},
     "h|help" => sub { pod2usage( -verbose => 1, -exitval => $rv->{OK} ) },
-    "m|man" => sub { pod2usage( -verbose => 2, -exitval => $rv->{OK} ) },
+    "m|man" => sub { pod2usage( 
+            -exitval => $rv->{OK},
+            # "system('perldoc -V &>/dev/null')" appears shorter, but may not
+            # do what you expect ( it still returns 0 on debian squeeze with
+            # dash as system shell even if cannot find the command in $PATH)
+            -noperldoc => system('perldoc -V >/dev/null 2>&1'),
+            -verbose => 2 ) },
     "V|version" => sub { version( $ME, $VERSION ); exit $rv->{OK}; }
 ) or pod2usage( -verbose => 1, -exitval => $rv->{CRITICAL} );