perlbug.pod for 5.004
[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
c07a80fd 13# This forces PL files to create target in same directory as PL file.
14# This is so that make depend always knows where to find PL derivatives.
44a8e56a 15chdir dirname($0);
16$file = basename($0, '.PL');
774d564b 17$file .= '.com' if $^O eq 'VMS';
cb1a09d0 18
c07a80fd 19open OUT,">$file" or die "Can't create $file: $!";
cb1a09d0 20
c07a80fd 21print "Extracting $file (with variable substitutions)\n";
cb1a09d0 22
c07a80fd 23# In this section, perl variables will be expanded during extraction.
24# You can use $Config{...} to use Configure variables.
cb1a09d0 25
c07a80fd 26print OUT <<"!GROK!THIS!";
5f05dabc 27$Config{startperl}
28 eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
29 if \$running_under_some_shell;
c07a80fd 30!GROK!THIS!
cb1a09d0 31
c07a80fd 32# In the following, perl variables are not expanded during extraction.
cb1a09d0 33
c07a80fd 34print OUT <<'!NO!SUBS!';
cb1a09d0 35
c07a80fd 36use Pod::Text;
cb1a09d0 37
c07a80fd 38if(@ARGV) {
39 pod2text($ARGV[0]);
40} else {
41 pod2text("<&STDIN");
cb1a09d0 42}
43
c07a80fd 44!NO!SUBS!
cb1a09d0 45
c07a80fd 46close OUT or die "Can't close $file: $!";
47chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
48exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';