2 eval 'exec perl -S $0 "$@"'
5 #############################################################################
6 # pod2usage -- command to print usage messages from embedded pod docs
8 # Copyright (c) 1996-2000 by Bradford Appleton. All rights reserved.
9 # This file is part of "PodParser". PodParser is free software;
10 # you can redistribute it and/or modify it under the same terms
12 #############################################################################
19 pod2usage - print usage messages from embedded pod docs in files
29 [B<-exit>S< >I<exitval>]
30 [B<-output>S< >I<outfile>]
31 [B<-verbose> I<level>]
32 [B<-pathlist> I<dirlist>]
37 =head1 OPTIONS AND ARGUMENTS
43 Print a brief help message and exit.
47 Print this command's manual page and exit.
49 =item B<-exit> I<exitval>
51 The exit status value to return.
53 =item B<-output> I<outfile>
55 The output file to print to. If the special names "-" or ">&1" or ">&STDOUT"
56 are used then standard output is used. If ">&2" or ">&STDERR" is used then
57 standard error is used.
59 =item B<-verbose> I<level>
61 The desired level of verbosity to use:
63 1 : print SYNOPSIS only
64 2 : print SYNOPSIS sections and any OPTIONS/ARGUMENTS sections
65 3 : print the entire manpage (similar to running pod2text)
67 =item B<-pathlist> I<dirlist>
69 Specifies one or more directories to search for the input file if it
70 was not supplied with an absolute path. Each directory path in the given
71 list should be separated by a ':' on Unix (';' on MSWin32 and DOS).
75 The pathname of a file containing pod documentation to be output in
76 usage mesage format (defaults to standard input).
82 B<pod2usage> will read the given input file looking for pod
83 documentation and will print the corresponding usage message.
84 If no input file is specifed than standard input is read.
86 B<pod2usage> invokes the B<pod2usage()> function in the B<Pod::Usage>
87 module. Please see L<Pod::Usage/pod2usage()>.
91 L<Pod::Usage>, L<pod2text(1)>
95 Please report bugs using L<http://rt.cpan.org>.
97 Brad Appleton E<lt>bradapp@enteract.comE<gt>
99 Based on code for B<pod2text(1)> written by
100 Tom Christiansen E<lt>tchrist@mox.perl.comE<gt>
119 GetOptions
(\
%options, @opt_specs) || pod2usage
(2);
120 pod2usage
(1) if ($options{help
});
121 pod2usage
(VERBOSE
=> 2) if ($options{man
});
123 ## Dont default to STDIN if connected to a terminal
124 pod2usage
(2) if ((@ARGV == 0) && (-t STDIN
));
126 @ARGV = ("-") unless (@ARGV > 0);
128 print STDERR
"pod2usage: Too many filenames given\n\n";
133 $usage{-input
} = shift(@ARGV);
134 $usage{-exitval
} = $options{"exit"} if (defined $options{"exit"});
135 $usage{-output
} = $options{"output"} if (defined $options{"output"});
136 $usage{-verbose
} = $options{"verbose"} if (defined $options{"verbose"});
137 $usage{-pathlist
} = $options{"pathlist"} if (defined $options{"pathlist"});