develooper Front page | perl.perl5.porters | Postings from February 2009

Re: RFC: Providing An Alternative to File-Find in the Perl 5 Core?

Thread Previous | Thread Next
From:
demerphq
Date:
February 24, 2009 12:08
Subject:
Re: RFC: Providing An Alternative to File-Find in the Perl 5 Core?
Message ID:
9b18b3110902241208v11914cd0i6234429f7500f96c@mail.gmail.com
2009/2/24 Aristotle Pagaltzis <pagaltzis@gmx.de>:
> * demerphq <demerphq@gmail.com> [2009-02-24 13:15]:
>> All this ranting over File::Find is IMO highly unconvincing.
>>
>> It works, it does whats needed out of the box for most
>> purposes, and frankly the replacments ive seen tend to be
>> harder to use, harder to understand and just another silly
>> dependency that i remove when i encounter (because most times
>> i encounter it i dont have the silly dependency handy and
>> replacing it faster than finding the dependency, especially
>> when you are on a train with no connectivity.
>
> As far as I’m concerned this is not about replacing File::Find
> with a more declarative API.
>
> My real beef with FF is that it’s callback-based.

Well i can see how an iterated FF would be useful, but not so useful
as to deprecate File::Find. Although possibly useful enough to rewrite
FF so it is internally iterative and then use the iterative version to
implement the callback framework.

But i wonder about how much state you might have to store for an
iterative traversal. If you were unlucky this might require something
close to reading all the files anyway.

Im wondering if iterative and callback based designs have different
system costs associated to them. For instance i can imagine at least
attempting an argument like "callback designs are less likely to be
vulnerable to memory issues resulting from ridiculously large
directories". (Not saying id win the argument mind you.)

> Another rather minor beef is that it’s annoyingly verbose to just
> get a list of files when that is what I want – minor because this
> can be fixed with a wrapper

Seems like this should be a utility routine in FF and not an excuse to
eliminate FF.

>(callback-vs.-iterator cannot).

No. True. But i still would prefer to see effort go into modifying FF
and extending it than to replacing it.

>
> Hmm, I wonder how much of a problem it would be to fix those
> instead of replacing FF outright… FF is some really ugly code
> anyway…

That is true. But it also works in a lot of environments with
different file systems and rules. Thus it is not surprising that it is
crufty, and arguable that anything with similar functionality is going
to be just as crufty.

Cheers,
yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About