From: Heiko Schlittermann (HS12-RIPE) Date: Thu, 17 Oct 2019 05:22:54 +0000 (+0200) Subject: exipick: use Pod::Usage X-Git-Url: https://git.exim.org/users/heiko/exim.git/commitdiff_plain/cc05007f1dd71890b2b34b7aec5ed12dc5942c73?ds=inline exipick: use Pod::Usage --- diff --git a/src/src/exipick.src b/src/src/exipick.src index a2281f0da..da6dbec02 100644 --- a/src/src/exipick.src +++ b/src/src/exipick.src @@ -18,10 +18,11 @@ use strict; BEGIN { pop @INC if $INC[-1] eq '.' }; use Getopt::Long; use File::Basename; +use Pod::Usage; -my($p_name) = $0 =~ m|/?([^/]+)$|; +my $p_name = basename $0; my $p_version = "20100323.0"; -my $p_usage = "Usage: $p_name [--help|--version] (see --help for details)"; +my $p_usage = "Usage: $p_name [--help|--man|--version] (see --help for details)"; my $p_cp = < @@ -39,7 +40,6 @@ my $p_cp = < \$G::just_vars, # only display vars, no other info 'show-rules' => \$G::show_rules, # display compiled match rules 'show-tests' => \$G::show_tests, # display tests as applied to each message + 'man' => sub { pod2usage(-verbose => 2, -exit => 0, -noperldoc => system('perldoc -V >/dev/null 2>&1')) }, + 'help' => sub { pod2usage(-verbose => 1, -exit => 0) }, 'version' => sub { - print basename($0) . ": $0\n", + print "$p_name: $0\n", "build: EXIM_RELEASE_VERSIONEXIM_VARIANT_VERSION\n", "perl(runtime): $]\n"; exit 0; }, -) || exit(1); +) or pod2usage; # if both freeze and thaw specified, only thaw as it is less destructive $G::freeze = undef if ($G::freeze && $G::thaw); @@ -1266,34 +1268,16 @@ sub dump { } # BEGIN -sub ext_usage { - if ($ARGV[0] =~ /^--help$/i) { - require Config; - $ENV{PATH} .= ":" unless $ENV{PATH} eq ""; - $ENV{PATH} = "$ENV{PATH}$Config::Config{'installscript'}"; - #exec("perldoc", "-F", "-U", $0) || exit 1; - $< = $> = 1 if ($> == 0 || $< == 0); - exec("perldoc", $0) || exit 1; - # make parser happy - %Config::Config = (); - } elsif ($ARGV[0] =~ /^--version$/i) { - print "$p_name version $p_version\n\n$p_cp\n"; - } else { - return; - } - - exit(0); -} - __END__ =head1 NAME -exipick - selectively display messages from an Exim queue + exipick - selectively display messages from an Exim queue =head1 SYNOPSIS -exipick [] [ [ ...]] + exipick [] [ [ ...]] + exipick --help|--man =head1 DESCRIPTION