diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-04-24 17:16:54 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-04-24 17:16:54 +0000 |
commit | f0a6fc868045c83877fa78e3e0f6f0be236d2a27 (patch) | |
tree | 44f03413b20c59f1db854fe8f73beb33b09bc870 | |
parent | 412d7f2ac8b8d226b5ba373178f4ce457f246032 (diff) | |
download | perl-f0a6fc868045c83877fa78e3e0f6f0be236d2a27.tar.gz |
propagate lexical warnings from surrounding scope correctly
within string eval()
p4raw-id: //depot/perl@5934
-rw-r--r-- | pp_ctl.c | 8 | ||||
-rw-r--r-- | t/pragma/warn/pp_ctl | 15 |
2 files changed, 19 insertions, 4 deletions
@@ -3261,9 +3261,11 @@ PP(pp_entereval) SAVEHINTS(); PL_hints = PL_op->op_targ; SAVESPTR(PL_compiling.cop_warnings); - if (!specialWARN(PL_compiling.cop_warnings)) { - PL_compiling.cop_warnings = newSVsv(PL_compiling.cop_warnings) ; - SAVEFREESV(PL_compiling.cop_warnings) ; + if (specialWARN(PL_curcop->cop_warnings)) + PL_compiling.cop_warnings = PL_curcop->cop_warnings; + else { + PL_compiling.cop_warnings = newSVsv(PL_curcop->cop_warnings); + SAVEFREESV(PL_compiling.cop_warnings); } push_return(PL_op->op_next); diff --git a/t/pragma/warn/pp_ctl b/t/pragma/warn/pp_ctl index 0deccd35e2..ac01f277b1 100644 --- a/t/pragma/warn/pp_ctl +++ b/t/pragma/warn/pp_ctl @@ -214,4 +214,17 @@ DESTROY { die "@{$_[0]} foo bar" } { bless ['A'], 'Foo' for 1..10 } { bless ['B'], 'Foo' for 1..10 } EXPECT - +######## +# pp_ctl.c +use warnings; +eval 'print $foo'; +EXPECT +Use of uninitialized value in print at (eval 1) line 1. +######## +# pp_ctl.c +use warnings; +{ + no warnings; + eval 'print $foo'; +} +EXPECT |