seyyah has asked for the wisdom of the Perl Monks concerning the following question:

Hi All, How can I skip one direcory using a find function? find(\&ourfunc, "g:/data/handheld/LocalUser/"); I want to simply skip a direocy under "g:/data/handheld/LocalUser/public" and continue to process? Many thanks, seyyah

Replies are listed 'Best First'.
Re: find function
by PodMaster (Abbot) on Dec 06, 2005 at 07:23 UTC
Re: find function
by pKai (Priest) on Dec 06, 2005 at 09:15 UTC
    As I prefer functional style programming over procedural, I never really liked File::Find's "global vars interface".

    So being faced with the problem of looking through some directory tree i will use File::Find, but when it's necessary to tweak the process of its search, I prefer using the preprocess CODEref.

    As I don't see that covered a lot in the resources given by PodMaster, I'd like to give an (overly explicit) example:

    An additional advantage of this approach over using/setting File::Find::prune, is that it also works with bydepth => 1.

    Also note, that I generally refuse to let find do the chdir thing, because that tends to confuse me. ;-)

    Just my two eurocent

      As I prefer functional style programming over procedural, I never really liked File::Find's "global vars interface"

      That's kind of funny. File::Find has one of the most functional interfaces of any core module I can think of. I mean, its 'find' subroutine's first argument is a function. Granted, it does use funky globals instead of @_ to pass arguments to that function, but I think that's an orthogonal to its functional-ness.

        wanted (like find) itself can never be "functional", since its return value ist either discarded or nonexistent, relying entirely on side-effects for their "function" ;-)

        For a clarification what program language designer nick-name "functional" the wikipedia article on Functional_programming is a good start.