Re: [debugger] finding deep recursin

[email protected] ("Matthew O. Persico") Sun, 11 Jan 2004 19:23:26 -0500
Newsgroups perl.debugger
Message-ID <2004111192326.548908@mopxp>
On 11 Jan 2004 17:33:32 -0000, Peter Scott wrote:
> In article <[email protected]>,
> [email protected] (Gabor Szabo) writes:
>>
>> Any idea how can I use the debugger to find the cause of
>> a deep recursion in my code ?
>
> I don't see the need for the debugger.  Deep recursion is a
> warning, so
> just turn the warning into a fatal error with stack trace:
>
> % perl -MCarp=confess -we '$SIG{__WARN__} = sub {confess @_ }; \
> sub foo { foo() } foo'

Since this will turn ALL warnings into errors, you will have to make sure you don't have any warning-causing code in your program before you get to the recursion. You will also have to throw the -w switch when you call perl (as specified in the example above). If you currently are not running with -w (or use warnings;), be prepared for some cleanup work.
--
Matthew O. Persico