X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fpod2usage.PL;h=b9e6c772c2c0fa6c122258b66afbb21ac5ff9436;hb=68cbce50efee2c3ae424cfe29c83b65d5b462b69;hp=f534252e3ed9a3208023be82217c55fb9dcfbc58;hpb=b233458bd1d5037ce4bbbb41fb513e1b68522a4d;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/pod2usage.PL b/pod/pod2usage.PL index f534252..b9e6c77 100644 --- a/pod/pod2usage.PL +++ b/pod/pod2usage.PL @@ -2,6 +2,7 @@ use Config; use File::Basename qw(&basename &dirname); +use Cwd; # List explicitly here the variables you want Configure to # generate. Metaconfig only looks for shell variables, so you @@ -10,11 +11,13 @@ use File::Basename qw(&basename &dirname); # $startperl # to ensure Configure will look for $Config{startperl}. -$file = basename($0); -$file =~ s/\.PL$//i; +# This forces PL files to create target in same directory as PL file. +# This is so that make depend always knows where to find PL derivatives. +$origdir = cwd; +chdir(dirname($0)); +$file = basename($0, '.PL'); $file .= '.com' if $^O eq 'VMS'; -chdir("pod") or die "Can't chdir to pod: $!"; open OUT,">$file" or die "Can't create $file: $!"; print "Extracting $file (with variable substitutions)\n"; @@ -35,17 +38,14 @@ print OUT <<'!NO!SUBS!'; ############################################################################# # pod2usage -- command to print usage messages from embedded pod docs # -# Derived from Tom Christiansen's pod2text script. -# (with extensive modifications) -# -# Copyright (c) 1996 Bradford Appleton. All rights reserved. +# Copyright (c) 1996-2000 by Bradford Appleton. All rights reserved. # This file is part of "PodParser". PodParser is free software; # you can redistribute it and/or modify it under the same terms # as Perl itself. ############################################################################# use strict; -use diagnostics; +#use diagnostics; =head1 NAME @@ -106,7 +106,7 @@ list should be separated by a ':' on Unix (';' on MSWin32 and DOS). =item I The pathname of a file containing pod documentation to be output in -usage mesage format (defaults to standard input). +usage message format (defaults to standard input). =back @@ -114,7 +114,7 @@ usage mesage format (defaults to standard input). B will read the given input file looking for pod documentation and will print the corresponding usage message. -If no input file is specifed than standard input is read. +If no input file is specified then standard input is read. B invokes the B function in the B module. Please see L. @@ -125,6 +125,8 @@ L, L =head1 AUTHOR +Please report bugs using L. + Brad Appleton Ebradapp@enteract.comE Based on code for B written by @@ -138,12 +140,12 @@ use Getopt::Long; ## Define options my %options = (); my @opt_specs = ( - "help", - "man", - "exit=i", - "output=s", - "pathlist=s", - "verbose=i", + 'help', + 'man', + 'exit=i', + 'output=s', + 'pathlist=s', + 'verbose=i', ); ## Parse options @@ -154,7 +156,7 @@ pod2usage(VERBOSE => 2) if ($options{man}); ## Dont default to STDIN if connected to a terminal pod2usage(2) if ((@ARGV == 0) && (-t STDIN)); -@ARGV = ("-") unless (@ARGV > 0); +@ARGV = ('-') unless (@ARGV); if (@ARGV > 1) { print STDERR "pod2usage: Too many filenames given\n\n"; pod2usage(2); @@ -162,10 +164,10 @@ if (@ARGV > 1) { my %usage = (); $usage{-input} = shift(@ARGV); -$usage{-exitval} = $options{"exit"} if (defined $options{"exit"}); -$usage{-output} = $options{"output"} if (defined $options{"output"}); -$usage{-verbose} = $options{"verbose"} if (defined $options{"verbose"}); -$usage{-pathlist} = $options{"pathlist"} if (defined $options{"pathlist"}); +$usage{-exitval} = $options{'exit'} if (defined $options{'exit'}); +$usage{-output} = $options{'output'} if (defined $options{'output'}); +$usage{-verbose} = $options{'verbose'} if (defined $options{'verbose'}); +$usage{-pathlist} = $options{'pathlist'} if (defined $options{'pathlist'}); pod2usage(\%usage); @@ -175,3 +177,4 @@ pod2usage(\%usage); close OUT or die "Can't close $file: $!"; chmod 0755, $file or die "Can't reset permissions for $file: $!\n"; exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':'; +chdir $origdir;