1N/A#!/usr/local/bin/perl
1N/A
1N/Ause Config;
1N/Ause File::Basename qw(&basename &dirname);
1N/Ause Cwd;
1N/A
1N/A# List explicitly here the variables you want Configure to
1N/A# generate. Metaconfig only looks for shell variables, so you
1N/A# have to mention them as if they were shell variables, not
1N/A# %Config entries. Thus you write
1N/A# $startperl
1N/A# to ensure Configure will look for $Config{startperl}.
1N/A
1N/A# This forces PL files to create target in same directory as PL file.
1N/A# This is so that make depend always knows where to find PL derivatives.
1N/A$origdir = cwd;
1N/Achdir(dirname($0));
1N/A$file = basename($0, '.PL');
1N/A$file .= '.com' if $^O eq 'VMS';
1N/A
1N/Aopen OUT,">$file" or die "Can't create $file: $!";
1N/A
1N/Aprint "Extracting $file (with variable substitutions)\n";
1N/A
1N/A# In this section, perl variables will be expanded during extraction.
1N/A# You can use $Config{...} to use Configure variables.
1N/A
1N/Aprint OUT <<"!GROK!THIS!";
1N/A$Config{'startperl'}
1N/A eval 'exec perl -S \$0 "\$@"'
1N/A if 0;
1N/A!GROK!THIS!
1N/A
1N/A# In the following, perl variables are not expanded during extraction.
1N/A
1N/Aprint OUT <<'!NO!SUBS!';
1N/A
1N/A#############################################################################
1N/A# pod2usage -- command to print usage messages from embedded pod docs
1N/A#
1N/A# Copyright (c) 1996-2000 by Bradford Appleton. All rights reserved.
1N/A# This file is part of "PodParser". PodParser is free software;
1N/A# you can redistribute it and/or modify it under the same terms
1N/A# as Perl itself.
1N/A#############################################################################
1N/A
1N/Ause strict;
1N/Ause diagnostics;
1N/A
1N/A=head1 NAME
1N/A
1N/Apod2usage - print usage messages from embedded pod docs in files
1N/A
1N/A=head1 SYNOPSIS
1N/A
1N/A=over 12
1N/A
1N/A=item B<pod2usage>
1N/A
1N/A[B<-help>]
1N/A[B<-man>]
1N/A[B<-exit>S< >I<exitval>]
1N/A[B<-output>S< >I<outfile>]
1N/A[B<-verbose> I<level>]
1N/A[B<-pathlist> I<dirlist>]
1N/AI<file>
1N/A
1N/A=back
1N/A
1N/A=head1 OPTIONS AND ARGUMENTS
1N/A
1N/A=over 8
1N/A
1N/A=item B<-help>
1N/A
1N/APrint a brief help message and exit.
1N/A
1N/A=item B<-man>
1N/A
1N/APrint this command's manual page and exit.
1N/A
1N/A=item B<-exit> I<exitval>
1N/A
1N/AThe exit status value to return.
1N/A
1N/A=item B<-output> I<outfile>
1N/A
1N/AThe output file to print to. If the special names "-" or ">&1" or ">&STDOUT"
1N/Aare used then standard output is used. If ">&2" or ">&STDERR" is used then
1N/Astandard error is used.
1N/A
1N/A=item B<-verbose> I<level>
1N/A
1N/AThe desired level of verbosity to use:
1N/A
1N/A 1 : print SYNOPSIS only
1N/A 2 : print SYNOPSIS sections and any OPTIONS/ARGUMENTS sections
1N/A 3 : print the entire manpage (similar to running pod2text)
1N/A
1N/A=item B<-pathlist> I<dirlist>
1N/A
1N/ASpecifies one or more directories to search for the input file if it
1N/Awas not supplied with an absolute path. Each directory path in the given
1N/Alist should be separated by a ':' on Unix (';' on MSWin32 and DOS).
1N/A
1N/A=item I<file>
1N/A
1N/AThe pathname of a file containing pod documentation to be output in
1N/Ausage mesage format (defaults to standard input).
1N/A
1N/A=back
1N/A
1N/A=head1 DESCRIPTION
1N/A
1N/AB<pod2usage> will read the given input file looking for pod
1N/Adocumentation and will print the corresponding usage message.
1N/AIf no input file is specifed than standard input is read.
1N/A
1N/AB<pod2usage> invokes the B<pod2usage()> function in the B<Pod::Usage>
1N/Amodule. Please see L<Pod::Usage/pod2usage()>.
1N/A
1N/A=head1 SEE ALSO
1N/A
1N/AL<Pod::Usage>, L<pod2text(1)>
1N/A
1N/A=head1 AUTHOR
1N/A
1N/APlease report bugs using L<http://rt.cpan.org>.
1N/A
1N/ABrad Appleton E<lt>bradapp@enteract.comE<gt>
1N/A
1N/ABased on code for B<pod2text(1)> written by
1N/ATom Christiansen E<lt>tchrist@mox.perl.comE<gt>
1N/A
1N/A=cut
1N/A
1N/Ause Pod::Usage;
1N/Ause Getopt::Long;
1N/A
1N/A## Define options
1N/Amy %options = ();
1N/Amy @opt_specs = (
1N/A "help",
1N/A "man",
1N/A "exit=i",
1N/A "output=s",
1N/A "pathlist=s",
1N/A "verbose=i",
1N/A);
1N/A
1N/A## Parse options
1N/AGetOptions(\%options, @opt_specs) || pod2usage(2);
1N/Apod2usage(1) if ($options{help});
1N/Apod2usage(VERBOSE => 2) if ($options{man});
1N/A
1N/A## Dont default to STDIN if connected to a terminal
1N/Apod2usage(2) if ((@ARGV == 0) && (-t STDIN));
1N/A
1N/A@ARGV = ("-") unless (@ARGV > 0);
1N/Aif (@ARGV > 1) {
1N/A print STDERR "pod2usage: Too many filenames given\n\n";
1N/A pod2usage(2);
1N/A}
1N/A
1N/Amy %usage = ();
1N/A$usage{-input} = shift(@ARGV);
1N/A$usage{-exitval} = $options{"exit"} if (defined $options{"exit"});
1N/A$usage{-output} = $options{"output"} if (defined $options{"output"});
1N/A$usage{-verbose} = $options{"verbose"} if (defined $options{"verbose"});
1N/A$usage{-pathlist} = $options{"pathlist"} if (defined $options{"pathlist"});
1N/A
1N/Apod2usage(\%usage);
1N/A
1N/A
1N/A!NO!SUBS!
1N/A
1N/Aclose OUT or die "Can't close $file: $!";
1N/Achmod 0755, $file or die "Can't reset permissions for $file: $!\n";
1N/Aexec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';
1N/Achdir $origdir;