]> git.vpit.fr Git - perl/modules/Acme-CPANAuthors-You-re_using.git/commitdiff
Put all the name fetching and registering into a proper sub
authorVincent Pit <vince@profvince.com>
Tue, 17 Feb 2009 16:56:00 +0000 (17:56 +0100)
committerVincent Pit <vince@profvince.com>
Tue, 17 Feb 2009 16:56:00 +0000 (17:56 +0100)
lib/Acme/CPANAuthors/You/re_using.pm

index 09db1de0a732b0b808c25896ddf16ffbdeee4ee3..5d3932f514b536b364fb5f47db94010a16d41686 100644 (file)
@@ -37,12 +37,19 @@ This module builds an L<Acme::CPANAuthors> class by listing all the modules that
 
 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
 
-our $SKIP;
+BEGIN { require Acme::CPANAuthors::Register; }
 
-BEGIN {
- return if $SKIP;
+sub register {
+ return if shift;
 
  my %authors;
 
@@ -75,10 +82,13 @@ BEGIN {
   $authors{$cpanid} = defined $name ? $name : $cpanid;
  }
 
- require Acme::CPANAuthors::Register;
  Acme::CPANAuthors::Register->import(%authors);
 }
 
+our $SKIP;
+
+BEGIN { register($SKIP) }
+
 =head1 DEPENDENCIES
 
 L<Carp>, L<ExtUtils::Installed>, L<Acme::CPANAuthors>.