Show
Ignore:
Timestamp:
10/06/07 17:12:59 (7 years ago)
Author:
charsbar
Message:

lang/perl/Acme-JapaneseCPANAuthors: added avatar method

Location:
lang/perl/Acme-JapaneseCPANAuthors/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Acme-JapaneseCPANAuthors/trunk/Changes

    r341 r404  
    11Revision history for Acme-JapaneseCPANAuthors 
    22 
    3 0.01 2007/10/02 
     30.071006 2007/10/06 
     4  - added avatar method 
     5 
     60.071002 2007/10/02 
    47  - initial release 
    58 
  • lang/perl/Acme-JapaneseCPANAuthors/trunk/Makefile.PL

    r341 r404  
    1010  PREREQ_PM => { 
    1111    'CPAN' => 0,  # not yet sure which version we should require 
     12    'Digest::MD5' => 0, 
    1213    'Test::UseAllModules' => 0, 
     14    'URI::Escape' => 0, 
    1315  }, 
    1416  ($ExtUtils::MakeMaker::VERSION >= 6.31 
  • lang/perl/Acme-JapaneseCPANAuthors/trunk/lib/Acme/JapaneseCPANAuthors.pm

    r347 r404  
    55use Acme::JapaneseCPANAuthors::Registered; 
    66 
    7 our $VERSION = '0.071002'; 
     7our $VERSION = '0.071006'; 
    88 
    99sub count { 
     
    7272} 
    7373 
     74sub avatar { 
     75  my ($class, $id, %options) = @_; 
     76 
     77  return unless $id; 
     78 
     79  require Digest::MD5; 
     80  my $cpan_email = (lc $id).'@cpan.org'; 
     81  my $gravatar_id = Digest::MD5::md5_hex($cpan_email); 
     82  my $uri = 'http://www.gravatar.com/avatar.php?gravatar_id='.$gravatar_id; 
     83  if ( $options{default} ) { 
     84    require URI::Escape; 
     85    $uri .= '&default='.URI::Escape::uri_escape($options{default}); 
     86  } 
     87  if ( $options{size} ) { 
     88    $uri .= '&size='.$options{size}; 
     89  } 
     90  if ( $options{rating} ) { 
     91    $uri .= '&rating='.$options{rating}; 
     92  } 
     93  return $uri; 
     94} 
     95 
    74961; 
    7597 
     
    86108    @ids     = Acme::JapaneseCPANAuthors->id; 
    87109    %distros = Acme::JapaneseCPANAuthors->distributions('ISHIGAKI'); 
     110    $uri     = Acme::JapaneseCPANAuthors->avatar('MIYAGAWA'); 
    88111 
    89112=head1 DESCRIPTION 
     
    119142or CPAN::DistnameInfo object. 
    120143 
     144=head2 avatar 
     145 
     146returns gravatar uri of the id shown at search.cpan.org. 
     147see L<http://site.gravatar.com/site/implement> for details. 
     148 
    121149=head1 AUTHOR 
    122150 
  • lang/perl/Acme-JapaneseCPANAuthors/trunk/t/01_basic.t

    r341 r404  
    1818ok $name =~ /Ishigaki/i; 
    1919 
     20my $avatar = Acme::JapaneseCPANAuthors->avatar('ISHIGAKI'); 
     21ok $avatar;