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:
Shlomi Fish
Date:
February 28, 2009 12:32
Subject:
Re: RFC: Providing An Alternative to File-Find in the Perl 5 Core?
Message ID:
200902282232.01316.shlomif@iglu.org.il
On Tuesday 24 February 2009 08:35:14 Aristotle Pagaltzis wrote:
> * Nicholas Clark <nick@ccl4.org> [2009-02-19 15:20]:
> > If we're going to deprecate something, we need to stop using it
> > in the core. Which would mean that we need an alternative in
> > the core.
> >
> > Which would mean a bikeshed argument about what next.
>
> I think there’s fairly good consensus in favour of either
> File::Next or File::Find::Object.
>
> Note that it’s easy to cast a callback API as a wrapper around an
> iterator API, but without continuations, it’s not possible to do
> the opposite. It should be possible to merge File::Find’s test
> suite into the prospective newcomer’s and then leave behind a
> thin wrapper that implements the File::Find API which can then
> stay around forever, if we so wish.
>

The problem with implementing File::Find using, say, File::Find::Object is 
that F-F-O does not include some features of File::Find that Nanardon and I 
found to be bad ideas. In particular, File::Find's *default* 
"no_chdir => 0" (which I always turned into "no_chdir => 1" when I used 
File::Find), which chdir's to each traversed directory as it is being 
traversed (ewwww!) - is not implemented in File-Find-Object. 

From what I read in File::Next's documentation - it does not support the 
"yes_chdir" option either.

Another problem is that there may be some speed considerations as, at the 
moment, File-Find-Object is considerably slower than File::Find, at least 
according to my benchmark.

> (This argument hangs off the fact that a filesystem walking
> module is needed by the Perl code in the core. Otherwise I’d
> just say to deprecate File::Find.)
>

My suggestion was to add some text about File::Find's limitations to its POD, 
and its available alternatives, without introducing a warn statement in the 
Perl code. I don't mind writing a patch if there's a general consensus that it
should be written.

Regards,

	Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
"Humanity" - Parody of Modern Life - http://xrl.us/bkeut

<mauke>    I'm not interested in what you're doing; what are you trying to 
           achieve?
<PerlJam>  mauke: I'm trying to achieve world peace and this regex is
           the last thing standing in my way! ;)


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