From: Nicholas Clark Date: Tue, 18 Nov 2008 11:09:47 +0000 (+0000) Subject: Rafael noticed a bug in 34873 - I was comparing against the wrong X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=606f8fc8222f5bd75c0a46b2d82c7f0f0800f301;p=p5sagit%2Fp5-mst-13.2.git Rafael noticed a bug in 34873 - I was comparing against the wrong variable, and hence (usually) saving all globs, not just those that should be kept. p4raw-id: //depot/perl@34879 --- diff --git a/pp_ctl.c b/pp_ctl.c index ba0dee0..a29c1f4 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -3731,7 +3731,7 @@ PP(pp_entereval) PUTBACK; ok = doeval(gimme, NULL, runcv, seq); if ((PERLDB_LINE || PERLDB_SAVESRC) - && was != (I32)PL_sub_generation /* Some subs defined here. */ + && was != (U32)PL_breakable_sub_generation /* Some subs defined here. */ && ok) { /* Just need to change the string in our writable scratch buffer that will be used at scope exit to delete this eval's "file" name, to diff --git a/t/comp/retainedlines.t b/t/comp/retainedlines.t index aa044ad..41c279e 100644 --- a/t/comp/retainedlines.t +++ b/t/comp/retainedlines.t @@ -10,7 +10,9 @@ BEGIN { use strict; -plan( tests => 19 ); +plan (tests => 21); + +$^P = 0xA; my @before = grep { /eval/ } keys %::; @@ -20,7 +22,6 @@ my %seen; my $name = 'foo'; for my $sep (' ', "\0") { - $^P = 0xA; my $prog = "sub $name { 'Perl${sep}Rules' @@ -46,3 +47,11 @@ for my $sep (' ', "\0") { $seen{$keys[0]}++; $name++; } + +is (eval '1 + 1', 2, 'String eval works'); + +my @after = grep { /eval/ } keys %::; + +is (@after, 0 + keys %seen, + "evals that don't define subroutines are correctly cleaned up"); +