I seem to be getting repetitive on this point (can't help myself)... Yes, TMTOWTDI, and File::Find is, in a number of respects, somewhat unfriendly, period.
If you like the "pure-Perl-ness" of File::Find, and you don't mind the wierd usage or the 5x typical slowdown in execution time, then go for it -- it's good to see the other replies showing that it can co-exist with OO methods.
But have you ever used the unix "find" utility? Isn't it just easier? (It certainly runs faster.) If you know what you're looking for, and you have a starting path to look in, then you could do this:
And if you're on an ms-windows box, of course, "find" has been ported to that OS (cf. Cygwin, GNU, among others). Note that the "standard" solaris version of find does not support "-print0"; you need GNU or FreeBSD find for that.open( FIND, "find $dir -print0 |" ) or die "can't run find: $!"; # put any other find options you need between $dir and "-print0" { local $/ = "\0" # use null byte as input record separator while (<FIND>) { chomp; my $name = my $dir = $_; if ( s{(.+)/}{} ) { $dir = $1; else { $dir = "/"; # emulate File::Find's behavior $_ = "." if ( $name eq $dir ); } $borg->( $name, $dir, $_ ); } } close FIND;
In reply to Re: File::Find incompatible with OO perl?
by graff
in thread File::Find incompatible with OO perl?
by vaevictus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |