On Fri Sep 23 22:14:24 2005, tarok@acm.org wrote: > > perlfaq3.pod document in the core Perl package has a section > "How do I find which modules are installed on my system?" > where it gives a sample code to list available Perl modules on the > system. > > I found the sample code > > use File::Find::Rule; > my @files = File::Find::Rule->file()->name( '*.pm' )->in( @INC ); > > and > > use File::Find; > my @files; > find sub { push @files, $File::Find::name if -f _ && /\.pm$/ }, > @INC; > print join "\n", @files; > > don't give a complete result on UNIX systems in case a directory path > in @INC is a symbolic link and doesn't have the corresponding > actual directory in @INC. > > For example on my Debian system @INC is set to > ('/etc/perl' '/usr/local/lib/perl/5.8.7' '/usr/local/share/perl/ 5.8.7' > '/usr/lib/perl5' '/usr/share/perl5' '/usr/lib/perl/5.8' > '/usr/share/perl/5.8' '/usr/local/lib/site_perl' '.') > and '/usr/lib/perl/5.8' is a symbolic link to '/usr/lib/perl/5.8.7'. > Then the code will never list modules in '/usr/lib/perl/5.8' nor > '/usr/lib/perl/5.8.7', > because File::Find::find doesn't work on a symlink directory unless > the follow option is enabled. > > Giving the follow option will slow the processing if @INC includes > '/usr/lib/perl/5.8.7' too, > so I think it would be better to change @INC to include only actual > directories before passing to find. > Patch that adds follow => 1 in the examples of File::Find attached. (Also changed in the patch is the identation of the code, so that it is the same as the other examples) Kind regards, BramThread Next