I don't think trying to bracket the hires time with lores
[p5sagit/p5-mst-13.2.git] / utils / splain.PL
CommitLineData
5f05dabc 1#!/usr/local/bin/perl
2
3use Config;
4use File::Basename qw(&basename &dirname);
8a5546a1 5use Cwd;
5f05dabc 6
7# List explicitly here the variables you want Configure to
8# generate. Metaconfig only looks for shell variables, so you
9# have to mention them as if they were shell variables, not
10# %Config entries:
11# $startperl
12# $perlpath
13# $eunicefix
14
15# This forces PL files to create target in same directory as PL file.
16# This is so that make depend always knows where to find PL derivatives.
8a5546a1 17$origdir = cwd;
44a8e56a 18chdir dirname($0);
19$file = basename($0, '.PL');
774d564b 20$file .= '.com' if $^O eq 'VMS';
5f05dabc 21
22# Open input file before creating output file.
23$IN = '../lib/diagnostics.pm';
24open IN or die "Can't open $IN: $!\n";
25
26# Create output file.
27open OUT,">$file" or die "Can't create $file: $!";
28
29print "Extracting $file (with variable substitutions)\n";
30
31# In this section, perl variables will be expanded during extraction.
32# You can use $Config{...} to use Configure variables.
33
34print OUT <<"!GROK!THIS!";
35$Config{startperl}
36 eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
37 if \$running_under_some_shell;
38!GROK!THIS!
39
40while (<IN>) {
41 print OUT unless /^package diagnostics/;
42}
43
44close IN;
45
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 ':';
8a5546a1 49chdir $origdir;