1N/A#!/usr/local/bin/perl
1N/A
1N/A# This is for generating the perldoc executable.
1N/A# It may eventually be expanded to generate many executables, as
1N/A# explained in the preface of /Programming Perl/ 3e.
1N/A
1N/Arequire 5;
1N/Ause strict;
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
1N/Amy $origdir = cwd;
1N/Achdir dirname($0);
1N/Amy $file = basename($0, '.PL');
1N/Amy $file_shortname = $file; # should be like "perldoc", maybe "perlsyn", etc.
1N/Awarn "How odd, I'm going to generate $file_shortname?!"
1N/A unless $file_shortname =~ m/^\w+$/;
1N/A
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 $Config{perlpath} -S \$0 \${1+"\$@"}'
1N/A if 0;
1N/A
1N/A# This "$file" file was generated by "$0"
1N/A
1N/Arequire 5;
1N/ABEGIN { \$^W = 1 if \$ENV{'PERLDOCDEBUG'} }
1N/Ause Pod::Perldoc;
1N/Aexit( Pod::Perldoc->run() );
1N/A
1N/A!GROK!THIS!
1N/A
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;
1N/A