summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-11-18 11:09:47 +0000
committerNicholas Clark <nick@ccl4.org>2008-11-18 11:09:47 +0000
commit606f8fc8222f5bd75c0a46b2d82c7f0f0800f301 (patch)
treeee7fc114a26744e4ddd1410f92db9f9f1f31b902
parent27382b8e6a962ca9892f6b2cc051439368e18043 (diff)
downloadperl-606f8fc8222f5bd75c0a46b2d82c7f0f0800f301.tar.gz
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
-rw-r--r--pp_ctl.c2
-rw-r--r--t/comp/retainedlines.t13
2 files changed, 12 insertions, 3 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index ba0dee08fe..a29c1f4ee7 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 aa044ad84e..41c279e62b 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");
+