if(unop->op_first && unop->op_first->op_type == OP_PUSHRE) {
PMOP *pm = (PMOP *)unop->op_first;
SV *rv = sv_newmortal();
- REGEXP *re = pm->op_pmregexp;
-
sv = newSVrv(rv, "Regexp");
- sv_setpvn(sv,re->precomp,re->prelen);
- sv_magic(sv,(SV*)ReREFCNT_inc(re),'r',0,0);
+ sv_magic(sv,(SV*)ReREFCNT_inc(pm->op_pmregexp),'r',0,0);
RETURNX(PUSHs(rv));
}
if (!sv)
s = "NULLREF";
else {
+ MAGIC *mg;
+
switch (SvTYPE(sv)) {
+ case SVt_PVMG:
+ if ( ((SvFLAGS(sv) &
+ (SVs_OBJECT|SVf_OK|SVs_GMG|SVs_SMG|SVs_RMG))
+ == (SVs_OBJECT|SVs_RMG))
+ && strEQ(s=HvNAME(SvSTASH(sv)), "Regexp")
+ && (mg = mg_find(sv, 'r'))) {
+ regexp *re = (regexp *)mg->mg_obj;
+
+ *lp = re->prelen;
+ return re->precomp;
+ }
+ /* Fall through */
case SVt_NULL:
case SVt_IV:
case SVt_NV:
case SVt_PV:
case SVt_PVIV:
case SVt_PVNV:
- case SVt_PVBM:
- case SVt_PVMG: s = "SCALAR"; break;
+ case SVt_PVBM: s = "SCALAR"; break;
case SVt_PVLV: s = "LVALUE"; break;
case SVt_PVAV: s = "ARRAY"; break;
case SVt_PVHV: s = "HASH"; break;