source: for-distributions/trunk/bin/windows/perl/bin/pod2usage.bat@ 14489

Last change on this file since 14489 was 14489, checked in by oranfry, 17 years ago

upgrading to perl 5.8

File size: 3.6 KB
Line 
1@rem = '--*-Perl-*--
2@echo off
3if "%OS%" == "Windows_NT" goto WinNT
4perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
5goto endofperl
6:WinNT
7perl -x -S %0 %*
8if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
9if %errorlevel% == 9009 echo You do not have Perl in your PATH.
10if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
11goto 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
27use strict;
28use diagnostics;
29
30=head1 NAME
31
32pod2usage - 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>]
46I<file>
47
48=back
49
50=head1 OPTIONS AND ARGUMENTS
51
52=over 8
53
54=item B<-help>
55
56Print a brief help message and exit.
57
58=item B<-man>
59
60Print this command's manual page and exit.
61
62=item B<-exit> I<exitval>
63
64The exit status value to return.
65
66=item B<-output> I<outfile>
67
68The output file to print to. If the special names "-" or ">&1" or ">&STDOUT"
69are used then standard output is used. If ">&2" or ">&STDERR" is used then
70standard error is used.
71
72=item B<-verbose> I<level>
73
74The 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
82Specifies one or more directories to search for the input file if it
83was not supplied with an absolute path. Each directory path in the given
84list should be separated by a ':' on Unix (';' on MSWin32 and DOS).
85
86=item I<file>
87
88The pathname of a file containing pod documentation to be output in
89usage mesage format (defaults to standard input).
90
91=back
92
93=head1 DESCRIPTION
94
95B<pod2usage> will read the given input file looking for pod
96documentation and will print the corresponding usage message.
97If no input file is specifed than standard input is read.
98
99B<pod2usage> invokes the B<pod2usage()> function in the B<Pod::Usage>
100module. Please see L<Pod::Usage/pod2usage()>.
101
102=head1 SEE ALSO
103
104L<Pod::Usage>, L<pod2text(1)>
105
106=head1 AUTHOR
107
108Please report bugs using L<http://rt.cpan.org>.
109
110Brad Appleton E<lt>[email protected]<gt>
111
112Based on code for B<pod2text(1)> written by
113Tom Christiansen E<lt>[email protected]<gt>
114
115=cut
116
117use Pod::Usage;
118use Getopt::Long;
119
120## Define options
121my %options = ();
122my @opt_specs = (
123 "help",
124 "man",
125 "exit=i",
126 "output=s",
127 "pathlist=s",
128 "verbose=i",
129);
130
131## Parse options
132GetOptions(\%options, @opt_specs) || pod2usage(2);
133pod2usage(1) if ($options{help});
134pod2usage(VERBOSE => 2) if ($options{man});
135
136## Dont default to STDIN if connected to a terminal
137pod2usage(2) if ((@ARGV == 0) && (-t STDIN));
138
139@ARGV = ("-") unless (@ARGV > 0);
140if (@ARGV > 1) {
141 print STDERR "pod2usage: Too many filenames given\n\n";
142 pod2usage(2);
143}
144
145my %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
152pod2usage(\%usage);
153
154
155
156__END__
157:endofperl
Note: See TracBrowser for help on using the repository browser.