From: Vincent Pit Date: Wed, 24 Aug 2011 22:57:49 +0000 (+0200) Subject: Replace ExtUtils::Installed by File::Find/Module::Metadata X-Git-Tag: v0.04~3 X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FAcme-CPANAuthors-You-re_using.git;a=commitdiff_plain;h=12c26b568cf70d8f9f8285efe03d7caf264161d2;hp=82cde04d830d067d6b3e49ae5f0028b5b82d6850 Replace ExtUtils::Installed by File::Find/Module::Metadata Reading from the packlists seems to cause a lot of test failures. Moreover, this new technique is closer from how the PAUSE indexer processes modules. --- diff --git a/Makefile.PL b/Makefile.PL index dbd5492..692897e 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -10,9 +10,10 @@ my $dist = 'Acme-CPANAuthors-You-re_using'; $file = "lib/$file.pm"; my %PREREQ_PM = ( - 'Acme::CPANAuthors' => '0.16', - 'Carp' => 0, - 'ExtUtils::Installed' => '1.999', + 'Acme::CPANAuthors' => '0.16', + 'Carp' => 0, + 'File::Find' => 0, + 'Module::Metadata' => '1.000005', ); my %META = ( diff --git a/lib/Acme/CPANAuthors/You/re_using.pm b/lib/Acme/CPANAuthors/You/re_using.pm index 42c5293..8c8a746 100644 --- a/lib/Acme/CPANAuthors/You/re_using.pm +++ b/lib/Acme/CPANAuthors/You/re_using.pm @@ -5,7 +5,8 @@ use warnings; use Carp qw/croak/; -use ExtUtils::Installed; +use File::Find (); +use Module::Metadata; use Acme::CPANAuthors::Utils; @@ -61,12 +62,20 @@ sub register { my $auths = Acme::CPANAuthors::Utils::cpan_authors(); croak 'Couldn\'t retrieve a valid Parse::CPAN::Authors object' unless $auths; - my $installed = ExtUtils::Installed->new(); - croak 'Couldn\'t create a valid ExtUtils::Installed object' unless $installed; + my %modules; - for ($installed->modules) { - next unless defined and $_ ne 'Perl'; + File::Find::find({ + wanted => sub { + return unless /\.pm$/; + my $mod = Module::Metadata->new_from_file($_); + return unless $mod; + @modules{grep $_, $mod->packages_inside} = (); + }, + follow => 0, + no_chdir => 1, + }, @INC); + for (keys %modules) { my $mod = $pkgs->package($_); next unless $mod; @@ -91,7 +100,7 @@ BEGIN { register() } =head1 DEPENDENCIES -L, L, L. +L, L, L, L. =head1 SEE ALSO