Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: "Deep recursion" error

by sundialsvc4 (Abbot)
on Jun 28, 2013 at 16:28 UTC ( #1041285=note: print w/replies, xml ) Need Help??


in reply to "Deep recursion" error

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:

while (the stack is not empty) { pop a name off the stack search that directory for entries: -- if it is "." or ".." then SKIP it. (Guess this is what you're +not doing.) -- if it is a directory, "push" or "unshift" the fully-qualified n +ame onto the stack. -- if it is a file, process it, or stack it on another queue it to + be processed soon. }

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1041285]
help
Chatterbox?
[choroba]: How is Bembel different from Krug?
[hippo]: karlgoethebier, Ich habe kein Deutsch.
[Corion]: choroba: A Bembel is a traditional pottery ware, which is only(!) used for serving Cider (well, Apfelwein)
[shmem]: choroba: it's hessisch
[Corion]: Not every Krug is a Bembel!
[karlgoethebier]: there is just the mug: 🍺
[Corion]: A Bembel must look like this
[karlgoethebier]: https://de. wikipedia.org/ wiki/Bembel#/ media/File: Bembel_Zum_blauen_ Bock_1978.jpg
[choroba]: as my friend says, Ich stehe Deutsche ver nicht aber klein ;-)
[Corion]: Krug is generic pottery ware for pouring beverages, but a Bembel is painted with that blue paint and contains only (!) Apfelwein

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (14)
As of 2017-05-24 08:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?