X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FAcme%2FCPANAuthors%2FYou%2Fre_using.pm;h=9fbe898e382b21e77200123809a0469ce13f481a;hb=a7271956fb0e83fe6687b53c9e892bc5ae2a3214;hp=8d0ba4f8a722ff6a84c2e267249f9be9b04863e8;hpb=0805d59101248c79f4e597f91561b5561b4b9b41;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 8d0ba4f..9fbe898 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.02 +Version 0.06 =cut our $VERSION; BEGIN { - $VERSION = '0.02'; + $VERSION = '0.06'; } =head1 SYNOPSIS @@ -48,23 +47,33 @@ 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; 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 = 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; @@ -78,20 +87,18 @@ sub register { my $name; $name = $auth->name if defined $auth; - + $authors{$cpanid} = defined $name ? $name : $cpanid; } Acme::CPANAuthors::Register->import(%authors); } -our $SKIP; - -BEGIN { register($SKIP) } +BEGIN { register() } =head1 DEPENDENCIES -L, L, L. +L, L, L. =head1 SEE ALSO @@ -115,7 +122,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.