X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FAcme%2FCPANAuthors%2FYou%2Fre_using.pm;h=5d3932f514b536b364fb5f47db94010a16d41686;hb=7dba09fe789dac966ec4609e199557c7c622baf9;hp=df1e8911dc0a18109a7fc483fb363b6d68de2d30;hpb=5ae7c1648eae5005202f4f51394454a2223d4214;p=perl%2Fmodules%2FAcme-CPANAuthors-You-re_using.git diff --git a/lib/Acme/CPANAuthors/You/re_using.pm b/lib/Acme/CPANAuthors/You/re_using.pm index df1e891..5d3932f 100644 --- a/lib/Acme/CPANAuthors/You/re_using.pm +++ b/lib/Acme/CPANAuthors/You/re_using.pm @@ -35,11 +35,22 @@ BEGIN { This module builds an L class by listing all the modules that are installed on the current C and then retrieving the name and the PAUSE id of their corresponding authors. -It may take some time to load since it has to get CPAN indexes at C time. +It may take some time to load since it has to search all the directory trees given by your C<@INC> for modules, but also to get and parse CPAN indexes. + +=head1 FUNCTIONS + +=head2 C + +Fetches and registers the names into L. +This function is automatically called when you C this module, unless you have set the package variable C<$Acme::CPANAuthors::You're_using::SKIP> to true beforehand. =cut -BEGIN { +BEGIN { require Acme::CPANAuthors::Register; } + +sub register { + return if shift; + my %authors; my $pkgs = Acme::CPANAuthors::Utils::cpan_packages(); @@ -52,6 +63,8 @@ BEGIN { croak 'Couldn\'t create a valid ExtUtils::Installed object' unless $installed; for ($installed->modules) { + next unless defined and $_ ne 'Perl'; + my $mod = $pkgs->package($_); next unless $mod; @@ -69,10 +82,13 @@ BEGIN { $authors{$cpanid} = defined $name ? $name : $cpanid; } - require Acme::CPANAuthors::Register; Acme::CPANAuthors::Register->import(%authors); } +our $SKIP; + +BEGIN { register($SKIP) } + =head1 DEPENDENCIES L, L, L.