package Modules::Lurker; use strict; use subs qw( ); use vars qw( $VERSION ); use File::Find qw( find ); use File::Spec qw( canonpath slitdir ); $VERSION = '0.01'; =head1 NAME Sample - a sample script tracking all installed perl modules =cut sub parse { my @modules = (); my $current_path; sub { #set_path $current_path = shift; }, # Let's say $curret_path = /home/kangu/ # $_ -> Boom.pm # $File::Find::name -> /home/kangu/FireCracks/Boom.pm sub { #wanted return if !m/^\w+\.pm$/; my $mod = substr( File::Spec->canonpath($File::Find::name), length($current_path) + 1 ); $mod =~ s/\.pm$//; my @modSlices = File::Spec->splitdir($mod); push @modules, !$#modSlices ? $modSlices[0] : join '::', @modSlices }, sub { #result @modules }; } sub foreach_module { my ($exec, $set_path, $wanted, $result) = (shift, parse()); for(@INC) { $set_path->($_); find($wanted, $_); } for($result->()) { $exec->($_); } } #eval { foreach_module( sub { print $_[0], "\n" } ) unless caller; #} unless caller; 1; __END__ =head1 SYNOPSIS foreach_module( sub { print $_[0], "\n" } ) unless caller; =head1 DESCRIPTION This script will traverse all directories defined in @INC fetching (guessing) all possibly valid perl modules =head1 README =head1 PREREQUISITES This script requires both the C and the C modules =head1 COREQUISITES =pod OSNAMES any =pod SCRIPT CATEGORIES CPAN/Administrative Fun/Educational =head1 AUTHOR Issam Mourad << >> The idea came from brian d foy =head1 COPYRIGHT AND LICENSE Copyright (c) 2007-2008, Issam Mourad, All Rights Reserved. You may redistribute this under the same terms as Perl itself. =cut