avoid leaking lexicals into program being debugged (from Ilya
Gurusamy Sarathy [Fri, 28 Jan 2000 17:10:08 +0000 (17:10 +0000)]
Zakharevich)

p4raw-id: //depot/perl@4923

lib/perl5db.pl

index d2bd98e..b463dec 100644 (file)
@@ -1254,11 +1254,11 @@ sub save {
 # The following takes its argument via $evalarg to preserve current @_
 
 sub eval {
-    my @res;
+    local @res;                        # 'my' would make it visible from user code
     {
-       my $otrace = $trace;
-       my $osingle = $single;
-       my $od = $^D;
+       local $otrace = $trace;
+       local $osingle = $single;
+       local $od = $^D;
        @res = eval "$usercontext $evalarg;\n"; # '\n' for nice recursive debug
        $trace = $otrace;
        $single = $osingle;