Mailing List Archive

debugging closures (fwd)
------- start of forwarded message -------
Path: csnews!boulder!agate!howland.reston.ans.net!math.ohio-state.edu!magnus.acs.ohio-state.edu!lerc.nasa.gov!purdue!haven.umd.edu!news.umbc.edu!mhaycr1
From: mhaycr1@umbc.edu (Matthew W. Haycraft(CMSC))
Newsgroups: comp.lang.perl.misc
Subject: debugging closures
Date: 12 Dec 1995 16:34:27 GMT
Organization: University of Maryland, Baltimore County
Lines: 34
Message-ID: <4akauj$26q@news.umbc.edu>
NNTP-Posting-Host: xsa05.gl.umbc.edu
NNTP-Posting-User: mhaycr1
X-Newsreader: TIN [version 1.2 PL2]

Not sure if my last post made it out so sorry if this get's duplicated..
I wrote a function which returns a closure:
sub create_randomness
{ #($direction, $granularity, $sort)
my ($direction, $granularity, $sort)=@_;
sub
{
my @X=();

for(@{$DATA[$direction][$granularity]})
{
push(@X,$_->[$sort]);
}
('hist',[[@X]])
}
}

anyway. When I try to debug a program with these closures, I get the following
Undefined subroutine &main::__ANON__ called at /usr/local/lib/perl5/perl5db.pl
line 536, <DATA> line 60418.

however when the program is run it works just fine..
Is there a way around this problem w/o droping the closures?

the way I used the above function was I created an array
of arrays
each sub array has a reference to a function (returned from the above
function)) and other data to go with the function...

I had planned to use closures in some code in the future but
not being able to use the debugger could prove to be a little high of
a price to pay...

Any ideas?
------- end of forwarded message -------
--
Tom Christiansen Perl Consultant, Gamer, Hiker tchrist@mox.perl.com
"To claim any more than that is to invite a religious war, which I ain't.
Go thou and don't likewise."
--Larry Wall
Re: debugging closures [ In reply to ]
> anyway. When I try to debug a program with these closures, I get the following
> Undefined subroutine &main::__ANON__ called at /usr/local/lib/perl5/perl5db.pl
> line 536, <DATA> line 60418.
>
> however when the program is run it works just fine..
> Is there a way around this problem w/o droping the closures?
>
What level of perl? Is the "closure bug" (NETaa14535) patch applied?

--Stephen Lee
sdlee@vnet.ibm.com