summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-10-25 05:40:40 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-10-25 05:40:40 +0000
commit2158dd9ba94672764f0bb8563ece1a0573db179b (patch)
treed9e4b4b4b8f38dbd658c3bcffa36e6eaf2df1b8b
parentf2da832e840f54013cb015f86420ceda75823b28 (diff)
downloadperl-2158dd9ba94672764f0bb8563ece1a0573db179b.tar.gz
integrate change#2053 from maint-5.005
p4raw-link: @2053 on //depot/maint-5.005/perl: 2c3f7d309175811e431d5baa7695e7610e2fa584 p4raw-id: //depot/perl@2057 p4raw-integrated: from //depot/maint-5.005/perl@2056 'copy in' t/cmd/while.t (@1649..) 'merge in' cop.h (@1649..)
-rw-r--r--cop.h3
-rwxr-xr-xt/cmd/while.t21
2 files changed, 22 insertions, 2 deletions
diff --git a/cop.h b/cop.h
index 98ae91f54a..1aa21d56ae 100644
--- a/cop.h
+++ b/cop.h
@@ -206,7 +206,8 @@ struct block {
PL_stack_sp = PL_stack_base + cx->blk_oldsp, \
PL_markstack_ptr = PL_markstack + cx->blk_oldmarksp, \
PL_scopestack_ix = cx->blk_oldscopesp, \
- PL_retstack_ix = cx->blk_oldretsp
+ PL_retstack_ix = cx->blk_oldretsp, \
+ PL_curpm = cx->blk_oldpm
/* substitution context */
struct subst {
diff --git a/t/cmd/while.t b/t/cmd/while.t
index c6e464d444..392c13779f 100755
--- a/t/cmd/while.t
+++ b/t/cmd/while.t
@@ -2,7 +2,7 @@
# $RCSfile: while.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:15 $
-print "1..10\n";
+print "1..15\n";
open (tmp,'>Cmd_while.tmp') || die "Can't create Cmd_while.tmp.";
print tmp "tvi925\n";
@@ -109,3 +109,22 @@ $i = 9;
$i++;
}
print "ok $i\n";
+
+# Check curpm is reset when jumping out of a scope
+'abc' =~ /b/;
+WHILE:
+while (1) {
+ $i++;
+ print "#$`,$&,$',\nnot " unless $` . $& . $' eq "abc";
+ print "ok $i\n";
+ { # Localize changes to $` and friends
+ 'end' =~ /end/;
+ redo WHILE if $i == 11;
+ next WHILE if $i == 12;
+ # 13 do a normal loop
+ last WHILE if $i == 14;
+ }
+}
+$i++;
+print "not " unless $` . $& . $' eq "abc";
+print "ok $i\n";