B-C
view release on metacpan or search on metacpan
#if defined(CSH)
if (!PL_cshlen)
PL_cshlen = strlen(PL_cshname);
#endif
_EOT12
}
# XXX With -e "" we need to fake parse_body() scriptname = BIT_BUCKET
print <<'_EOT13';
#ifdef ALLOW_PERL_OPTIONS
#define EXTRA_OPTIONS 3
#else
#define EXTRA_OPTIONS 4
#endif /* ALLOW_PERL_OPTIONS */
Newx(fakeargv, argc + EXTRA_OPTIONS + 1, char *);
fakeargv[0] = argv[0];
fakeargv[1] = "-e";
fakeargv[2] = "";
options_count = 3;
_EOT13
# honour -T
if (!$PERL56 and ${^TAINT}) {
print <<'_EOT14';
fakeargv[options_count] = "-T";
++options_count;
_EOT14
}
print <<'_EOT15';
#ifndef ALLOW_PERL_OPTIONS
fakeargv[options_count] = "--";
++options_count;
#endif /* ALLOW_PERL_OPTIONS */
for (i = 1; i < argc; i++)
fakeargv[i + options_count - 1] = argv[i];
fakeargv[argc + options_count - 1] = 0;
exitstatus = perl_parse(my_perl, xs_init, argc + options_count - 1,
fakeargv, env);
if (exitstatus)
exit( exitstatus );
TAINT;
_EOT15
if ($use_perl_script_name) {
my $dollar_0 = cstring($0);
print sprintf(qq{ sv_setpv_mg(get_svs("0", GV_ADD|GV_NOTQUAL), %s);\n}, $dollar_0);
print sprintf(qq{ CopFILE_set(&PL_compiling, %s);\n}, $dollar_0);
}
else {
#print q{ warn("PL_origalen=%d\n", PL_origalen);},"\n";
print qq{ sv_setpv_mg(get_svs("0", GV_ADD|GV_NOTQUAL), argv[0]);\n};
print qq{ CopFILE_set(&PL_compiling, argv[0]);\n};
}
# more global vars
print " PL_hints = $^H;\n" if $^H;
print " PL_unicode = ${^UNICODE};\n" if ${^UNICODE};
# system-specific needs to be skipped: is set during init_i18nl10n if PerlIO
# is compiled in and on a utf8 locale.
#print " PL_utf8locale = ${^UTF8LOCALE};\n" if ${^UTF8LOCALE};
#print " PL_utf8cache = ${^UTF8CACHE};\n" if ${^UTF8CACHE};
# nomg
print sprintf(qq{ sv_setpv(get_svs(";", GV_ADD|GV_NOTQUAL), %s);\n}, cstring($;)) if $; ne "\34";
print sprintf(qq{ sv_setpv(get_svs("\\"", GV_NOTQUAL), %s); /* \$" */\n}, cstring($")) if $" ne " ";
# global IO vars
if ($PERL56) {
print sprintf(qq{ PL_ofs = %s; PL_ofslen = %u; /* \$, */\n}, cstring($,), length $,) if $,;
print sprintf(qq{ PL_ors = %s; PL_orslen = %u; /* \$\\ */\n}, cstring($\), length $\) if $\;
} else {
print sprintf(qq{ sv_setpv_mg(GvSVn(PL_ofsgv), %s); /* \$, */\n}, cstring($,)) if $,;
print sprintf(qq{ sv_setpv_mg(get_svs("\\\\", GV_ADD|GV_NOTQUAL), %s); /* \$\\ */\n}, cstring($\)) if $\; #ORS
}
print sprintf(qq{ sv_setpv_mg(get_svs("/", GV_NOTQUAL), %s);\n}, cstring($/)) if $/ ne "\n"; #RS
print qq{ sv_setiv_mg(get_svs("|", GV_ADD|GV_NOTQUAL), $|);\n} if $|; #OUTPUT_AUTOFLUSH
# global format vars
print sprintf(qq{ sv_setpv_mg(get_svs("^A", GV_ADD|GV_NOTQUAL), %s);\n}, cstring($^A)) if $^A; #ACCUMULATOR
print sprintf(qq{ sv_setpv_mg(get_svs("^L", GV_ADD|GV_NOTQUAL), %s);\n}, cstring($^L)) if $^L ne "\f"; #FORMFEED
print sprintf(qq{ sv_setpv_mg(get_svs(":", GV_ADD|GV_NOTQUAL), %s);\n}, cstring($:)) if $: ne " \n-"; #LINE_BREAK_CHARACTERS
print sprintf(qq/ sv_setpv_mg(get_svs("^", GV_ADD|GV_NOTQUAL), savepvn(%s, %u));\n/, cstring($^), length($^))
if $^ ne "STDOUT_TOP";
print sprintf(qq/ sv_setpv_mg(get_svs("~", GV_ADD|GV_NOTQUAL), savepvn(%s, %u));\n/, cstring($~), length($~))
if $~ ne "STDOUT";
print qq{ sv_setiv_mg(get_svs("%", GV_ADD|GV_NOTQUAL), $%);\n} if $%; #PAGE_NUMBER
print qq{ sv_setiv_mg(get_svs("-", GV_ADD|GV_NOTQUAL), $-);\n} unless ($- == 0 or $- == 60); #LINES_LEFT
print qq{ sv_setiv_mg(get_svs("=", GV_ADD|GV_NOTQUAL), $=);\n} if $= != 60; #LINES_PER_PAGE
# deprecated global vars
print qq{ {SV* s = get_svs("[",GV_NOTQUAL); sv_setiv(s, $[); mg_set(s);}\n} if $[; #ARRAY_BASE
if ($] < 5.010) { # OFMT and multiline matching
eval q[
print sprintf(qq{ sv_setpv(GvSVn(gv_fetchpv("\$#", GV_ADD|GV_NOTQUAL, SVt_PV)), %s);\n},
cstring($#)) if $#;
print sprintf(qq{ sv_setiv(GvSVn(gv_fetchpv("\$*", GV_ADD|GV_NOTQUAL, SVt_IV)), %d);\n}, $*) if $*;
];
}
print sprintf(qq{ sv_setpv_mg(get_svs("\030", GV_ADD|GV_NOTQUAL), %s); /* \$^X */\n},
cstring($Config{perlpath}));
print <<'EOT';
TAINT_NOT;
#if PERL_VERSION < 10 || ((PERL_VERSION == 10) && (PERL_SUBVERSION < 1))
PL_compcv = 0;
#else
PL_compcv = MUTABLE_CV(newSV_type(SVt_PVCV));
CvUNIQUE_on(PL_compcv);
CvPADLIST(PL_compcv) = pad_new(0);
#endif
EOT
output_init();
print " exitstatus = perl_run( my_perl );\n";
output_local_destruct("main");
output_global_destruct();
# XXX endav is called via call_list and so it is freed right after usage.
# Setting dirty here is useless.
# Protect against pad undef in END block
#print " PL_dirty = 1;\n" unless $B::C::pv_copy_on_grow;
( run in 1.579 second using v1.01-cache-2.11-cpan-5a3173703d6 )