#!/usr/local/bin/perl
my
$origdir
= cwd;
chdir
dirname($0);
my
$file
= basename($0,
'.PL'
);
$file
.=
'.com'
if
$^O eq
'VMS'
;
open
OUT,
'>'
,
$file
or
die
"Can't create $file: $!"
;
print
"Extracting $file (with variable substitutions)\n"
;
print
OUT
<<"!GROK!THIS!";
$Config{startperl}
eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
if 0; # ^ Run only under a shell
!GROK!THIS!
my
$script
= File::Spec->catfile(
File::Spec->catdir(
File::Spec->updir,
qw[cpan JSON-PP bin]
),
"json_pp"
);
if
(
open
(IN,
'<'
,
$script
)) {
print
OUT <IN>;
close
IN;
}
else
{
die
"$0: cannot find '$script'\n"
;
}
close
OUT or
die
"Can't close $file: $!"
;
chmod
0755,
$file
or
die
"Can't reset permissions for $file: $!\n"
;
exec
(
"$Config{'eunicefix'} $file"
)
if
$Config
{
'eunicefix'
} ne
':'
;
chdir
$origdir
;