[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: [ID 20000127.003] File-scope 'my' array is non-empty, but debugger



On Thu, Jan 27, 2000 at 06:37:49PM -0500, Ronald J Kimball wrote:
> >   DB<1> print @res
> > 
> >   DB<2> eval 'print @res'
> > A
> > 
> > Something fishy...  eval '...' does not see it, but eval q(eval '...') can
> > see it...
> > 
> 
> This is probably the problem:
> 
> [...]/lib/perl5/5.00503> grep \@res perl5db.pl
>     my @res;
>         @res = eval "$usercontext $evalarg;\n"; # '\n' for nice recursive
>     debug
>         dumpit($OUT, \@res);
>     @res;

Thanks!!!  I was going to go mad...

--- ./lib/perl5db.pl~	Tue Nov 30 22:47:10 1999
+++ ./lib/perl5db.pl	Thu Jan 27 18:55:55 2000
@@ -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;

Enjoy,
Ilya


References to:
Rich Miller <rmiller@rmiller1.idx.com>
Ilya Zakharevich <ilya@math.ohio-state.edu>
Ronald J Kimball <rjk@linguist.dartmouth.edu>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]