4 use File::Basename qw(&basename &dirname);
7 # List explicitly here the variables you want Configure to
8 # generate. Metaconfig only looks for shell variables, so you
9 # have to mention them as if they were shell variables, not
10 # %Config entries. Thus you write
12 # to ensure Configure will look for $Config{startperl}.
14 # This forces PL files to create target in same directory as PL file.
15 # This is so that make depend always knows where to find PL derivatives.
18 $file = basename($0, '.PL');
19 $file .= '.com' if $^O eq 'VMS';
21 open OUT,">$file" or die "Can't create $file: $!";
23 print "Extracting $file (with variable substitutions)\n";
25 # In this section, perl variables will be expanded during extraction.
26 # You can use $Config{...} to use Configure variables.
28 print OUT <<"!GROK!THIS!";
30 eval 'exec perl -S \$0 "\$@"'
34 # In the following, perl variables are not expanded during extraction.
36 print OUT <<'!NO!SUBS!';
38 #############################################################################
39 # podselect -- command to invoke the podselect function in Pod::Select
41 # Copyright (c) 1996-2000 by Bradford Appleton. All rights reserved.
42 # This file is part of "PodParser". PodParser is free software;
43 # you can redistribute it and/or modify it under the same terms
45 #############################################################################
52 podselect - print selected sections of pod documentation on standard output
56 B<podselect> [B<-help>] [B<-man>] [B<-section>S< >I<section-spec>]
59 =head1 OPTIONS AND ARGUMENTS
65 Print a brief help message and exit.
69 Print the manual page and exit.
71 =item B<-section>S< >I<section-spec>
73 Specify a section to include in the output.
74 See L<Pod::Parser/"SECTION SPECIFICATIONS">
75 for the format to use for I<section-spec>.
76 This option may be given multiple times on the command line.
80 The pathname of a file from which to select sections of pod
81 documentation (defaults to standard input).
87 B<podselect> will read the given input files looking for pod
88 documentation and will print out (in raw pod format) all sections that
89 match one ore more of the given section specifications. If no section
90 specifications are given than all pod sections encountered are output.
92 B<podselect> invokes the B<podselect()> function exported by B<Pod::Select>
93 Please see L<Pod::Select/podselect()> for more details.
97 L<Pod::Parser> and L<Pod::Select>
101 Please report bugs using L<http://rt.cpan.org>.
103 Brad Appleton E<lt>bradapp@enteract.comE<gt>
105 Based on code for B<Pod::Text::pod2text(1)> written by
106 Tom Christiansen E<lt>tchrist@mox.perl.comE<gt>
122 GetOptions(\%options, 'help', 'man', 'sections|select=s@') || pod2usage(2);
123 pod2usage(1) if ($options{help});
124 pod2usage(-verbose => 2) if ($options{man});
126 ## Dont default to STDIN if connected to a terminal
127 pod2usage(2) if ((@ARGV == 0) && (-t STDIN));
129 ## Invoke podselect().
130 if (@{ $options{'sections'} } > 0) {
131 podselect({ -sections => $options{'sections'} }, @ARGV);
140 close OUT or die "Can't close $file: $!";
141 chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
142 exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';