Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: What makes File::Find's interface so commonly hated

by ikegami (Patriarch)
on Jul 16, 2006 at 19:35 UTC ( [id://561594]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://561594]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-04-24 09:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found