perl
view release on metacpan or search on metacpan
if (croak_on_error) {
sv_2mortal(sv);
eval_sv(sv, G_SCALAR | G_RETHROW);
}
else {
eval_sv(sv, G_SCALAR);
SvREFCNT_dec(sv);
}
sv = *PL_stack_sp;
#ifdef PERL_RC_STACK
if (rpp_stack_is_rc()) {
SvREFCNT_inc_NN(sv_2mortal(sv));
rpp_popfree_1();
}
else
#endif
PL_stack_sp--;
return sv;
}
/* Require a module. */
/*
=for apidoc_section $embedding
=for apidoc require_pv
Tells Perl to C<require> the file named by the string argument. It is
analogous to the Perl code C<eval "require '$file'">. It's even
implemented that way; consider using load_module instead.
=cut */
void
Perl_require_pv(pTHX_ const char *pv)
{
dSP;
SV* sv;
PERL_ARGS_ASSERT_REQUIRE_PV;
PUSHSTACKi(PERLSI_REQUIRE);
sv = Perl_newSVpvf(aTHX_ "require q%c%s%c", 0, pv, 0);
eval_sv(sv_2mortal(sv), G_DISCARD);
POPSTACK;
}
STATIC void
S_usage(pTHX) /* XXX move this out into a module ? */
{
/* This message really ought to be max 23 lines.
* Removed -h because the user already knows that option. Others? */
/* Grouped as 6 lines per C string literal, to keep under the ANSI C 89
minimum of 509 character string literals. */
static const char * const usage_msg[] = {
" -0[octal/hexadecimal] specify record separator (\\0, if no argument)\n"
" -a autosplit mode with -n or -p (splits $_ into @F)\n"
" -C[number/list] enables the listed Unicode features\n"
" -c check syntax only (runs BEGIN and CHECK blocks)\n"
" -d[t][:MOD] run program under debugger or module Devel::MOD\n"
" -D[number/letters] set debugging flags (argument is a bit mask or alphabets)\n",
" -e commandline one line of program (several -e's allowed, omit programfile)\n"
" -E commandline like -e, but enables all optional features\n"
" -f don't do $sitelib/sitecustomize.pl at startup\n"
" -F/pattern/ split() pattern for -a switch (//'s are optional)\n"
" -g read all input in one go (slurp), rather than line-by-line (alias for -0777)\n"
" -i[extension] edit <> files in place (makes backup if extension supplied)\n"
" -Idirectory specify @INC/#include directory (several -I's allowed)\n",
" -l[octnum] enable line ending processing, specifies line terminator\n"
" -[mM][-]module execute \"use/no module...\" before executing program\n"
" -n assume \"while (<>) { ... }\" loop around program\n"
" -p assume loop like -n but print line also, like sed\n"
" -s enable rudimentary parsing for switches after programfile\n"
" -S look for programfile using PATH environment variable\n",
" -t enable tainting warnings\n"
" -T enable tainting checks\n"
" -u dump core after parsing program\n"
" -U allow unsafe operations\n"
" -v print version, patchlevel and license\n"
" -V[:configvar] print configuration summary (or a single Config.pm variable)\n",
" -w enable many useful warnings\n"
" -W enable all warnings\n"
" -x[directory] ignore text before #!perl line (optionally cd to directory)\n"
" -X disable all warnings\n"
" \n"
"Run 'perldoc perl' for more help with Perl.\n\n",
NULL
};
const char * const *p = usage_msg;
PerlIO *out = PerlIO_stdout();
PerlIO_printf(out,
"\nUsage: %s [switches] [--] [programfile] [arguments]\n",
PL_origargv[0]);
while (*p)
PerlIO_puts(out, *p++);
my_exit(0);
}
/* convert a string of -D options (or digits) into an int.
* sets *s to point to the char after the options */
#ifdef DEBUGGING
int
Perl_get_debug_opts(pTHX_ const char **s, bool givehelp)
{
static const char * const usage_msgd[] = {
" Debugging flag values: (see also -d)\n"
" p Tokenizing and parsing (with v, displays parse stack)\n"
" s Stack snapshots (with v, displays all stacks)\n"
" l Context (loop) stack processing\n"
" t Trace execution\n"
" o Method and overloading resolution\n",
" c String/numeric conversions\n"
" P Print profiling info, source file input state\n"
" m Memory and SV allocation\n"
" f Format processing\n"
( run in 0.411 second using v1.01-cache-2.11-cpan-71847e10f99 )