From bfafcb9a4c258bd72d8c22f5d8af5edc8897f48e Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Wed, 15 Jun 2011 13:05:11 +0200 Subject: [PATCH] study now passes REXEC_SCREAM to the regex engine when SvSCREAM() is true. This causes the regex engine to take advantage of the study data. --- pod/perldelta.pod | 5 +++++ pp.c | 2 +- t/op/study.t | 9 ++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 1964832..095785c 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -71,6 +71,11 @@ may well be none in a stable release. The implementation of C makes one fewer copy of the scalar's value. +=item * + +If a studied scalar is C with a regex, the engine will now take +advantage of the C data. + =back =head1 Modules and Pragmata diff --git a/pp.c b/pp.c index d3d4cc8..f815d0a 100644 --- a/pp.c +++ b/pp.c @@ -6152,7 +6152,7 @@ PP(pp_split) I32 rex_return; PUTBACK; rex_return = CALLREGEXEC(rx, (char*)s, (char*)strend, (char*)orig, 1 , - sv, NULL, 0); + sv, NULL, SvSCREAM(sv) ? REXEC_SCREAM : 0); SPAGAIN; if (rex_return == 0) break; diff --git a/t/op/study.t b/t/op/study.t index 0e3ddb6..adf5e2b 100644 --- a/t/op/study.t +++ b/t/op/study.t @@ -7,7 +7,7 @@ BEGIN { } watchdog(10); -plan(tests => 29); +plan(tests => 30); use strict; use vars '$x'; @@ -85,3 +85,10 @@ TODO: { ok(!/G.F$/, 'bug 20010618.006'); ok(!/[F]F$/, 'bug 20010618.006'); } + +{ + my $a = 'QaaQaabQaabbQ'; + study $a; + my @a = split /aab*/, $a; + is("@a", 'Q Q Q Q', 'split with studied string passed to the regep engine'); +} -- 2.7.4