summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Zakharevich <ilya@math.berkeley.edu>1998-07-19 14:16:38 -0400
committerGurusamy Sarathy <gsar@cpan.org>1998-07-21 04:55:51 +0000
commitcbce877f83f260d9f1664e6a2860d1dd13e47de9 (patch)
treeb222fabf666b80a826e1ee4c81cf2f6fc09d5194
parent5c08494a9097815fa21f0f73751af672efd9ed24 (diff)
downloadperl-cbce877f83f260d9f1664e6a2860d1dd13e47de9.tar.gz
Compile (?{}) into a correct package
Message-Id: <199807192216.SAA10482@monk.mps.ohio-state.edu> p4raw-id: //depot/perl@1601
-rw-r--r--pp_ctl.c4
-rwxr-xr-xt/op/pat.t15
2 files changed, 18 insertions, 1 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 0750220063..68c50a5f40 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2252,6 +2252,10 @@ sv_compile_2op(SV *sv, OP** startop, char *code, AV** avp)
SAVETMPS;
/* switch to eval mode */
+ if (PL_curcop == &PL_compiling) {
+ SAVESPTR(PL_compiling.cop_stash);
+ PL_compiling.cop_stash = PL_curstash;
+ }
SAVESPTR(PL_compiling.cop_filegv);
SAVEI16(PL_compiling.cop_line);
sprintf(tmpbuf, "_<(%.10s_eval %lu)", code, (unsigned long)++PL_evalseq);
diff --git a/t/op/pat.t b/t/op/pat.t
index f16783ede9..7d4278f38a 100755
--- a/t/op/pat.t
+++ b/t/op/pat.t
@@ -4,7 +4,7 @@
# the format supported by op/regexp.t. If you want to add a test
# that does fit that format, add it to op/re_tests, not here.
-print "1..139\n";
+print "1..141\n";
BEGIN {
chdir 't' if -d 't';
@@ -534,6 +534,19 @@ $test++;
print "ok $test\n";
$test++;
}
+
+{
+ package aa;
+ $c = 2;
+ $::c = 3;
+ '' =~ /(?{ $c = 4 })/;
+ print "not " unless $c == 4;
+}
+print "ok $test\n";
+$test++;
+print "not " unless $c == 3;
+print "ok $test\n";
+$test++;
sub must_warn_pat {
my $warn_pat = shift;