/* gv.c
*
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- * 2000, 2001, 2002, 2003, 2004, 2005, 2006, by Larry Wall and others
+ * 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 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.
Perl_newGP(pTHX_ GV *const gv)
{
GP *gp;
- const char *const file = CopFILE(PL_curcop) ? CopFILE(PL_curcop) : "";
+ const char *const file
+ = (PL_curcop && CopFILE(PL_curcop)) ? CopFILE(PL_curcop) : "";
STRLEN len = strlen(file);
U32 hash;
gp->gv_sv = newSV(0);
#endif
- gp->gp_line = CopLINE(PL_curcop);
+ gp->gp_line = PL_curcop ? CopLINE(PL_curcop) : 0;
/* XXX Ideally this cast would be replaced with a change to const char*
in the struct. */
gp->gp_file_hek = share_hek(file, len, hash);
stash = gv_stashsv(namesv, FALSE);
if (!stash)
Perl_croak( aTHX_ "panic: Can't use %%%s because %"SVf" is not available",
- varpv, module);
+ varpv, SVfARG(module));
else if (!gv_fetchmethod(stash, methpv))
Perl_croak( aTHX_ "panic: Can't use %%%s because %"SVf" does not support method %s",
- varpv, module, methpv);
+ varpv, SVfARG(module), methpv);
}
return stash;
}
HV *stash = NULL;
const I32 no_init = flags & (GV_NOADD_NOINIT | GV_NOINIT);
const I32 no_expand = flags & GV_NOEXPAND;
- const I32 add =
- flags & ~SVf_UTF8 & ~GV_NOADD_NOINIT & ~GV_NOEXPAND & ~GV_NOTQUAL;
+ const I32 add = flags & ~GV_NOADD_MASK;
const char *const name_end = nambeg + full_len;
const char *const name_em1 = name_end - 1;
if (strEQ(name2, "NCODING"))
goto magicalize;
break;
+ case '\015': /* $^MATCH */
+ if (strEQ(name2, "ATCH"))
+ goto ro_magicalize;
case '\017': /* $^OPEN */
if (strEQ(name2, "PEN"))
goto magicalize;
break;
+ case '\020': /* $^PREMATCH $^POSTMATCH */
+ if (strEQ(name2, "REMATCH") || strEQ(name2, "OSTMATCH"))
+ goto ro_magicalize;
case '\024': /* ${^TAINT} */
if (strEQ(name2, "AINT"))
goto ro_magicalize;