X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FAcme%2FCPANAuthors%2FYou%2Fre_using.pm;h=8c8a746578eeb3ef3e234b819ff469618c899858;hb=12c26b568cf70d8f9f8285efe03d7caf264161d2;hp=978853737ec678d66277b88aca4bc600059ab51f;hpb=f9b23ba13241df74986b5df8f0efb286a1e1482f;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 9788537..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; @@ -15,13 +16,13 @@ Acme::CPANAuthors::You::re_using - We are the CPAN authors that have written the =head1 VERSION -Version 0.02 +Version 0.03 =cut our $VERSION; BEGIN { - $VERSION = '0.02'; + $VERSION = '0.03'; } =head1 SYNOPSIS @@ -48,8 +49,10 @@ This function is automatically called when you C this module, unless you ha BEGIN { require Acme::CPANAuthors::Register; } +our $SKIP; + sub register { - return if shift; + return if $SKIP; my %authors; @@ -59,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(extra_libs => \@INC); - 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; @@ -85,13 +96,11 @@ sub register { Acme::CPANAuthors::Register->import(%authors); } -our $SKIP; - -BEGIN { register($SKIP) } +BEGIN { register() } =head1 DEPENDENCIES -L, L, L. +L, L, L, L. =head1 SEE ALSO @@ -115,7 +124,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 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.