]> git.vpit.fr Git - perl/modules/Acme-CPANAuthors-You-re_using.git/blobdiff - lib/Acme/CPANAuthors/You/re_using.pm
Bump copyright year
[perl/modules/Acme-CPANAuthors-You-re_using.git] / lib / Acme / CPANAuthors / You / re_using.pm
index 36fd9c77d192ad5208af2f45436e02e6531c5e08..42c52936a545184b7ffa90682a8c181e9cd5c120 100644 (file)
@@ -11,17 +11,17 @@ use Acme::CPANAuthors::Utils;
 
 =head1 NAME
 
-Acme::CPANAuthors::You::re_using - We are the CPAN authors that have written the modules installed for this perl.
+Acme::CPANAuthors::You::re_using - We are the CPAN authors that have written the modules installed on your perl!
 
 =head1 VERSION
 
-Version 0.01
+Version 0.03
 
 =cut
 
 our $VERSION;
 BEGIN {
- $VERSION = '0.01';
+ $VERSION = '0.03';
 }
 
 =head1 SYNOPSIS
@@ -33,13 +33,26 @@ BEGIN {
 
 =head1 DESCRIPTION
 
-This module builds an L<Acme::CPANAuthors> class by looking for all installed modules for the current C<perl> and then retrieving theirs authors' name and PAUSE id.
+This module builds an L<Acme::CPANAuthors> class by listing all the modules that are installed on the current C<perl> and then retrieving the name and the PAUSE id of their corresponding authors.
 
-It may take some time to load since it has to get CPAN indexes at C<BEGIN> time.
+It may take some time to load since it has to search all the directory trees given by your C<@INC> for modules, but also to get and parse CPAN indexes.
+
+=head1 FUNCTIONS
+
+=head2 C<register>
+
+Fetches and registers the names into L<Acme::CPANAuthors::Register>.
+This function is automatically called when you C<use> this module, unless you have set the package variable C<$Acme::CPANAuthors::You're_using::SKIP> to true beforehand.
 
 =cut
 
-BEGIN {
+BEGIN { require Acme::CPANAuthors::Register; }
+
+our $SKIP;
+
+sub register {
+ return if $SKIP;
+
  my %authors;
 
  my $pkgs = Acme::CPANAuthors::Utils::cpan_packages();
@@ -48,10 +61,12 @@ BEGIN {
  my $auths = Acme::CPANAuthors::Utils::cpan_authors();
  croak 'Couldn\'t retrieve a valid Parse::CPAN::Authors object' unless $auths;
 
- my $installed = ExtUtils::Installed->new;
+ my $installed = ExtUtils::Installed->new();
  croak 'Couldn\'t create a valid ExtUtils::Installed object' unless $installed;
 
- for ($installed->modules()) {
+ for ($installed->modules) {
+  next unless defined and $_ ne 'Perl';
+
   my $mod = $pkgs->package($_);
   next unless $mod;
 
@@ -69,10 +84,11 @@ BEGIN {
   $authors{$cpanid} = defined $name ? $name : $cpanid;
  }
 
- require Acme::CPANAuthors::Register;
  Acme::CPANAuthors::Register->import(%authors);
 }
 
+BEGIN { register() }
+
 =head1 DEPENDENCIES
 
 L<Carp>, L<ExtUtils::Installed>, L<Acme::CPANAuthors>.
@@ -99,7 +115,7 @@ You can find documentation for this module with the perldoc command.
 
 =head1 COPYRIGHT & LICENSE
 
-Copyright 2009 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.