1N/A#!/usr/local/bin/perl
1N/A
1N/Ause Config;
1N/Ause File::Basename qw(&basename &dirname);
1N/Ause File::Spec;
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:
1N/A# $startperl
1N/A# $perlpath
1N/A# $eunicefix
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/A# Open input file before creating output file.
1N/A$IN = File::Spec->catfile(File::Spec->updir, 'lib', 'diagnostics.pm');
1N/Aopen IN or die "Can't open $IN: $!\n";
1N/A
1N/A# Create output file.
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 \$running_under_some_shell;
1N/A!GROK!THIS!
1N/A
1N/Awhile (<IN>) {
1N/A print OUT unless /^package diagnostics/;
1N/A}
1N/A
1N/Aclose IN;
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;