On Thu, 30 Mar 2000 13:38:08 +0200, "Andreas J. Koenig" wrote: >Thanks to a bugreport by Larry Virden I could track down various warnings that >sometimes appear during CPAN.pm's r command. These can be traced back to the >following smaller testcase. The testcase is based on code found in CGI::Base. > >% perl -we ' >use warnings; >{ > my $eval = q[ > package ExtUtils::MakeMaker::_version; > no strict; > > local $VERSION; > $VERSION=undef; do { > ($VERSION = $Revision) =~ s/.*(\d+\.\d+).*/$1/; > }; $VERSION > ]; > no warnings; > eval($eval); >} >' >Use of uninitialized value in substitution (s///) at (eval 1) line 7. >% > >I would expect that this should be silent. Try this patch. Sarathy gsar@ActiveState.com -----------------------------------8<----------------------------------- Change 5934 by gsar@auger on 2000/04/24 17:16:54 propagate lexical warnings from surrounding scope correctly within string eval() Affected files ... ... //depot/perl/pp_ctl.c#198 edit ... //depot/perl/t/pragma/warn/pp_ctl#11 edit Differences ... ==== //depot/perl/pp_ctl.c#198 (text) ==== Index: perl/pp_ctl.c --- perl/pp_ctl.c.~1~ Mon Apr 24 10:16:59 2000 +++ perl/pp_ctl.c Mon Apr 24 10:16:59 2000 @@ -3261,9 +3261,11 @@ 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); ==== //depot/perl/t/pragma/warn/pp_ctl#11 (text) ==== Index: perl/t/pragma/warn/pp_ctl --- perl/t/pragma/warn/pp_ctl.~1~ Mon Apr 24 10:16:59 2000 +++ perl/t/pragma/warn/pp_ctl Mon Apr 24 10:16:59 2000 @@ -214,4 +214,17 @@ { 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 End of Patch.