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 # pod2usage -- command to print usage messages from embedded pod docs
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 pod2usage - print usage messages from embedded pod docs in files
62 [B<-exit>S< >I<exitval>]
63 [B<-output>S< >I<outfile>]
64 [B<-verbose> I<level>]
65 [B<-pathlist> I<dirlist>]
70 =head1 OPTIONS AND ARGUMENTS
76 Print a brief help message and exit.
80 Print this command's manual page and exit.
82 =item B<-exit> I<exitval>
84 The exit status value to return.
86 =item B<-output> I<outfile>
88 The output file to print to. If the special names "-" or ">&1" or ">&STDOUT"
89 are used then standard output is used. If ">&2" or ">&STDERR" is used then
90 standard error is used.
92 =item B<-verbose> I<level>
94 The desired level of verbosity to use:
96 1 : print SYNOPSIS only
97 2 : print SYNOPSIS sections and any OPTIONS/ARGUMENTS sections
98 3 : print the entire manpage (similar to running pod2text)
100 =item B<-pathlist> I<dirlist>
102 Specifies one or more directories to search for the input file if it
103 was not supplied with an absolute path. Each directory path in the given
104 list should be separated by a ':' on Unix (';' on MSWin32 and DOS).
108 The pathname of a file containing pod documentation to be output in
109 usage message format (defaults to standard input).
115 B<pod2usage> will read the given input file looking for pod
116 documentation and will print the corresponding usage message.
117 If no input file is specified then standard input is read.
119 B<pod2usage> invokes the B<pod2usage()> function in the B<Pod::Usage>
120 module. Please see L<Pod::Usage/pod2usage()>.
124 L<Pod::Usage>, L<pod2text(1)>
128 Please report bugs using L<http://rt.cpan.org>.
130 Brad Appleton E<lt>bradapp@enteract.comE<gt>
132 Based on code for B<pod2text(1)> written by
133 Tom Christiansen E<lt>tchrist@mox.perl.comE<gt>
152 GetOptions(\%options, @opt_specs) || pod2usage(2);
153 pod2usage(1) if ($options{help});
154 pod2usage(VERBOSE => 2) if ($options{man});
156 ## Dont default to STDIN if connected to a terminal
157 pod2usage(2) if ((@ARGV == 0) && (-t STDIN));
159 @ARGV = ('-') unless (@ARGV);
161 print STDERR "pod2usage: Too many filenames given\n\n";
166 $usage{-input} = shift(@ARGV);
167 $usage{-exitval} = $options{'exit'} if (defined $options{'exit'});
168 $usage{-output} = $options{'output'} if (defined $options{'output'});
169 $usage{-verbose} = $options{'verbose'} if (defined $options{'verbose'});
170 $usage{-pathlist} = $options{'pathlist'} if (defined $options{'pathlist'});
177 close OUT or die "Can't close $file: $!";
178 chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
179 exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';