go ahead... be a heretic | |
PerlMonks |
Re: "Deep recursion" errorby sundialsvc4 (Abbot) |
on Jun 28, 2013 at 16:28 UTC ( [id://1041285]=note: print w/replies, xml ) | Need Help?? |
Even if you don’t choose to use a File::Find type module, you certainly can use their core techniques ... which don’t involve recursion. Instead, they use a simple push-down stack. You start by pushing the starting location on the stack. Then, something like this:
If you push the names, you get a “depth-first” search; if you unshift them, “breadth-first.” This also circumvents another file-system bugaboo, especially noticeable in Windows: the number of active “searches” that you can actually have going at one time, and the problem of interference between them. Only one search is actually going-on at one time.
In Section
Seekers of Perl Wisdom
|
|