On 2/15/07, Robin Houston <robin cpan.org> wrote:
> It seems to me that it should usually be easy to detect
infinite
> looping at run-time, without the need to impose a hard
limit on
> recursion depth.
>
> If the number of nested calls, without consuming any
input, exceeds
> the number of callable subexpressions in the pattern,
then we must be
> in a loop. (If I have passed 100 trees in a forest
containing 99
> trees, then I must have passed at least one of them
more than once,
> so my route must have contained a cycle.)
Attached patch uses a variant on this logic to set the max
recursion depth.
More specifically, it will set the max depth to be 3 times
the number
of capture buffers in the pattern, or the maxdepth,
whichever is
higher. It also sets the maxdepth to default to something a
little
more insane, instead of being 50 it set it to 1000.
Yves
--
perl -Mre=debug -e "/just|another|perl|hacker/"
|