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.

--
brian d foy <bdfoy@cpan.org>

In reply to File::Find::Closures (at last, some code re-use) by brian_d_foy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.