typo in change#3768
[p5sagit/p5-mst-13.2.git] / pod / pod2text.PL
CommitLineData
cb1a09d0 1#!/usr/local/bin/perl
2
c07a80fd 3use Config;
4use File::Basename qw(&basename &dirname);
cb1a09d0 5
c07a80fd 6# List explicitly here the variables you want Configure to
7# generate. Metaconfig only looks for shell variables, so you
8# have to mention them as if they were shell variables, not
9# %Config entries. Thus you write
10# $startperl
11# to ensure Configure will look for $Config{startperl}.
cb1a09d0 12
b233458b 13$file = basename($0);
44a8e56a 14$file = basename($0, '.PL');
774d564b 15$file .= '.com' if $^O eq 'VMS';
cb1a09d0 16
b233458b 17chdir("pod") or die "Can't chdir to pod: $!";
c07a80fd 18open OUT,">$file" or die "Can't create $file: $!";
cb1a09d0 19
c07a80fd 20print "Extracting $file (with variable substitutions)\n";
cb1a09d0 21
c07a80fd 22# In this section, perl variables will be expanded during extraction.
23# You can use $Config{...} to use Configure variables.
cb1a09d0 24
c07a80fd 25print OUT <<"!GROK!THIS!";
5f05dabc 26$Config{startperl}
27 eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
28 if \$running_under_some_shell;
c07a80fd 29!GROK!THIS!
cb1a09d0 30
c07a80fd 31# In the following, perl variables are not expanded during extraction.
cb1a09d0 32
c07a80fd 33print OUT <<'!NO!SUBS!';
cb1a09d0 34
c07a80fd 35use Pod::Text;
cb1a09d0 36
c07a80fd 37if(@ARGV) {
38 pod2text($ARGV[0]);
39} else {
40 pod2text("<&STDIN");
cb1a09d0 41}
42
c07a80fd 43!NO!SUBS!
cb1a09d0 44
c07a80fd 45close OUT or die "Can't close $file: $!";
46chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
47exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';