diff options
-rw-r--r-- | pp_hot.c | 16 | ||||
-rwxr-xr-x | t/op/pat.t | 10 |
2 files changed, 25 insertions, 1 deletions
@@ -1336,6 +1336,22 @@ play_it_again: } } if (global) { + if (pm->op_pmflags & PMf_CONTINUE) { + MAGIC* mg = 0; + if (SvTYPE(TARG) >= SVt_PVMG && SvMAGIC(TARG)) + mg = mg_find(TARG, PERL_MAGIC_regex_global); + if (!mg) { + sv_magic(TARG, (SV*)0, PERL_MAGIC_regex_global, Nullch, 0); + mg = mg_find(TARG, PERL_MAGIC_regex_global); + } + if (rx->startp[0] != -1) { + mg->mg_len = rx->endp[0]; + if (rx->startp[0] == rx->endp[0]) + mg->mg_flags |= MGf_MINMATCH; + else + mg->mg_flags &= ~MGf_MINMATCH; + } + } had_zerolen = (rx->startp[0] != -1 && rx->startp[0] == rx->endp[0]); PUTBACK; /* EVAL blocks may use stack */ diff --git a/t/op/pat.t b/t/op/pat.t index bed2f376ff..d2d3205576 100755 --- a/t/op/pat.t +++ b/t/op/pat.t @@ -6,7 +6,7 @@ $| = 1; -print "1..683\n"; +print "1..684\n"; BEGIN { chdir 't' if -d 't'; @@ -1979,3 +1979,11 @@ print "ok 682\n" if @a == 9 && "@a" eq "f o o \n $a $b b a r"; @a = ("foo\n\x{100}bar" =~ /\C/gs); print "ok 683\n" if @a == 9 && "@a" eq "f o o \n $a $b b a r"; +{ + # [ID 20010814.004] pos() doesn't work when using =~m// in list context + $_ = "ababacadaea"; + $a = join ":", /b./gc; + $b = join ":", /a./gc; + $c = pos; + print "$a $b $c" eq 'ba:ba ad:ae 10' ? "ok 684\n" : "not ok 684\t# $a $b $c\n"; +} |