Acme-CPANAuthors

 view release on metacpan or  search on metacpan

lib/Acme/CPANAuthors.pm  view on Meta::CPAN

  my @packages;
  foreach my $package ( cpan_packages->distributions ) {
    if ( $package->cpanid eq $id ) {
      push @packages, $package;
    }
  }

  return @packages;
}

sub latest_distributions {
  my ($self, $id) = @_;

  return unless $id;

  my @packages;
  foreach my $package ( cpan_packages->latest_distributions ) {
    if ( $package->cpanid eq $id ) {
      push @packages, $package;
    }
  }

  return @packages;
}

sub avatar_url {
  my ($self, $id, %options) = @_;

lib/Acme/CPANAuthors.pm  view on Meta::CPAN

Sometimes we just want to know something to confirm we're not
alone, or to see if we're doing right things, or to look for
someone we can rely on. This module provides you some basic
information on us.

=head1 WHY THIS MODULE?

We've been holding a Kwalitee competition for Japanese CPAN Authors
since 2006. Though Japanese names are rather easy to distinguish
from Westerner's names (as our names have lots of vowels), it's
tedious to look for Japanese authors every time we hold the contest.
That's why I wrote this module and started maintaining the Japanese
authors list with a script to look for candidates whose name looks
like Japanese by the help of L<Lingua::JA::Romaji::Valid> I coined.

Since then, dozens of lists are uploaded on CPAN. It may be time
to start other games, like offering more useful statistics online.

=head1 WEBSITE

Now we have a website: L<http://acme.cpanauthors.org/>. You can

lib/Acme/CPANAuthors.pm  view on Meta::CPAN

=head2 name

returns all the registered authors' name by default. If called
with an id, this returns the name of the author of the id.

=head2 categories

returns the list of categories represented by this class (the names passed to
C<new>).

=head2 distributions, latest_distributions

returns an array of Acme::CPANAuthors::Utils::Packages::Distribution
objects for the author of the id. 

=head2 avatar_url

returns gravatar url of the id shown at search.cpan.org
(or undef if you don't have L<Gravatar::URL>).
See L<http://site.gravatar.com/site/implement> for details.

lib/Acme/CPANAuthors/Utils/Packages.pm  view on Meta::CPAN

use base 'Acme::CPANAuthors::Utils::CPANIndex';

sub _preambles {qw(
  file url description columns intended_for
  written_by line_count last_updated
)}

sub _mappings {+{
  package             => 'packages',
  distribution        => 'dists',
  latest_distribution => 'latest_dists',
}}

sub _parse {
  my ($self, $file) = @_;

  my $handle = $self->_handle($file);

  my $done_preambles = 0;
  while (my $line = $handle->getline) {
    $line =~ s/\r?\n$//;

lib/Acme/CPANAuthors/Utils/Packages.pm  view on Meta::CPAN

    maturity  => $info->maturity,
    filename  => $info->filename,
    cpanid    => $info->cpanid,
    distvname => $info->distvname,
  });

  $self->{dists}{$path} = $dist;

  return unless defined $dist->version && $dist->dist;

  # see if it's latest
  my $distname = $info->dist;
  my $latest = $self->{latest_dists}{$distname};
  unless ($latest) {
    $self->{latest_dists}{$distname} = $dist;
    return $dist;
  }
  my ($distv, $latestv);
  eval {
    no warnings;
    $distv   = version->new( $dist->version   || 0 );
    $latestv = version->new( $latest->version || 0 );
  };
  if ($distv && $latestv) {
    if ($distv > $latestv) {
      $self->{latest_dists}{$distname} = $dist;
    }
  }
  else {
    no warnings;
    if ($dist->version > $latest->version) {
      $self->{latest_dists}{$distname} = $dist;
    }
  }

  $dist;
}

package #
  Acme::CPANAuthors::Utils::Packages::Distribution;

use strict;

lib/Acme/CPANAuthors/Utils/Packages.pm  view on Meta::CPAN


  # you can't pass the raw content of 02packages.details.txt(.gz)
  my $packages = Acme::CPANAuthors::Utils::Packages->new(
    'cpan/modules/02packages.details.txt.gz'
  );

  my $package = $packages->package('Acme::CPANAuthors');

  my $dist    = $packages->distribution('I/IS/ISHIGAKI/Acme-CPANAuthors-0.12.tar.gz');

  my $latest  = $packages->latest_distribution('Acme-CPANAuthors');

=head1 DESCRIPTION

This is a subset of L<Parse::CPAN::Packages>. The reading
methods are similar in general (accessors are marked as
read-only, though). Internals and data-parsing methods may
be different, but you usually don't need to care.

=head1 METHODS

lib/Acme/CPANAuthors/Utils/Packages.pm  view on Meta::CPAN


=head2 package

takes a name of a package, and returns an object that represents it.

=head2 distribution

takes a file name of a distribution, and returns an object that
represents it.

=head2 latest_distribution

takes a name of a distribution, and returns an object that represents
the latest version of it.

=head2 packages, distributions, latest_distributions

returns a list of stored packages or (latest) distribution objects.

=head2 package_count, distribution_count, latest_distribution_count

returns the number of stored packages or (latest) distributions.

=head1 PREAMBLE ACCESSORS

=head2 file, url, description, columns, intended_for, written_by, line_count, last_updated

These are accessors to the preamble information of
C<02packages.details.txt>.

=head1 PACKAGE ACCESSORS



( run in 1.674 second using v1.01-cache-2.11-cpan-5511b514fd6 )