Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Interface (Score:2, Informative)

    Yeah, I thought about doing a "nice" version of File::Find myself. I wanted to tie in a few things as well - the ability to get structured data as well as lists from it, and to cache data.

    I'm not sure I like the stream-y interface you've got here - powerful, but violates the KISS principle which makes File::Find such a pain in the arse to use at the moment. I'd pictured more of a hash-based interface, but I hadn't thought of options so much (but I guess they could be done either by regexps or arrays).

    my

    • I'm not sure I like the stream-y interface you've got here - powerful,

      I wasn't either, hence the posting, but then I saw Rafael's beautiful "Good example for 'or'" for which powerful is certainly one of the words I'd use.

      By stream-y I assume you mean the chaining of method calls? If you don't like it you can always do it in longhand:

      my $f = NewFind->new();
      $f->name( '*.mp3', '*.ogg' );
      $f->size( '<10000' );
      my @potayto = $f->find('.');

      my @potahto = NewFind->name( '*.mp3', '*.ogg' )

      • by djberg96 (2603) on 2002.07.19 7:12 (#10849) Journal
        Whenever I see method chaining, I take the opportunity to point out Robin Houston's Want [cpan.org] module. Take a look. Maybe you could use it.
        • It's an interesting module, sure enough. I don't really imagine needing to bring the big guns in.

          My current plan is to call the module File::Find::Ruleset. This seems to do some of the hard explaining for me, there are two types of methods, those that add rules to the ruleset, and those that ask questions of it.

          The methods that add new rules (name, size, exec, or) return the ruleset object, which makes chaining easier. Those that ask questions (find, find_as_superbly_complex_hash) will return what is