It can interesting to see what files your Perl loads. One way to do this is to use the Linux::Inotify2 module which uses inotify to monitor file changes. Something like:
#!/home/acme/bin/perl
use strict;
use warnings;
use Linux::Inotify2;
use File::Find::Rule;
use Perl6::Say;
my $inotify = new Linux::Inotify2
or die "Unable to create new inotify object: $!";
foreach my $inc (@INC) {
next if $inc eq '.';
foreach my $directory ( File::Find::Rule->new->directory->in($inc) ) {
$inotify->watch( $directory, IN_ACCESS )
or die "watch creation failed";
}
}
while () {
my @events = $inotify->read;
unless ( @events > 0 ) {
print "read error: $!";
last;
}
foreach my $event (@events) {
say $event->fullname if $event->IN_ACCESS;
}
}
Which outputs something along the lines of the following if you load Moose by running perl -e 'use Moose' in another terminal:
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose.pm
/home/acme/perl-5.10.0/
/home/acme/perl-5.10.0/lib/5.10.0/warnings.pm
/home/acme/
/home/acme/perl-5.10.0/lib/5.10.0/warnings.p
/home/acme/perl-5.10.0/lib/5.10.0/warnings.pm
/home/acme/perl-5.10.0/lib/5.1
/home/acme/perl-5.10.0/lib/5.10.0/vars.pm
/home/
/home/acme/perl-5.10.0/lib/5.1
/home/acme/perl-5.10.0/lib/5.10.0/i686-linux/List/Util.pm
/hom
/home/acme/perl-5.10.0/lib
/home/acme/perl-5.10.0/lib/5.10.0/Car
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Exporter.pm
/home/acme/
/home/acme/perl-5.10.0
/home/acme/perl-5.10.0/lib/5.10.0/mro.pm
/
/home/acme/perl-5.10.0
/home/acme/perl-5.10.0/lib/site_perl/5.10.0
/home/acme/perl-5.10.0/lib/site_perl/5.1
/home/acme/per
/home/acme/perl-5.10.0/lib/site_p
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Params/U
/home/acme/perl-5.10.0/lib/5.10.0/overload.pm
/home/acme/perl-5.10.0/li
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Params/Util.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Params/Util.pm
/home/acme/perl-5.
/home/acme/perl-5.10.0/lib/site_perl/5
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Sub/Install.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Data/OptList.pm
/home/acme/perl-5
/home/acme/perl-5.10.0/lib/site_perl
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Sub/Exporte
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Sub/Exporter.pm
/home/acme/pe
/home/acme/perl-5.10.0/lib/site_
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Sub/Exp
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Sub/Exporter.pm
/home/acm
/home/acme/perl-5.10.
/home/acme/perl-5.10.0/lib/5.10.0/base.pm
/home/acme/perl
/home/acme/perl-5.10.0/lib/5.10.0/i
/home/acme/perl-5.10.0/lib/5.10.0/i686-linux/DynaLoader.pm
/home/acme/perl-5.10.0/lib/5.1
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/auto/S
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/MO
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/MOP/Imm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/MOP/Meth
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Clas
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/MO
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/C
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Cl
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Clas
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Cl
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linu
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Cl
/home/acme/perl-5.10.0/lib/5.10.0/i686-linux/B.pm
/home/acm
/home/acme/perl-5.10.0/lib/5.10.0/i686
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/MO
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/MOP/Cla
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/MOP/Class.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/MOP/Class.pm
/ho
/home/ac
/home/acme/pe
/home/acme/perl-5.
/home/acme/perl-5.1
/home/acme/per
/home/acm
/home/acme
/home/acme/
/home/acme/p
/home/acme/perl-5.10.0/
/home/acme/perl-5.10.0/lib/site_pe
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/a
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Lis
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/List/More
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/auto/List/MoreU
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Util/MetaRo
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Exporter.pm
/home/acme
/home/acme/perl-5.10.0/lib/
/home/acme/perl-5.10.0/lib/site_perl/5.10.
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/M
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Meth
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Error/Default
/home/acme/perl-5.10.0/lib/5.10.0/Carp/Heavy.pm
/home/acme/perl-5.10.0/lib
/home/acme/perl-5.10.0/lib/5.10.0/Carp/Heavy.pm
/home/ac
/home/acme/perl-5.10.0/
/home/acme/perl-5.10.0/lib/site_perl/5
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Met
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Me
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Meth
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Method
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Class.pm
/home
/home/acme/perl-
/home/acme/perl-5.10.0
/home/acme/perl-5.10.0/lib/sit
/home/acme/perl-5.10.0/lib/site_perl/5.10
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Mo
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/M
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/M
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Util.pm
/home/acme/perl-5.10.
/home/acme/perl-5.10.0/lib
/home/acme/perl-5.10.0/lib
/home/acme/perl-5.10.0/lib/s
/home/acme/perl-5.10
/home/acme
/home/acme
/home/acme/
/home/acme/p
/home/acm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Util/TypeConstraints.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Util/TypeConstraints.pm
/ho
/home/ac
/home/acme/perl-5.10.0/lib/5.10.0/i6
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Util/TypeConst
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Util/TypeConstraint
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Attribute.pm
/home
/home/acme/perl-
/home/acme/perl-5.10.0/lib/
/home/acme/perl-5.10.0/lib/site_perl/5
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Object.pm
/home/acme/perl-5.10.0/lib/site_perl/5.
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Role/Meth
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Role.pm
/home/acme/perl-
/home/acme/perl-5.10.0/lib/site_
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moos
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Role/Comp
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Role/Applicatio
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Role/Application/Ro
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Role/Appl
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Mo
/home/acme/perl-5.10.0/lib/site_perl/5.10.0
/home/acme/perl-5.10.0/lib/site_perl/5.1
/home/acme/perl-5.10.0/lib/site_p
No, I'm not sure why it's accessing some files multiple times. Now, who can change this into a CPAN module popularity contest?
strace? (Score:1)
too complicated (Score:2)
Re: (Score:2)