]> git.vpit.fr Git - perl/modules/Acme-CPANAuthors-You-re_using.git/blobdiff - lib/Acme/CPANAuthors/You/re_using.pm
Replace ExtUtils::Installed by File::Find/Module::Metadata
[perl/modules/Acme-CPANAuthors-You-re_using.git] / lib / Acme / CPANAuthors / You / re_using.pm
index 978853737ec678d66277b88aca4bc600059ab51f..8c8a746578eeb3ef3e234b819ff469618c899858 100644 (file)
@@ -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<use> 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<Carp>, L<ExtUtils::Installed>, L<Acme::CPANAuthors>.
+L<Carp>, L<File::Find>, L<Module::Metadata>, L<Acme::CPANAuthors>.
 
 =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.