X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FAcme%2FCPANAuthors%2FYou%2Fre_using.pm;h=a2474bbb14eb4f3b2b308b7cc4e26e50dc586229;hb=a5f2d9b989d2afcdb4a7b0cc374439627a516656;hp=9f5a8185f16dfbf0abfe2175203bbd9d7f8b2272;hpb=a5999baca9fcb63b31909c4352e4e3e655156eb2;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 9f5a818..a2474bb 100644 --- a/lib/Acme/CPANAuthors/You/re_using.pm +++ b/lib/Acme/CPANAuthors/You/re_using.pm @@ -3,9 +3,8 @@ package Acme::CPANAuthors::You::re_using; use strict; use warnings; -use Carp qw/croak/; - -use ExtUtils::Installed; +use File::Find (); +use Module::Metadata; use Acme::CPANAuthors::Utils; @@ -15,13 +14,13 @@ Acme::CPANAuthors::You::re_using - We are the CPAN authors that have written the =head1 VERSION -Version 0.03 +Version 0.06 =cut our $VERSION; BEGIN { - $VERSION = '0.03'; + $VERSION = '0.06'; } =head1 SYNOPSIS @@ -56,17 +55,28 @@ sub register { my %authors; my $pkgs = Acme::CPANAuthors::Utils::cpan_packages(); - croak 'Couldn\'t retrieve a valid Parse::CPAN::Packages object' unless $pkgs; + die 'Couldn\'t retrieve a valid Parse::CPAN::Packages object' unless $pkgs; 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; - - for ($installed->modules) { - next unless defined and $_ ne 'Perl'; - + die 'Couldn\'t retrieve a valid Parse::CPAN::Authors object' unless $auths; + + my %modules; + + File::Find::find({ + wanted => sub { + return unless /\.pm$/; + my $mod = do { + local $@; + eval { 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; @@ -80,7 +90,7 @@ sub register { my $name; $name = $auth->name if defined $auth; - + $authors{$cpanid} = defined $name ? $name : $cpanid; } @@ -91,7 +101,7 @@ BEGIN { register() } =head1 DEPENDENCIES -L, L, L. +L, L, L. =head1 SEE ALSO @@ -115,7 +125,7 @@ You can find documentation for this module with the perldoc command. =head1 COPYRIGHT & LICENSE -Copyright 2009,2010 Vincent Pit, all rights reserved. +Copyright 2009,2010,2011,2013 Vincent Pit, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.