in reply to File::Find considered hard?

For my own part, I will say that:

Anyway, that's my $.02 on why the interface to File::Find is rotten. It's really the sort of module that you would prefer if newbs started using really early on, and currying function calls is the sort of thing that someone new to perl, and maybe just trying to hack together a few simple systems admin scripts, doesn't want to and should have to deal with. Also, it just sucks for code-reuse... I'm still on the knife edge of reimplementing File::Find's features for a project I'm working on, because I just don't want to have to start off by traversing the entire @#$%ing directory tree and storing it in a huge array.

------------ :Wq Not an editor command: Wq

Replies are listed 'Best First'.
Re: Re: File::Find considered hard?
by Jenda (Abbot) on Mar 16, 2004 at 20:36 UTC

    I guess you are right it would be best if File::Find supported both types of interfaces, functional and iterative.

    There is no currying going on in here though. The find() is a higher order function, but it is not curried. If it was it would allow you to pass it just the wanted() function and get a function "find_and_do_something()":

    my $delete_tmp = find(sub {unlink($_) if -f and /\.tmp$/i}); ... $delete_tmp->($one_directory); ... $delete_tmp->($other_directory); ..

    Jenda
    Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
       -- Rick Osborne

    Edit by castaway: Closed small tag in signature

      The find() is a higher order function, but it is not curried.
      Right... I meant that the "wanted" function is (at least frequently) curried, or at least a closure.
      ------------ :Wq Not an editor command: Wq