p |int |magic_setnkeys |SV* sv|MAGIC* mg
p |int |magic_setpack |SV* sv|MAGIC* mg
p |int |magic_setpos |SV* sv|MAGIC* mg
+p |int |magic_setregexp|SV* sv|MAGIC* mg
p |int |magic_setsig |SV* sv|MAGIC* mg
p |int |magic_setsubstr|SV* sv|MAGIC* mg
p |int |magic_settaint |SV* sv|MAGIC* mg
#define magic_setpos Perl_magic_setpos
#endif
#ifdef PERL_CORE
+#define magic_setregexp Perl_magic_setregexp
+#endif
+#ifdef PERL_CORE
#define magic_setsig Perl_magic_setsig
#endif
#ifdef PERL_CORE
#define magic_setpos(a,b) Perl_magic_setpos(aTHX_ a,b)
#endif
#ifdef PERL_CORE
+#define magic_setregexp(a,b) Perl_magic_setregexp(aTHX_ a,b)
+#endif
+#ifdef PERL_CORE
#define magic_setsig(a,b) Perl_magic_setsig(aTHX_ a,b)
#endif
#ifdef PERL_CORE
RV = $ADDR
SV = PVMG\\($ADDR\\) at $ADDR
REFCNT = 1
- FLAGS = \\(OBJECT,RMG\\)
+ FLAGS = \\(OBJECT,SMG\\)
IV = 0
NV = 0
PV = 0
}
int
+Perl_magic_setregexp(pTHX_ SV *sv, MAGIC *mg)
+{
+ sv_unmagic(sv, PERL_MAGIC_qr);
+ return 0;
+}
+
+int
Perl_magic_freeregexp(pTHX_ SV *sv, MAGIC *mg)
{
regexp *re = (regexp *)mg->mg_obj;
MEMBER_TO_FPTR(Perl_magic_setdefelem),
0, 0, 0};
-EXT MGVTBL PL_vtbl_regexp = {0,0,0,0, MEMBER_TO_FPTR(Perl_magic_freeregexp)};
+EXT MGVTBL PL_vtbl_regexp = {0, MEMBER_TO_FPTR(Perl_magic_setregexp),0,0, MEMBER_TO_FPTR(Perl_magic_freeregexp)};
EXT MGVTBL PL_vtbl_regdata = {0, 0, MEMBER_TO_FPTR(Perl_magic_regdata_cnt), 0, 0};
EXT MGVTBL PL_vtbl_regdatum = {MEMBER_TO_FPTR(Perl_magic_regdatum_get),
MEMBER_TO_FPTR(Perl_magic_regdatum_set), 0, 0, 0};
PERL_CALLCONV int Perl_magic_setnkeys(pTHX_ SV* sv, MAGIC* mg);
PERL_CALLCONV int Perl_magic_setpack(pTHX_ SV* sv, MAGIC* mg);
PERL_CALLCONV int Perl_magic_setpos(pTHX_ SV* sv, MAGIC* mg);
+PERL_CALLCONV int Perl_magic_setregexp(pTHX_ SV* sv, MAGIC* mg);
PERL_CALLCONV int Perl_magic_setsig(pTHX_ SV* sv, MAGIC* mg);
PERL_CALLCONV int Perl_magic_setsubstr(pTHX_ SV* sv, MAGIC* mg);
PERL_CALLCONV int Perl_magic_settaint(pTHX_ SV* sv, MAGIC* mg);
re_cc_state state;
CHECKPOINT cp, lastcp;
int toggleutf;
+ register SV *sv;
- if(SvROK(ret) || SvRMAGICAL(ret)) {
- SV *sv = SvROK(ret) ? SvRV(ret) : ret;
-
- if(SvMAGICAL(sv))
- mg = mg_find(sv, PERL_MAGIC_qr);
+ if(SvROK(ret) && SvSMAGICAL(sv = SvRV(ret)))
+ mg = mg_find(sv, PERL_MAGIC_qr);
+ else if (SvSMAGICAL(ret)) {
+ if (SvGMAGICAL(ret))
+ sv_unmagic(ret, PERL_MAGIC_qr);
+ else
+ mg = mg_find(ret, PERL_MAGIC_qr);
}
+
if (mg) {
re = (regexp *)mg->mg_obj;
(void)ReREFCNT_inc(re);
if (DO_UTF8(ret)) pm.op_pmdynflags |= PMdf_DYN_UTF8;
re = CALLREGCOMP(aTHX_ t, t + len, &pm);
if (!(SvFLAGS(ret)
- & (SVs_TEMP | SVs_PADTMP | SVf_READONLY)))
+ & (SVs_TEMP | SVs_PADTMP | SVf_READONLY
+ | SVs_GMG)))
sv_magic(ret,(SV*)ReREFCNT_inc(re),
PERL_MAGIC_qr,0,0);
PL_regprecomp = oprecomp;
case SVt_PVMG:
if ( ((SvFLAGS(sv) &
(SVs_OBJECT|SVf_OK|SVs_GMG|SVs_SMG|SVs_RMG))
- == (SVs_OBJECT|SVs_RMG))
+ == (SVs_OBJECT|SVs_SMG))
&& (mg = mg_find(sv, PERL_MAGIC_qr))) {
regexp *re = (regexp *)mg->mg_obj;
$| = 1;
-print "1..988\n";
+print "1..990\n";
BEGIN {
chdir 't' if -d 't';
ok ( "0" =~ /\p{N}+\z/, "[perl #19767] variant test" );
}
-# last test 988
+{
+
+ $p = 1;
+ foreach (1,2,3,4) {
+ $p++ if /(??{ $p })/
+ }
+ ok ($p == 5, "[perl #20683] (??{ }) returns stale values");
+ { package P; $a=1; sub TIESCALAR { bless[] } sub FETCH { $a++ } }
+ tie $p, P;
+ foreach (1,2,3,4) {
+ /(??{ $p })/
+ }
+ ok ( $p == 5, "(??{ }) returns stale values");
+}
+
+# last test 990