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.
In reply to File::Find::Closures (at last, some code re-use) by brian_d_foy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |