Changeset 1065
- Timestamp:
- 11/04/07 01:47:13 (6 years ago)
- Location:
- lang/perl/Acme-JapaneseCPANAuthors/trunk
- Files:
-
- 1 added
- 4 modified
-
Changes (modified) (1 diff)
-
MANIFEST (modified) (1 diff)
-
Makefile.PL (modified) (1 diff)
-
lib/Acme/JapaneseCPANAuthors.pm (modified) (4 diffs)
-
lib/Acme/JapaneseCPANAuthors/Utils.pm (added)
Legend:
- Unmodified
- Added
- Removed
-
lang/perl/Acme-JapaneseCPANAuthors/trunk/Changes
r404 r1065 1 1 Revision history for Acme-JapaneseCPANAuthors 2 3 0.071006 2007/11/04 4 - switched to Parse::CPAN::Authors/Packages and Gravatar::URL 2 5 3 6 0.071006 2007/10/06 -
lang/perl/Acme-JapaneseCPANAuthors/trunk/MANIFEST
r341 r1065 2 2 lib/Acme/JapaneseCPANAuthors.pm 3 3 lib/Acme/JapaneseCPANAuthors/Registered.pm 4 lib/Acme/JapaneseCPANAuthors/Utils.pm 4 5 Makefile.PL 5 6 MANIFEST This list of files -
lang/perl/Acme-JapaneseCPANAuthors/trunk/Makefile.PL
r404 r1065 9 9 ABSTRACT_FROM => 'lib/Acme/JapaneseCPANAuthors.pm', 10 10 PREREQ_PM => { 11 ' CPAN' => 0, # not yet sure which version we should require12 ' Digest::MD5'=> 0,13 ' Test::UseAllModules' => 0,14 ' URI::Escape'=> 0,11 'Gravatar::URL' => 0, 12 'Parse::CPAN::Authors' => 0, 13 'Parse::CPAN::Packages' => 0, 14 'Test::UseAllModules' => 0, 15 15 }, 16 16 ($ExtUtils::MakeMaker::VERSION >= 6.31 -
lang/perl/Acme-JapaneseCPANAuthors/trunk/lib/Acme/JapaneseCPANAuthors.pm
r529 r1065 4 4 use warnings; 5 5 use Acme::JapaneseCPANAuthors::Registered; 6 use Acme::JapaneseCPANAuthors::Utils; 6 7 7 our $VERSION = '0.071 006';8 our $VERSION = '0.071104'; 8 9 9 10 sub count { … … 40 41 return unless $id; 41 42 42 require CPAN;43 my $ author = $CPAN::META->instance('CPAN::Author' => $id);43 require Parse::CPAN::Packages; 44 my $cpan = Parse::CPAN::Packages->new( _package_file() ); 44 45 45 # ripped from CPAN.pm 46 my @checksumfile = $id =~ /(.)(.)(.*)/; 47 $checksumfile[1] = join '', @checksumfile[0,1]; 48 $checksumfile[2] = join '', @checksumfile[1,2]; 49 50 { 51 my @items = $author->dir_listing([$checksumfile[0], 'CHECKSUMS'], 0, 1); 52 # directory not found 53 return unless grep { $_->[2] eq $checksumfile[1] } @items; 54 } 55 { 56 my @items = $author->dir_listing([@checksumfile[0,1], 'CHECKSUMS'], 0, 1); 57 # directory not found 58 return unless grep { $_->[2] eq $checksumfile[2] } @items; 46 my @packages; 47 foreach my $package ( $cpan->distributions ) { 48 if ( $package->cpanid eq $id ) { 49 push @packages, $package; 50 } 59 51 } 60 52 61 my @items = $author->dir_listing([@checksumfile, 'CHECKSUMS'], 1, 1 ); 62 63 my %distros; 64 foreach my $item ( @items ) { 65 my $file = my $dist_id = $item->[2]; 66 next if $file =~ /\.meta/; 67 $dist_id =~ s/\-[\w\.]+(\.tar\.gz|\.tgz|\.zip)$//; 68 unshift @{ $distros{$dist_id} ||= [] }, "$id/$file"; 69 } 70 71 return %distros; 53 return @packages; 72 54 } 73 55 … … 77 59 return unless $id; 78 60 79 require CPAN; 80 my $author = CPAN::Shell->expand_by_method('CPAN::Author' => ['id'] => $id); 61 require Parse::CPAN::Authors; 62 require Gravatar::URL; 63 my $cpan = Parse::CPAN::Authors->new( _author_file() ); 64 my $author = $cpan->author($id); 81 65 82 require Digest::MD5; 83 my $cpan_email = $author->email; 84 my $gravatar_id = Digest::MD5::md5_hex($cpan_email); 85 my $uri = 'http://www.gravatar.com/avatar.php?gravatar_id='.$gravatar_id; 86 if ( $options{default} ) { 87 require URI::Escape; 88 $uri .= '&default='.URI::Escape::uri_escape($options{default}); 89 } 90 if ( $options{size} ) { 91 $uri .= '&size='.$options{size}; 92 } 93 if ( $options{rating} ) { 94 $uri .= '&rating='.$options{rating}; 95 } 96 return $uri; 66 return Gravatar::URL::gravatar_url( email => $author->email, %options ); 97 67 } 98 68 … … 140 110 =head2 distributions 141 111 142 returns a hash whose keys are distribution names written/owned 143 by the person of the id, and the values are arrayrefs of the 144 distribution ids, with which you can create CPAN::Distribution 145 or CPAN::DistnameInfo object. 112 returns an array of Parse::CPAN::Packages::Distribution objects 113 for the person of the id. 146 114 147 115 =head2 avatar
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)