In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/7e3136378328f90878eb7873a7a3197897e68253?hp=5b46e1725cda3bd1aa02113edde50ea3004968fd>
- Log ----------------------------------------------------------------- commit 7e3136378328f90878eb7873a7a3197897e68253 Author: Father Chrysostomos <[email protected]> Date: Sat Sep 22 07:13:36 2012 -0700 [perl #96230] Stop qr// from reusing last pattern qr// should not be using the last-successful pattern, because it is "(?^:)", not the empty pattern. A stringified qr// does not use the last-successful pattern. M pp_hot.c M t/op/qr.t commit ab1d075370c212c5b4ea765c3a48fac555cd1f27 Author: Father Chrysostomos <[email protected]> Date: Fri Sep 21 22:44:00 2012 -0700 Let qr.t run from the top level M t/op/qr.t commit 91389db576a7749d43eced976273a63bc61fb973 Author: Father Chrysostomos <[email protected]> Date: Fri Sep 21 22:43:34 2012 -0700 qr.t: Load test.pl in BEGIN so lazy people like me can omit parentheses M t/op/qr.t commit caee4c53b5a4d5a211457a7153214e6cd6001961 Author: Father Chrysostomos <[email protected]> Date: Thu Sep 20 21:31:15 2012 -0700 hv.c: comment typo M hv.c ----------------------------------------------------------------------- Summary of changes: hv.c | 2 +- pp_hot.c | 6 ++++-- t/op/qr.t | 11 +++++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/hv.c b/hv.c index bf82c65..36b7038 100644 --- a/hv.c +++ b/hv.c @@ -2357,7 +2357,7 @@ Perl_hv_iternext_flags(pTHX_ HV *hv, I32 flags) if (!SvOOK(hv)) { /* Too many things (well, pp_each at least) merrily assume that you can - call iv_iternext without calling hv_iterinit, so we'll have to deal + call hv_iternext without calling hv_iterinit, so we'll have to deal with it. */ hv_iterinit(hv); } diff --git a/pp_hot.c b/pp_hot.c index 4100ae2..827395f 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -1286,8 +1286,10 @@ PP(pp_match) - /* empty pattern special-cased to use last successful pattern if possible */ - if (!RX_PRELEN(rx) && PL_curpm) { + /* empty pattern special-cased to use last successful pattern if + possible, except for qr// */ + if (!((struct regexp *)SvANY(rx))->mother_re && !RX_PRELEN(rx) + && PL_curpm) { pm = PL_curpm; rx = PM_GETRE(pm); } diff --git a/t/op/qr.t b/t/op/qr.t index 90535d0..4130799 100644 --- a/t/op/qr.t +++ b/t/op/qr.t @@ -2,9 +2,12 @@ use strict; -require './test.pl'; +BEGIN { + chdir 't'; + require './test.pl'; +} -plan(tests => 18); +plan(tests => 19); sub r { return qr/Good/; @@ -56,3 +59,7 @@ $$e = 'Fake!'; is($$e, 'Fake!'); object_ok($e, 'Stew'); like("$e", qr/\Stew=SCALAR\(0x[0-9a-f]+\)\z/); + +# [perl #96230] qr// should not have the reuse-last-pattern magic +"foo" =~ /foo/; +like "bar",qr//,'[perl #96230] =~ qr// does not reuse last successful pat'; -- Perl5 Master Repository
