For a long time I've wanted to create a library of ready-to-use callbacks to give to File::Find::find(). I never have liked the idea that I had to code the accculumation of the filenames if I did not process them immediately. This sorrt of thing seemed like it could use a shot of code re-use mojo.
So I created File::Find::Closures to hold all of those sorts of callbacks. The functions in File::Find::Closures have names like find_by_regex(), find_by_min_size(), find_by_name(), and so on. and return two things: the callback which I give directly to find(), and a reporter closure that can access the list of files the callback acccumulated.
I thought Andy Lester was going in this direction with File::Find::Wanted, but I think he had something else in mind. Randal came close to what I wanted with File::Finder, but without the re-use.
Maybe this is just one of those things that everyone ends up writing for himself.
So far, Find::Find::Closures is a developer release, so you won't be able to get it through CPAN.pm. It has no prereqs (other than File::Find which it uses in the tests). I've written everything so other people can easily write their own functions to add to this module, and I hope people send me cool ones that I can include. Create a cool function and it maymake it into an upcoming The Perl Journal article.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: File::Find::Closures (at last, some code re-use)
by kelan (Deacon) on Sep 30, 2004 at 19:17 UTC | |
by brian_d_foy (Abbot) on Sep 30, 2004 at 19:38 UTC | |
|
Re: File::Find::Closures (at last, some code re-use)
by SpanishInquisition (Pilgrim) on Oct 01, 2004 at 14:37 UTC | |
|
Re: File::Find::Closures (at last, some code re-use)
by rinceWind (Monsignor) on Oct 01, 2004 at 16:41 UTC |