Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

acme (189)

acme
  (email not shown publicly)
http://www.astray.com/

Leon Brocard (aka acme) is an orange-loving Perl eurohacker with many varied contributions to the Perl community, including the GraphViz module on the CPAN. YAPC::Europe was all his fault. He is still looking for a Perl Monger group he can start which begins with the letter 'D'.

Journal of acme (189)

Wednesday May 06, 2009
10:27 AM

What files does your Perl load?

[ #38929 ]

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/l ib/5.10.0/strict.pm
/home/acme/perl-5.10.0/lib/5.10.0/warnings.pm
/home/acme/p erl-5.10.0/lib/5.10.0/warnings.pm
/home/acme/perl-5.10.0/lib/5.10.0/warnings.pm
/home/acme/perl-5.10.0/lib/5.10.0/warnings.pm
/home/acme/perl-5.10.0/lib/5.10 .0/i686-linux/Scalar/Util.pm
/home/acme/perl-5.10.0/lib/5.10.0/vars.pm
/home/a cme/perl-5.10.0/lib/5.10.0/warnings/register.pm
/home/acme/perl-5.10.0/lib/5.10 .0/Exporter.pm
/home/acme/perl-5.10.0/lib/5.10.0/i686-linux/List/Util.pm
/home /acme/perl-5.10.0/lib/5.10.0/i686-linux/XSLoader.pm
/home/acme/perl-5.10.0/lib/ 5.10.0/i686-linux/auto/List/Util/Util.so
/home/acme/perl-5.10.0/lib/5.10.0/Carp .pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Exporter.pm
/home/acme/p erl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/MOP.pm
/home/acme/perl-5.10.0/ lib/site_perl/5.10.0/MRO/Compat.pm
/home/acme/perl-5.10.0/lib/5.10.0/mro.pm
/h ome/acme/perl-5.10.0/lib/site_perl/5.10.0/MRO/Compat.pm
/home/acme/perl-5.10.0/ lib/site_perl/5.10.0/MRO/Compat.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/ i686-linux/Devel/GlobalDestruction.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10 .0/i686-linux/auto/Devel/GlobalDestruction/GlobalDestruction.so
/home/acme/perl -5.10.0/lib/site_perl/5.10.0/Sub/Exporter.pm
/home/acme/perl-5.10.0/lib/site_pe rl/5.10.0/Data/OptList.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Params/Ut il.pm
/home/acme/perl-5.10.0/lib/5.10.0/overload.pm
/home/acme/perl-5.10.0/lib /5.10.0/overload.pm
/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.1 0.0/lib/site_perl/5.10.0/Sub/Install.pm
/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/Sub/Install.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Data/OptList.pm
/home/acme/perl-5. 10.0/lib/site_perl/5.10.0/Sub/Exporter.pm
/home/acme/perl-5.10.0/lib/site_perl/ 5.10.0/Sub/Exporter.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Sub/Exporter .pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Sub/Exporter.pm
/home/acme/per l-5.10.0/lib/site_perl/5.10.0/Sub/Exporter.pm
/home/acme/perl-5.10.0/lib/site_p erl/5.10.0/Sub/Exporter.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Sub/Expo rter.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Sub/Exporter.pm
/home/acme /perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Sub/Name.pm
/home/acme/perl-5.10.0 /lib/5.10.0/base.pm
/home/acme/perl-5.10.0/lib/5.10.0/base.pm
/home/acme/perl- 5.10.0/lib/5.10.0/i686-linux/DynaLoader.pm
/home/acme/perl-5.10.0/lib/5.10.0/i6 86-linux/Config.pm
/home/acme/perl-5.10.0/lib/5.10.0/i686-linux/DynaLoader.pm
/home/acme/perl-5.10.0/lib/5.10.0/AutoLoader.pm
/home/acme/perl-5.10.0/lib/5.10 .0/AutoLoader.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/auto/Su b/Name/Name.so
/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/Immu table.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/MOP/Metho d/Constructor.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/M OP/Method/Generated.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/C lass/MOP/Method.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class /MOP/Object.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/MOP /Method/Constructor.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/C lass/MOP/Immutable.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Cl ass/MOP/Immutable.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Cla ss/MOP/Instance.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class /MOP/Instance.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/M OP/Method/Wrapped.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Cla ss/MOP/Method/Wrapped.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux /Class/MOP/Module.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Cla ss/MOP/Package.pm
/home/acme/perl-5.10.0/lib/5.10.0/i686-linux/B.pm
/home/acme /perl-5.10.0/lib/5.10.0/i686-linux/B.pm
/home/acme/perl-5.10.0/lib/5.10.0/i686- linux/auto/B/B.so
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/ MOP/Package.pm
/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/Clas s.pm
/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
/hom e/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/MOP/Class.pm
/home/acm e/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/MOP/Class.pm
/home/acme/per l-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/MOP/Class.pm
/home/acme/perl-5.1 0.0/lib/site_perl/5.10.0/i686-linux/Class/MOP/Attribute.pm
/home/acme/perl-5.10 .0/lib/site_perl/5.10.0/i686-linux/Class/MOP/Method/Accessor.pm
/home/acme/perl -5.10.0/lib/site_perl/5.10.0/i686-linux/Class/MOP/Method/Accessor.pm
/home/acme /perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/MOP/Attribute.pm
/home/acme/ perl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/MOP/Attribute.pm
/home/acme/p erl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/MOP/Attribute.pm
/home/acme/pe rl-5.10.0/lib/site_perl/5.10.0/i686-linux/Class/MOP.pm
/home/acme/perl-5.10.0/l ib/site_perl/5.10.0/i686-linux/Class/MOP.pm
/home/acme/perl-5.10.0/lib/site_per l/5.10.0/i686-linux/Class/MOP.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i6 86-linux/Class/MOP.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/au to/Class/MOP/MOP.so
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/List /MoreUtils.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/List/MoreU tils.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/auto/List/MoreUt ils/MoreUtils.so
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Util/MetaRol e.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Exporter.pm
/home/acme/ perl-5.10.0/lib/site_perl/5.10.0/Moose/Exporter.pm
/home/acme/perl-5.10.0/lib/s ite_perl/5.10.0/Moose/Meta/Class.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0 /Moose/Meta/Method/Overridden.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Mo ose/Meta/Method.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Metho d/Augmented.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Error/Default. pm
/home/acme/perl-5.10.0/lib/5.10.0/Carp/Heavy.pm
/home/acme/perl-5.10.0/lib/ 5.10.0/Carp/Heavy.pm
/home/acme/perl-5.10.0/lib/5.10.0/Carp/Heavy.pm
/home/acm e/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Class.pm
/home/acme/perl-5.10.0/l ib/site_perl/5.10.0/Moose/Meta/Class.pm
/home/acme/perl-5.10.0/lib/site_perl/5. 10.0/Moose/Meta/Class.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta /Method/Constructor.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/M ethod/Constructor.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Met hod/Constructor.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Metho d/Constructor.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Method/ Destructor.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Class.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/TypeConstraint.pm
/home/ acme/perl-5.10.0/lib/site_perl/5.10.0/i686-linux/metaclass.pm
/home/acme/perl-5 .10.0/lib/site_perl/5.10.0/Moose/Meta/TypeConstraint.pm
/home/acme/perl-5.10.0/ lib/site_perl/5.10.0/Moose/Meta/TypeCoercion.pm
/home/acme/perl-5.10.0/lib/site _perl/5.10.0/Moose/Meta/Attribute.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10. 0/Moose/Meta/Method/Accessor.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moo se/Meta/Method/Accessor.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Me ta/Method/Accessor.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Me thod/Delegation.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Util.pm
/ home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Util.pm
/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/Meta/TypeConstraint/Union.pm
/home/acme/perl-5.10.0/lib/ site_perl/5.10.0/Moose/Meta/TypeCoercion/Union.pm
/home/acme/perl-5.10.0/lib/si te_perl/5.10.0/Moose/Meta/TypeConstraint/Parameterized.pm
/home/acme/perl-5.10. 0/lib/site_perl/5.10.0/Moose/Meta/TypeConstraint/Parameterizable.pm
/home/acme/ perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/TypeConstraint/Class.pm
/home/acme/ perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/TypeConstraint/Role.pm
/home/acme/p erl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/TypeConstraint/Enum.pm
/home/acme/pe rl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/TypeConstraint/Registry.pm
/home/acme /perl-5.10.0/lib/site_perl/5.10.0/Moose/Util/TypeConstraints/OptimizedConstraint s.pm
/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
/hom e/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Util/TypeConstraints.pm
/home/acm e/perl-5.10.0/lib/5.10.0/i686-linux/re.pm
/home/acme/perl-5.10.0/lib/5.10.0/i68 6-linux/re.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Util/TypeConstr aints.pm
/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/Meta/Attribute.pm
/home/ acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Attribute.pm
/home/acme/perl-5 .10.0/lib/site_perl/5.10.0/Moose/Meta/Attribute.pm
/home/acme/perl-5.10.0/lib/s ite_perl/5.10.0/Moose/Meta/Attribute.pm
/home/acme/perl-5.10.0/lib/site_perl/5. 10.0/Moose/Meta/Attribute.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/ Meta/Instance.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Object.pm
/ home/acme/perl-5.10.0/lib/5.10.0/if.pm
/home/acme/perl-5.10.0/lib/site_perl/5.1 0.0/Moose/Meta/Role.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/R ole/Method.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Role/Metho d/Required.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Role.pm
/ home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Role.pm
/home/acme/perl-5 .10.0/lib/site_perl/5.10.0/Moose/Meta/Role.pm
/home/acme/perl-5.10.0/lib/site_p erl/5.10.0/Moose/Meta/Role.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose /Meta/Role.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Role/Compo site.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Role/Application .pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Role/Application/Rol eSummation.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/Role/Appli cation/RoleSummation.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/Meta/ Role/Application/ToClass.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moose/M eta/Role/Application/ToClass.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/Moo se/Meta/Role/Application/ToRole.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10.0/ Moose/Meta/Role/Application/ToRole.pm
/home/acme/perl-5.10.0/lib/site_perl/5.10 .0/Moose/Meta/Role/Application/ToInstance.pm
/home/acme/perl-5.10.0/lib/site_pe rl/5.10.0/Moose.pm

No, I'm not sure why it's accessing some files multiple times. Now, who can change this into a CPAN module popularity contest?

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.