in reply to Re: What makes File::Find's interface so commonly hated
in thread What makes File::Find's interface so commonly hated

Not so. I use a module whose callback returns 0 or 1 for last or next respectively.
sub callback { my ($found) = @_; print $found->filename, "\n"; return 0 if $found->pathname =~ $end_condition; return 1 if $found->pathname =~ $skip_condition; process($found); return 1; }

Constants would improve readability.

Replies are listed 'Best First'.
Re^3: What makes File::Find's interface so commonly hated
by revdiablo (Prior) on Jul 16, 2006 at 21:32 UTC

    As I said, this is certainly possible with a callback interface. What you've shown is a way to do that, but it's not using the standard next and last operators, so it's not quite as easy to follow or understand.

    I should probably also note that I don't have a big problem with callback interfaces generally, nor with File::Find specifically. But I can certainly say in this case, one alternative is slightly nicer than the other.