[14489] | 1 | @rem = '--*-Perl-*--
|
---|
| 2 | @echo off
|
---|
| 3 | if "%OS%" == "Windows_NT" goto WinNT
|
---|
| 4 | perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
|
---|
| 5 | goto endofperl
|
---|
| 6 | :WinNT
|
---|
| 7 | perl -x -S %0 %*
|
---|
| 8 | if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
|
---|
| 9 | if %errorlevel% == 9009 echo You do not have Perl in your PATH.
|
---|
| 10 | if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
|
---|
| 11 | goto endofperl
|
---|
| 12 | @rem ';
|
---|
| 13 | #!perl
|
---|
| 14 | #line 15
|
---|
| 15 | eval 'exec perl -S $0 "$@"'
|
---|
| 16 | if 0;
|
---|
| 17 |
|
---|
| 18 | #############################################################################
|
---|
| 19 | # pod2usage -- command to print usage messages from embedded pod docs
|
---|
| 20 | #
|
---|
| 21 | # Copyright (c) 1996-2000 by Bradford Appleton. All rights reserved.
|
---|
| 22 | # This file is part of "PodParser". PodParser is free software;
|
---|
| 23 | # you can redistribute it and/or modify it under the same terms
|
---|
| 24 | # as Perl itself.
|
---|
| 25 | #############################################################################
|
---|
| 26 |
|
---|
| 27 | use strict;
|
---|
| 28 | use diagnostics;
|
---|
| 29 |
|
---|
| 30 | =head1 NAME
|
---|
| 31 |
|
---|
| 32 | pod2usage - print usage messages from embedded pod docs in files
|
---|
| 33 |
|
---|
| 34 | =head1 SYNOPSIS
|
---|
| 35 |
|
---|
| 36 | =over 12
|
---|
| 37 |
|
---|
| 38 | =item B<pod2usage>
|
---|
| 39 |
|
---|
| 40 | [B<-help>]
|
---|
| 41 | [B<-man>]
|
---|
| 42 | [B<-exit>S< >I<exitval>]
|
---|
| 43 | [B<-output>S< >I<outfile>]
|
---|
| 44 | [B<-verbose> I<level>]
|
---|
| 45 | [B<-pathlist> I<dirlist>]
|
---|
| 46 | I<file>
|
---|
| 47 |
|
---|
| 48 | =back
|
---|
| 49 |
|
---|
| 50 | =head1 OPTIONS AND ARGUMENTS
|
---|
| 51 |
|
---|
| 52 | =over 8
|
---|
| 53 |
|
---|
| 54 | =item B<-help>
|
---|
| 55 |
|
---|
| 56 | Print a brief help message and exit.
|
---|
| 57 |
|
---|
| 58 | =item B<-man>
|
---|
| 59 |
|
---|
| 60 | Print this command's manual page and exit.
|
---|
| 61 |
|
---|
| 62 | =item B<-exit> I<exitval>
|
---|
| 63 |
|
---|
| 64 | The exit status value to return.
|
---|
| 65 |
|
---|
| 66 | =item B<-output> I<outfile>
|
---|
| 67 |
|
---|
| 68 | The output file to print to. If the special names "-" or ">&1" or ">&STDOUT"
|
---|
| 69 | are used then standard output is used. If ">&2" or ">&STDERR" is used then
|
---|
| 70 | standard error is used.
|
---|
| 71 |
|
---|
| 72 | =item B<-verbose> I<level>
|
---|
| 73 |
|
---|
| 74 | The desired level of verbosity to use:
|
---|
| 75 |
|
---|
| 76 | 1 : print SYNOPSIS only
|
---|
| 77 | 2 : print SYNOPSIS sections and any OPTIONS/ARGUMENTS sections
|
---|
| 78 | 3 : print the entire manpage (similar to running pod2text)
|
---|
| 79 |
|
---|
| 80 | =item B<-pathlist> I<dirlist>
|
---|
| 81 |
|
---|
| 82 | Specifies one or more directories to search for the input file if it
|
---|
| 83 | was not supplied with an absolute path. Each directory path in the given
|
---|
| 84 | list should be separated by a ':' on Unix (';' on MSWin32 and DOS).
|
---|
| 85 |
|
---|
| 86 | =item I<file>
|
---|
| 87 |
|
---|
| 88 | The pathname of a file containing pod documentation to be output in
|
---|
| 89 | usage mesage format (defaults to standard input).
|
---|
| 90 |
|
---|
| 91 | =back
|
---|
| 92 |
|
---|
| 93 | =head1 DESCRIPTION
|
---|
| 94 |
|
---|
| 95 | B<pod2usage> will read the given input file looking for pod
|
---|
| 96 | documentation and will print the corresponding usage message.
|
---|
| 97 | If no input file is specifed than standard input is read.
|
---|
| 98 |
|
---|
| 99 | B<pod2usage> invokes the B<pod2usage()> function in the B<Pod::Usage>
|
---|
| 100 | module. Please see L<Pod::Usage/pod2usage()>.
|
---|
| 101 |
|
---|
| 102 | =head1 SEE ALSO
|
---|
| 103 |
|
---|
| 104 | L<Pod::Usage>, L<pod2text(1)>
|
---|
| 105 |
|
---|
| 106 | =head1 AUTHOR
|
---|
| 107 |
|
---|
| 108 | Please report bugs using L<http://rt.cpan.org>.
|
---|
| 109 |
|
---|
| 110 | Brad Appleton E<lt>[email protected]<gt>
|
---|
| 111 |
|
---|
| 112 | Based on code for B<pod2text(1)> written by
|
---|
| 113 | Tom Christiansen E<lt>[email protected]<gt>
|
---|
| 114 |
|
---|
| 115 | =cut
|
---|
| 116 |
|
---|
| 117 | use Pod::Usage;
|
---|
| 118 | use Getopt::Long;
|
---|
| 119 |
|
---|
| 120 | ## Define options
|
---|
| 121 | my %options = ();
|
---|
| 122 | my @opt_specs = (
|
---|
| 123 | "help",
|
---|
| 124 | "man",
|
---|
| 125 | "exit=i",
|
---|
| 126 | "output=s",
|
---|
| 127 | "pathlist=s",
|
---|
| 128 | "verbose=i",
|
---|
| 129 | );
|
---|
| 130 |
|
---|
| 131 | ## Parse options
|
---|
| 132 | GetOptions(\%options, @opt_specs) || pod2usage(2);
|
---|
| 133 | pod2usage(1) if ($options{help});
|
---|
| 134 | pod2usage(VERBOSE => 2) if ($options{man});
|
---|
| 135 |
|
---|
| 136 | ## Dont default to STDIN if connected to a terminal
|
---|
| 137 | pod2usage(2) if ((@ARGV == 0) && (-t STDIN));
|
---|
| 138 |
|
---|
| 139 | @ARGV = ("-") unless (@ARGV > 0);
|
---|
| 140 | if (@ARGV > 1) {
|
---|
| 141 | print STDERR "pod2usage: Too many filenames given\n\n";
|
---|
| 142 | pod2usage(2);
|
---|
| 143 | }
|
---|
| 144 |
|
---|
| 145 | my %usage = ();
|
---|
| 146 | $usage{-input} = shift(@ARGV);
|
---|
| 147 | $usage{-exitval} = $options{"exit"} if (defined $options{"exit"});
|
---|
| 148 | $usage{-output} = $options{"output"} if (defined $options{"output"});
|
---|
| 149 | $usage{-verbose} = $options{"verbose"} if (defined $options{"verbose"});
|
---|
| 150 | $usage{-pathlist} = $options{"pathlist"} if (defined $options{"pathlist"});
|
---|
| 151 |
|
---|
| 152 | pod2usage(\%usage);
|
---|
| 153 |
|
---|
| 154 |
|
---|
| 155 |
|
---|
| 156 | __END__
|
---|
| 157 | :endofperl
|
---|