Skip to content

Commit

Permalink
Item10168: Fix display of manual page in rewriteshebang.pl if perldoc…
Browse files Browse the repository at this point in the history
… isn't available

git-svn-id: http://svn.foswiki.org/branches/Release01x01@10341 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
IngoKappler authored and IngoKappler committed Dec 16, 2010
1 parent 463f9fd commit 23f873d
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions core/tools/rewriteshebang.pl
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ BEGIN
my @args;
$/ = "\n";

my $man = 0;
my $help = 0;

# Parse options and print usage if there is a syntax error,
# or if usage was explicitly requested.

# Also consider perldoc availability.
my $help = 0;
my $man = 0;
my $perldoc = qx| perldoc 2>&1 1>/dev/null |;
GetOptions(
'help|?' => \$help,
man => \$man,
Expand All @@ -47,7 +47,12 @@ BEGIN
'ask!' => \$ask
) or pod2usage(2);
pod2usage(1) if $help;
pod2usage( -verbose => 2 ) if $man;
if ( $perldoc =~ /^Usage: perldoc.*/ ) {
pod2usage( -verbose => 2 ) if $man;
}
else {
pod2usage( -verbose => 2, -noperldoc => 1 ) if $man;
}

unless ($new_path) {
$new_path = $^X;
Expand Down

0 comments on commit 23f873d

Please sign in to comment.