3 # Copy the cpan/Encode/bin/enc2xs script to utils/, while
4 # prepending a suitable #! invocation.
7 use File::Basename qw(&basename &dirname);
10 # List explicitly here the variables you want Configure to
11 # generate. Metaconfig only looks for shell variables, so you
12 # have to mention them as if they were shell variables, not
13 # %Config entries. Thus you write
15 # to ensure Configure will look for $Config{startperl}.
17 # This forces PL files to create target in same directory as PL file.
18 # This is so that make depend always knows where to find PL derivatives.
21 my $file = basename($0, '.PL');
22 $file .= '.com' if $^O eq 'VMS';
24 open OUT, '>', $file or die "Can't create $file: $!";
26 print "Extracting $file (with variable substitutions)\n";
28 # In this section, perl variables will be expanded during extraction.
29 # You can use $Config{...} to use Configure variables.
31 print OUT <<"!GROK!THIS!";
33 eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
34 if 0; # ^ Run only under a shell
39 my $enc2xs = File::Spec->catfile(File::Spec->catdir(File::Spec->updir, "cpan", "Encode", "bin"), "enc2xs");
41 if (open(ENC2XS, '<', $enc2xs)) {
45 die "$0: cannot find '$enc2xs'\n";
48 close OUT or die "Can't close $file: $!";
49 chmod 0755, $file or die "Can't reset permissions for $file: $!\n";
50 exec("$Config{'eunicefix'} $file") if $Config{'eunicefix'} ne ':';