Installer: Early check whether the installation directory is writable
[msysgit.git] / bin / podselect
blob0707680b51544d4c4f2b08e85732e0669232b57e
1 #!/usr/bin/perl
2 eval 'exec perl -S $0 "$@"'
3 if 0;
5 #############################################################################
6 # podselect -- command to invoke the podselect function in Pod::Select
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
11 # as Perl itself.
12 #############################################################################
14 use strict;
15 use diagnostics;
17 =head1 NAME
19 podselect - print selected sections of pod documentation on standard output
21 =head1 SYNOPSIS
23 B<podselect> [B<-help>] [B<-man>] [B<-section>S< >I<section-spec>]
24 [I<file>S< >...]
26 =head1 OPTIONS AND ARGUMENTS
28 =over 8
30 =item B<-help>
32 Print a brief help message and exit.
34 =item B<-man>
36 Print the manual page and exit.
38 =item B<-section>S< >I<section-spec>
40 Specify a section to include in the output.
41 See L<Pod::Parser/"SECTION SPECIFICATIONS">
42 for the format to use for I<section-spec>.
43 This option may be given multiple times on the command line.
45 =item I<file>
47 The pathname of a file from which to select sections of pod
48 documentation (defaults to standard input).
50 =back
52 =head1 DESCRIPTION
54 B<podselect> will read the given input files looking for pod
55 documentation and will print out (in raw pod format) all sections that
56 match one ore more of the given section specifications. If no section
57 specifications are given than all pod sections encountered are output.
59 B<podselect> invokes the B<podselect()> function exported by B<Pod::Select>
60 Please see L<Pod::Select/podselect()> for more details.
62 =head1 SEE ALSO
64 L<Pod::Parser> and L<Pod::Select>
66 =head1 AUTHOR
68 Please report bugs using L<http://rt.cpan.org>.
70 Brad Appleton E<lt>bradapp@enteract.comE<gt>
72 Based on code for B<Pod::Text::pod2text(1)> written by
73 Tom Christiansen E<lt>tchrist@mox.perl.comE<gt>
75 =cut
77 use Pod::Select;
78 use Pod::Usage;
79 use Getopt::Long;
81 ## Define options
82 my %options = (
83 "help" => 0,
84 "man" => 0,
85 "sections" => [],
88 ## Parse options
89 GetOptions(\%options, "help", "man", "sections|select=s@") || pod2usage(2);
90 pod2usage(1) if ($options{help});
91 pod2usage(-verbose => 2) if ($options{man});
93 ## Dont default to STDIN if connected to a terminal
94 pod2usage(2) if ((@ARGV == 0) && (-t STDIN));
96 ## Invoke podselect().
97 if (@{ $options{"sections"} } > 0) {
98 podselect({ -sections => $options{"sections"} }, @ARGV);
100 else {
101 podselect(@ARGV);