7 use File::Basename qw(&basename &dirname);
11 # List explicitly here the variables you want Configure to
12 # generate. Metaconfig only looks for shell variables, so you
13 # have to mention them as if they were shell variables, not
19 # This forces PL files to create target in same directory as PL file.
20 # This is so that make depend always knows where to find PL derivatives.
23 my $file = basename($0, '.PL');
24 $file .= '.com' if $^O eq 'VMS';
26 # Open input file before creating output file.
27 my $in = File::Spec->catfile(File::Spec->updir, 'lib', 'diagnostics.pm');
28 open IN, '<', $in or die "Can't open $in: $!\n";
31 open OUT, '>', $file or die "Can't create $file: $!";
33 print "Extracting $file (with variable substitutions)\n";
35 # In this section, perl variables will be expanded during extraction.
36 # You can use $Config{...} to use Configure variables.
38 print OUT <<"!GROK!THIS!";
40 eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
41 if 0; # ^ Run only under a shell
44 print OUT <<'!NO!SUBS!';
46 BEGIN { pop @INC if $INC[-1] eq '.' }
51 print OUT unless /^package diagnostics/;
56 close OUT or die "Can't close $file: $!";
57 chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
58 exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';