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 | # podselect -- command to invoke the podselect function in Pod::Select
|
---|
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 | podselect - print selected sections of pod documentation on standard output
|
---|
33 |
|
---|
34 | =head1 SYNOPSIS
|
---|
35 |
|
---|
36 | B<podselect> [B<-help>] [B<-man>] [B<-section>S< >I<section-spec>]
|
---|
37 | [I<file>S< >...]
|
---|
38 |
|
---|
39 | =head1 OPTIONS AND ARGUMENTS
|
---|
40 |
|
---|
41 | =over 8
|
---|
42 |
|
---|
43 | =item B<-help>
|
---|
44 |
|
---|
45 | Print a brief help message and exit.
|
---|
46 |
|
---|
47 | =item B<-man>
|
---|
48 |
|
---|
49 | Print the manual page and exit.
|
---|
50 |
|
---|
51 | =item B<-section>S< >I<section-spec>
|
---|
52 |
|
---|
53 | Specify a section to include in the output.
|
---|
54 | See L<Pod::Parser/"SECTION SPECIFICATIONS">
|
---|
55 | for the format to use for I<section-spec>.
|
---|
56 | This option may be given multiple times on the command line.
|
---|
57 |
|
---|
58 | =item I<file>
|
---|
59 |
|
---|
60 | The pathname of a file from which to select sections of pod
|
---|
61 | documentation (defaults to standard input).
|
---|
62 |
|
---|
63 | =back
|
---|
64 |
|
---|
65 | =head1 DESCRIPTION
|
---|
66 |
|
---|
67 | B<podselect> will read the given input files looking for pod
|
---|
68 | documentation and will print out (in raw pod format) all sections that
|
---|
69 | match one ore more of the given section specifications. If no section
|
---|
70 | specifications are given than all pod sections encountered are output.
|
---|
71 |
|
---|
72 | B<podselect> invokes the B<podselect()> function exported by B<Pod::Select>
|
---|
73 | Please see L<Pod::Select/podselect()> for more details.
|
---|
74 |
|
---|
75 | =head1 SEE ALSO
|
---|
76 |
|
---|
77 | L<Pod::Parser> and L<Pod::Select>
|
---|
78 |
|
---|
79 | =head1 AUTHOR
|
---|
80 |
|
---|
81 | Please report bugs using L<http://rt.cpan.org>.
|
---|
82 |
|
---|
83 | Brad Appleton E<lt>[email protected]<gt>
|
---|
84 |
|
---|
85 | Based on code for B<Pod::Text::pod2text(1)> written by
|
---|
86 | Tom Christiansen E<lt>[email protected]<gt>
|
---|
87 |
|
---|
88 | =cut
|
---|
89 |
|
---|
90 | use Pod::Select;
|
---|
91 | use Pod::Usage;
|
---|
92 | use Getopt::Long;
|
---|
93 |
|
---|
94 | ## Define options
|
---|
95 | my %options = (
|
---|
96 | "help" => 0,
|
---|
97 | "man" => 0,
|
---|
98 | "sections" => [],
|
---|
99 | );
|
---|
100 |
|
---|
101 | ## Parse options
|
---|
102 | GetOptions(\%options, "help", "man", "sections|select=s@") || pod2usage(2);
|
---|
103 | pod2usage(1) if ($options{help});
|
---|
104 | pod2usage(-verbose => 2) if ($options{man});
|
---|
105 |
|
---|
106 | ## Dont default to STDIN if connected to a terminal
|
---|
107 | pod2usage(2) if ((@ARGV == 0) && (-t STDIN));
|
---|
108 |
|
---|
109 | ## Invoke podselect().
|
---|
110 | if (@{ $options{"sections"} } > 0) {
|
---|
111 | podselect({ -sections => $options{"sections"} }, @ARGV);
|
---|
112 | }
|
---|
113 | else {
|
---|
114 | podselect(@ARGV);
|
---|
115 | }
|
---|
116 |
|
---|
117 |
|
---|
118 |
|
---|
119 | __END__
|
---|
120 | :endofperl
|
---|