jynx has asked for the wisdom of the Perl Monks concerning the following question:
In essence, i looked at someone else's answer and rewrote as a one-liner in File::Find:
However, when looking at @INC, it seems there are subdirectories in there that would be handled by the time we got there, this could produce some duplication and because of disk access, slow things down. So we make a hash of where we've been:#!/usr/local/bin/perl -w use strict; use File::Find; find { wanted => sub { print if /\.pm$/ }, no_chdir=>1} $dir foreach m +y $dir @INC;
Then the following questions came to mind:# use strict and the ilk above my %been_at; sub wanted { return if $been_at{$dir}; $been_at{$dir}=1; print if /\.pm$/; } find {wanted => \&wanted, no_chdir => 1} $dir foreach my $dir @INC;
@INC is a small search space, but if we generalize this a little to larger unknown search spaces the questions seem a little more potent (to me at least). Since File::Find has to scan the disk it is one of the slower parts of programs and knowing how to use it better would certainly be a Good Thing(tm).
i'm still pretty new to File::Find and these are things i was wondering, please help,
jynx
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Wondering about File::Find
by fundflow (Chaplain) on Dec 29, 2000 at 01:48 UTC | |
by tye (Sage) on Dec 29, 2000 at 03:03 UTC | |
|
Re: Wondering about File::Find
by BatGnat (Scribe) on Dec 29, 2000 at 03:08 UTC | |
|
Re: Wondering about File::Find
by chipmunk (Parson) on Jan 04, 2001 at 08:12 UTC |