summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadu Greab <radu@netsoft.ro>2001-06-28 00:50:52 +0300
committerJarkko Hietaniemi <jhi@iki.fi>2001-06-29 14:06:50 +0000
commit16bdb4acd34944ffe721cad7161ffc4c81e35c48 (patch)
tree4186f2064da36401041349c31b048ed50975704c
parentabcf653aa463675479f9ed2ac9430790d962b866 (diff)
downloadperl-16bdb4acd34944ffe721cad7161ffc4c81e35c48.tar.gz
Re: Bug report: split splits on wrong pattern
Message-ID: <15162.11020.279064.471031@ix.netsoft.ro> p4raw-id: //depot/perl@11029
-rw-r--r--pp_ctl.c7
-rwxr-xr-xt/op/split.t12
2 files changed, 16 insertions, 3 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 24dfc26da1..4970bd0623 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -147,8 +147,11 @@ PP(pp_regcomp)
if (!PM_GETRE(pm)->prelen && PL_curpm)
pm = PL_curpm;
- else if (strEQ("\\s+", PM_GETRE(pm)->precomp))
- pm->op_pmflags |= PMf_WHITE;
+ else
+ if (strEQ("\\s+", PM_GETRE(pm)->precomp))
+ pm->op_pmflags |= PMf_WHITE;
+ else
+ pm->op_pmflags &= ~PMf_WHITE;
/* XXX runtime compiled output needs to move to the pad */
if (pm->op_pmflags & PMf_KEEP) {
diff --git a/t/op/split.t b/t/op/split.t
index 8aa91e506f..170dfe82d5 100755
--- a/t/op/split.t
+++ b/t/op/split.t
@@ -5,7 +5,7 @@ BEGIN {
@INC = '../lib';
}
-print "1..44\n";
+print "1..45\n";
$FS = ':';
@@ -244,3 +244,13 @@ print "ok 32\n";
print "ok 44\n";
}
+{
+ # check that PMf_WHITE is cleared after \s+ is used
+ # reported in <20010627113312.RWGY6087.viemta06@localhost>
+ my $r;
+ foreach my $pat ( qr/\s+/, qr/ll/ ) {
+ $r = join ':' => split($pat, "hello cruel world");
+ }
+ print "not " unless $r eq "he:o cruel world";
+ print "ok 45\n";
+}