/* perl.c
*
* Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
- * 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 by Larry Wall
- * and others
+ * 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
+ * by Larry Wall and others
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
* function of the interpreter; that can be found in perlmain.c
*/
+#ifdef PERL_IS_MINIPERL
+# define USE_SITECUSTOMIZE
+#endif
+
#include "EXTERN.h"
#define PERL_IN_PERL_C
#include "perl.h"
#if defined(USE_HASH_SEED) || defined(USE_HASH_SEED_EXPLICIT)
/* [perl #22371] Algorimic Complexity Attack on Perl 5.6.1, 5.8.0
* This MUST be done before any hash stores or fetches take place.
- * If you set PL_rehash_seed (and assumedly also PL_rehash_seed_set)
+ * If you set PL_rehash_seed (and presumably also PL_rehash_seed_set)
* yourself, it is your responsibility to provide a good random seed!
* You can also define PERL_HASH_SEED in compile time, see hv.h. */
if (!PL_rehash_seed_set)
}
}
-#if defined(USE_SITECUSTOMIZE) && !defined(PERL_IS_MINIPERL)
+#if defined(USE_SITECUSTOMIZE)
if (!minus_f) {
- /* SITELIB_EXP is a function call on Win32.
- The games with local $! are to avoid setting errno if there is no
+ /* The games with local $! are to avoid setting errno if there is no
sitecustomize script. */
+# ifdef PERL_IS_MINIPERL
+ AV *const inc = GvAV(PL_incgv);
+ SV **const inc0 = inc ? av_fetch(inc, 0, FALSE) : NULL;
+
+ if (inc0) {
+ (void)Perl_av_create_and_unshift_one(aTHX_ &PL_preambleav,
+ Perl_newSVpvf(aTHX_
+ "BEGIN { do {local $!; -f '%"SVf"/buildcustomize.pl'} && do '%"SVf"/buildcustomize.pl' }", *inc0, *inc0));
+ }
+# else
+ /* SITELIB_EXP is a function call on Win32. */
const char *const sitelib = SITELIB_EXP;
(void)Perl_av_create_and_unshift_one(aTHX_ &PL_preambleav,
Perl_newSVpvf(aTHX_
"BEGIN { do {local $!; -f '%s/sitecustomize.pl'} && do '%s/sitecustomize.pl' }", sitelib, sitelib));
+# endif
}
#endif
/* The following permits -d:Mod to accepts arguments following an =
in the fashion that -MSome::Mod does. */
if (*s == ':' || *s == '=') {
- const char *start = ++s;
- const char *const end = s + strlen(s);
- SV * const sv = newSVpvs("use Devel::");
+ const char *start;
+ const char *end;
+ SV *sv;
+
+ if (*++s == '-') {
+ ++s;
+ sv = newSVpvs("no Devel::");
+ } else {
+ sv = newSVpvs("use Devel::");
+ }
+
+ start = s;
+ end = s + strlen(s);
- /* We now allow -d:Module=Foo,Bar */
+ /* We now allow -d:Module=Foo,Bar and -d:-Module */
while(isALNUM(*s) || *s==':') ++s;
if (*s != '=')
sv_catpvn(sv, start, end - start);
#endif
PerlIO_printf(PerlIO_stdout(),
- "\n\nCopyright 1987-2010, Larry Wall\n");
+ "\n\nCopyright 1987-2011, Larry Wall\n");
#ifdef MSDOS
PerlIO_printf(PerlIO_stdout(),
"\nMS-DOS port Copyright (c) 1989, 1990, Diomidis Spinellis\n");
libdir = tempsv;
if (PL_tainting &&
(PL_uid != PL_euid || PL_gid != PL_egid)) {
- /* Need to taint reloccated paths if running set ID */
+ /* Need to taint relocated paths if running set ID */
SvTAINTED_on(libdir);
}
}