On Jan 9, 2008 12:21 PM, oryann9 <[EMAIL PROTECTED]> quoted Randal Schwartz:
> > You're misusing it. Set it within the wanted() routine when you're > Is this what you mean on line 9? I tried and it does not seem to work, > meaning it still descending. > > 1 sub find_me { > 2 use Data::Dumper; > 3 my $fs = shift; > 4 #local $File::Find::prune = shift; ##-- localize prune to just > this block --## > 5 #my @directory = ($fs) ; > 6 use constant MAX_SIZE => (25*1024*1024) ; > 7 use constant DIVISOR => (1024) ; > 8 my ( $wanted, $list ) = find_by_min_size ( MAX_SIZE ) ; > 9 File::Find::find ( { wanted => $wanted, prune => > $File::Find::prune = shift}, $fs ) ; > 10 @large_files = $list->() ; > 11 > 12 @sorted_large_files = > 13 sort { -s $b <=> -s $a } > 14 @large_files ; > 15 > 16 } ##-- End sub --## That's not within your wanted() routine. File::Find will call your wanted() code many times. Your code will normally leave prune alone. At some point, your code will find itself dealing with a directory into which you don't want to search, so your code will set prune to a true value; this will cause File::Find to say to itself, "Ho ho! You don't want to go deeper than here! Your wish is my command!" It will consider that directory to be complete, and go on to the next, thereby pruning the search tree. Hope this helps! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/