Acme-CPANAuthors

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

0.27 2024/10/19
  - use https

0.26 2015/12/09
  - repackaging to add recommendation in META files (GH #4, XSAWYER++)

0.25 2015/01/25
  - improved pod coverage (PJACKLAM++)

0.24 2015/01/18
  - make sure if authors method is actually availabl (RT#101597 ETHER++)
  - switched to JSON::PP and HTTP::Tiny
  - changed look_for method to look for registered authors if called
    from an instance (instead of looking for all the registered authors
    in installed packages).

0.23 2013/07/08
  - added Acme::CPANAuthors::Factory (ETHER)
  - added categories method (ETHER) 

0.22 2013/07/07
  - listed new module: Australian
  - fixed example in ::Utils (ETHER)
  - not to require packages if ->author is available

0.21 2013/05/31
  - new author lists added (ETHER)
  - avatar_url falls back to <id>@cpan.org when no match is found from
    the email address (ETHER)
  - warning is issued when trying to fetch a gravatar when Gravatar::URL is
    not installed; Gravatar::URL added to recommended prereqs (ETHER)
  - id() now always assumes list context for the caller (ETHER)
  - added repository information to metadata

0.20 2012/11/01
  - listed new module: Czech
  - various pod fixes

Changes  view on Meta::CPAN


0.18 2011/10/20
  - listed new modules: Danish, Spanish

0.17 2011/10/18
  - listed several new modules: British, India, Swedish
  - website announcement

0.16 2011/03/09
  - listed several new modules: DualLife, GitHub, Search
  - ignore Search while looking for authors

0.15 2011/03/05
  - tweaked end of line handling
  - better API server error handling (RT #66394, thanks to ANDK)

0.14 2010/09/30
  - stopped trying hard to find cpan mirror in the hard drive,
    and try downloading index files if necessary.
    Set ACME_CPANAUTHORS_HOME environmental variable to use local
    indices.

Changes  view on Meta::CPAN

  - bumped up the version req of Parse::CPAN::Authors to 2.27
  - try harder to find 01mailrc file when there's a local CPAN
    mirror in the urllist of CPAN::Config

0.03 2008/05/30
  - "What's actually broken is Parse::CPAN::Authors 2.26" release
  - tentatively skip a test if Parse::CPAN::Authors 2.26 is loaded.

0.02 2008/05/22
  - "YAPC::Asia 2008 hackathon" release
  - made Acme::CPANAuthors::(Specific)->authors context sensitive.
  - better cpan config loading

0.01 2007/12/26
  - ported from former Acme::JapaneseCPANAuthors (not released)

MANIFEST  view on Meta::CPAN

t/02_standalone.t
t/03_extra.t
t/04_lookfor.t
t/05_kwalitee.t
t/06_parse_mailrc.t
t/07_parse_packages.t
t/08_inline_package.t
t/09_factory.t
t/99_pod.t
t/99_podcoverage.t
t/data/authors/01mailrc.txt
t/data/authors/01mailrc.txt.gz
t/data/modules/02packages.details.txt
t/data/modules/02packages.details.txt.gz
t/lib/Acme/CPANAuthors/Test.pm
t/lib/Acme/CPANAuthors/TestExtra.pm
META.yml                                 Module YAML meta-data (added by MakeMaker)
META.json                                Module JSON meta-data (added by MakeMaker)

META.json  view on Meta::CPAN

{
   "abstract" : "We are CPAN authors",
   "author" : [
      "Kenichi Ishigaki <ishigaki@cpan.org>"
   ],
   "dynamic_config" : 0,
   "generated_by" : "ExtUtils::MakeMaker version 7.70, CPAN::Meta::Converter version 2.150010",
   "license" : [
      "perl_5"
   ],
   "meta-spec" : {
      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
      "version" : 2

META.json  view on Meta::CPAN

         "requires" : {
            "Test::Deep" : "0",
            "Test::More" : "0.88",
            "Test::UseAllModules" : "0.15"
         }
      }
   },
   "release_status" : "stable",
   "resources" : {
      "repository" : {
         "url" : "https://github.com/charsbar/acme-cpanauthors"
      }
   },
   "version" : "0.27",
   "x_serialization_backend" : "JSON::PP version 4.16"
}

META.yml  view on Meta::CPAN

---
abstract: 'We are CPAN authors'
author:
  - 'Kenichi Ishigaki <ishigaki@cpan.org>'
build_requires:
  ExtUtils::MakeMaker: '0'
  Test::Deep: '0'
  Test::More: '0.88'
  Test::UseAllModules: '0.15'
configure_requires:
  ExtUtils::MakeMaker::CPANfile: '0.09'
dynamic_config: 0
generated_by: 'ExtUtils::MakeMaker version 7.70, CPAN::Meta::Converter version 2.150010'

META.yml  view on Meta::CPAN

  Exporter: '0'
  File::Spec: '0'
  HTTP::Tiny: '0'
  IO::File: '0'
  IO::Uncompress::Gunzip: '2.008'
  JSON::PP: '0'
  Module::Find: '0'
  Try::Tiny: '0'
  version: '0.74'
resources:
  repository: https://github.com/charsbar/acme-cpanauthors
version: '0.27'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'

Makefile.PL  view on Meta::CPAN

use warnings;
use ExtUtils::MakeMaker::CPANfile;

WriteMakefile(
  NAME           => 'Acme::CPANAuthors',
  AUTHOR         => 'Kenichi Ishigaki <ishigaki@cpan.org>',
  VERSION_FROM   => 'lib/Acme/CPANAuthors.pm',
  ABSTRACT_FROM  => 'lib/Acme/CPANAuthors.pm',
  META_MERGE => {
    resources => {
      repository  => 'https://github.com/charsbar/acme-cpanauthors',
    },
  },
  LICENSE => 'perl',
);

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

package Acme::CPANAuthors;

use strict;
use warnings;
use Carp;
use Acme::CPANAuthors::Utils qw( cpan_authors cpan_packages );

our $VERSION = '0.27';

sub new {
  my ($class, @categories) = @_;

  @categories = _list_categories() unless @categories;

  my %authors;
  foreach my $category ( @categories ) {
    %authors = ( %authors, _get_authors_of($category) );
  }

  bless {
      categories => \@categories,
      authors => \%authors,
  }, $class;
}

sub count {
  my $self = shift;

  return scalar keys %{ $self->{authors} };
}

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

  unless ( $id ) {
    my @ids = sort keys %{ $self->{authors} };
    return @ids;
  }
  else {
    return $self->{authors}{$id} ? 1 : 0;
  }
}

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

  unless ( $id ) {
    return sort values %{ $self->{authors} };
  }
  else {
    return $self->{authors}{$id};
  }
}

sub categories {
  my $self = shift;
  return @{$self->{categories}};
}

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

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

  return @packages;
}

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

  return unless $id;

  eval {require Gravatar::URL; 1}
      or warn($@), return;
  my $author = cpan_authors->author($id) or return;

  my $default = delete $options{default};
  return Gravatar::URL::gravatar_url(
    email => $author->email,
    %options,
    default => Gravatar::URL::gravatar_url(
      # Fall back to the CPAN address, as used by metacpan, which will in
      # turn fall back to a generated image.
      email => $id . '@cpan.org',
      %options,
      $default ? ( default => $default ) : (),
    ),
  );
}

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


  return unless defined $id_or_name;
  unless (ref $id_or_name eq 'Regexp') {
    $id_or_name = qr/$id_or_name/i;
  }

  my @found;
  my @categories = ref $self ? @{ $self->{categories} } : ();
  @categories = _list_categories() unless @categories;
  foreach my $category ( @categories ) {
    my %authors = _get_authors_of($category);
    while ( my ($id, $name) = each %authors ) {
      if ($id =~ /$id_or_name/ or $name =~ /$id_or_name/) {
        push @found, {
          id       => $id,
          name     => $name,
          category => $category,
        };
      }
    }
  }
  return @found;
}

sub _list_categories {
  require Module::Find;
  return grep { $_ !~ /^(?:Register|Utils|Not|Search|Factory)$/ }
         map  { s/^Acme::CPANAuthors:://; $_ }
         Module::Find::findsubmod( 'Acme::CPANAuthors' );
}

sub _get_authors_of {
  my $category = shift;

  $category =~ s/^Acme::CPANAuthors:://;

  return if $category =~ /^(?:Register|Utils|Search)$/;

  my $package = "Acme::CPANAuthors\::$category";
  unless ($package->can('authors')) {
    eval "require $package";
    if ( $@ ) {
      carp "$category CPAN Authors are not registered yet: $@";
      return;
    }
    # some may actually lack 'authors' interface
    return unless $package->can('authors');
  }
  $package->authors;
}

1;

__END__

=head1 NAME

Acme::CPANAuthors - We are CPAN authors

=head1 SYNOPSIS

    use Acme::CPANAuthors;

    my $authors = Acme::CPANAuthors->new('Japanese');

    my $number   = $authors->count;
    my @ids      = $authors->id;
    my @distros  = $authors->distributions('ISHIGAKI');
    my $url      = $authors->avatar_url('ISHIGAKI');
    my $kwalitee = $authors->kwalitee('ISHIGAKI');
    my @info     = $authors->look_for('ishigaki');

  If you don't like this interface, just use a specific authors list.

    use Acme::CPANAuthors::Japanese;

    my %authors = Acme::CPANAuthors::Japanese->authors;

    # note that ->author is context sensitive. however, you can't
    # write this without dereference for older perls as "keys"
    # checks the type (actually, the number) of args.
    for my $name (keys %{ Acme::CPANAuthors::Japanese->authors }) {
      print Acme::CPANAuthors::Japanese->authors->{$name}, "\n";
    }

=head1 DESCRIPTION

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
easily see who is the most kwalitative author in your community,
or who released or updated most in the past 365 days. More statistics
would come, and suggestions are welcome.

=head1 ENVIRONMENTAL VARIABLE

=head2 ACME_CPANAUTHORS_HOME

Since 0.14, Acme::CPANAuthors checks C<ACME_CPANAUTHORS_HOME>
environmental variable to look for a place where CPAN indices
are located. If you have a local (mini) CPAN mirror, or a source

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

=head2 new

creates an object and loads the subclasses corresponding to the
category/categories you specified.
If you don't specify any categories, it tries to load all
the subclasses found just under the "Acme::CPANAuthors"
namespace (except L<Acme::CPANAuthors::Not> and some other internal classes).

=head2 count

returns how many CPAN authors are registered.

=head2 id

returns all the registered ids by default. If called with an
id, this returns if there's a registered author of the id.

=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.


=head2 kwalitee

returns kwalitee information for the author of the id.
This information is fetched from a remote API server.

=head2 look_for

  my @authors = Acme::CPANAuthors->look_for('SOMEONE');
  foreach my $author (@authors) {
    printf "%s (%s) belongs to %s.\n",
      $author->{id}, $author->{name}, $author->{category};
  }

takes an id or a name (or a part of them, or even a regexp)
and returns an array of hash references, each of which contains
an id, a name, and a basename of the class where the person is
registered. Note that this will load all the installed
Acme::CPANAuthors:: modules but L<Acme::CPANAuthors::Not> and
modules with deeper namespaces.

=head1 SEE ALSO

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

=item L<Acme::CPANAuthors::British::Companies>

=item L<Acme::CPANAuthors::CodeRepos>

=item L<Acme::CPANAuthors::GeekHouse>

=item L<Acme::CPANAuthors::GitHub>

=back

These are lists for specific module authors.

=over 4

=item L<Acme::CPANAuthors::AnyEvent>

=item L<Acme::CPANAuthors::DualLife>

=item L<Acme::CPANAuthors::POE>

=item L<Acme::CPANAuthors::ToBeLike>

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

package Acme::CPANAuthors::Factory;

use strict;
use warnings;
use Acme::CPANAuthors;

sub create {
  my ($class, %data) = @_;

  my @categories = keys %data;
  my %authors = map { %{ $data{$_} } } @categories;

  return bless {
    categories => \@categories,
    authors => \%authors,
  }, 'Acme::CPANAuthors';
}

1;
__END__

=head1 NAME

Acme::CPANAuthors::Factory

=head1 SYNOPSIS

    use Acme::CPANAuthors::Factory;

    my $authors = Acme::CPANAuthors::Factory->create(
        Purple => {
            ETHER => 'Karen Etheridge',
            ISHIGAKI => 'Kenichi Ishigaki',
        },
    );
    my $number = $authors->count;
    # and all other methods described in Acme::CPANAuthors...

=head1 DESCRIPTION

Use this class when you have a list of authors that you want to manipulate,
but you only have the list of names at runtime (where
L<Acme::CPANAuthors::Register> is not very convenient).

An L<Acme::CPANAuthors> object will be created for you, containing the same
data as if you had registered a new class at compile time.

However, you cannot call C<< Acme::CPANAuthors->new >> with your category and
get back a new object; it still only knows about modules on disk.

=head1 METHOD

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

package Acme::CPANAuthors::Register;

use strict;
use warnings;

sub import {
  my ($class, %authors) = @_;

  my $caller = caller;
  {
    no strict 'refs';
    no warnings 'redefine';
    *{"$caller\::authors"} = sub { wantarray ? %authors : \%authors };

    (my $category = $caller) =~ s/^Acme::CPANAuthors:://;
    *{"$caller\::category"} = sub { $category };
  }
}

1;

__END__

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

  package Acme::CPANAuthors::YourGroup
  use strict;
  use warnings;
  our $VERSION = '0.071226';
  use Acme::CPANAuthors::Register (
    ID  => 'Real Name',
  );

  1;

  # then you can get authors list like these.
  # note that ->authors is context sensitive)

  my %hash    = Acme::CPANAuthors::YourGroup->authors;
  my $hashref = Acme::CPANAuthors::YourGroup->authors;

=head1 DESCRIPTION

This is used to register Pause IDs and real names of those who belong to your country/local perl mongers group/your company etc.

=head1 SEE ALSO

L<Acme::CPANAuthors>

=head1 AUTHOR

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

package Acme::CPANAuthors::Utils;

use strict;
use warnings;
use Carp;
use base qw( Exporter );
use File::Spec;

our $VERSION   = '0.27'; # see RT #43388
our @EXPORT_OK = qw( cpan_authors cpan_packages );

my $CPANFiles = {};

sub clear_cached_cpan_files () { $CPANFiles = {}; }

sub cpan_authors () {
  unless ( $CPANFiles->{authors} ) {
    require Acme::CPANAuthors::Utils::Authors;
    $CPANFiles->{authors} =
      Acme::CPANAuthors::Utils::Authors->new( _cpan_authors_file() );
  }
  return $CPANFiles->{authors};
}

sub cpan_packages () {
  unless ( $CPANFiles->{packages} ) {
    require Acme::CPANAuthors::Utils::Packages;
    $CPANFiles->{packages} =
      Acme::CPANAuthors::Utils::Packages->new( _cpan_packages_file() );
  }
  return $CPANFiles->{packages};
}

sub _cpan_authors_file () {
  _cpan_file( authors => '01mailrc.txt.gz' );
}

sub _cpan_packages_file () {
  _cpan_file( modules => '02packages.details.txt.gz' );
}

sub _cpan_file {
  my ($dir, $basename) = @_;

  my $file;
  if ($ENV{ACME_CPANAUTHORS_HOME}) {
    $file = _catfile($ENV{ACME_CPANAUTHORS_HOME}, $dir, $basename);
    return $file if $file && -r $file;
  }
  require File::Path;
  for my $parent (File::Spec->tmpdir, '.') {
    my $tmpdir = File::Spec->catdir($parent, '.acmecpanauthors', $dir);
    eval { File::Path::mkpath($tmpdir) };
    next unless -d $tmpdir && -r _;
    $file = _catfile($tmpdir, $basename);
    my $how_old = -M $file;
    if (!-r $file or !$how_old or $how_old > 1) {
      require HTTP::Tiny;
      my $ua = HTTP::Tiny->new(env_proxy => 1);
      my $res = $ua->mirror('http://www.cpan.org/'.$dir.'/'.$basename, $file);
      next unless $res->{success};
    }

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

=head1 NAME

Acme::CPANAuthors::Utils

=head1 DESCRIPTION

This may export several utility functions to use internally.

=head1 FUNCTIONS

=head2 cpan_authors (exportable)

returns a (probably cached) Parse::CPAN::Authors object.

=head2 cpan_packages (exportable)

returns a (probably cached) Parse::CPAN::Packages object.

=head2 clear_cached_cpan_files

clears cached Parse::CPAN::Authors/Packages objects.

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

package Acme::CPANAuthors::Utils::Authors;

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

sub _mappings {+{author => 'authors'}}

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

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

  while (my $line = $handle->getline) {
    $line =~ s/\r?\n$//;
    my ($alias, $pauseid, $long) = split ' ', $line, 3;
    $long =~ s/^"//;
    $long =~ s/"$//;
    my ($name, $email) = $long =~ /(.*) <(.+)>$/;
    my $author = Acme::CPANAuthors::Utils::Authors::Author->new({
      pauseid => $pauseid,
      name    => $name,
      email   => $email,
    });

    $self->{authors}{$pauseid} = $author;
  }
}

package #
  Acme::CPANAuthors::Utils::Authors::Author;

use strict;
use warnings;
use base 'Class::Accessor::Fast';

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


=head1 NAME

Acme::CPANAuthors::Utils::Authors

=head1 SYNOPSIS

  use Acme::CPANAuthors::Utils::Authors;

  # you can't pass the raw content of 01mailrc.txt(.gz)
  my $authors = Acme::CPANAuthors::Utils::Authors->new(
    'cpan/authors/01mailrc.txt.gz'
  );

  my $author = $authors->author('ISHIGAKI');

=head1 DESCRIPTION

This is a subset of L<Parse::CPAN::Authors>. 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

=head2 new

always takes a file name (both raw C<.txt> file and C<.txt.gz>
file name are acceptable). Raw content of the file is not
acceptable.

=head2 author

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

=head2 authors

returns a list of stored author objects.

=head2 author_count

returns the number of stored authors.

=head1 AUTHOR ACCESSORS

=head2 pauseid, name, email

  my $author = $authors->author('ISHIGAKI');
  print $author->pauseid, "\n"; # ISHIGAKI
  print $author->name, "\n";    # Kenichi Ishigaki
  print $author->email, "\n";   # ishigaki@cpan.org

=head1 SEE ALSO

L<Parse::CPAN::Authors>

=head1 AUTHOR

Kenichi Ishigaki, E<lt>ishigaki@cpan.orgE<gt>

=head1 COPYRIGHT AND LICENSE

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

package Acme::CPANAuthors::Utils::Kwalitee;

use strict;
use warnings;
use HTTP::Tiny;
use JSON::PP ();

my $ua;

sub _uri { "https://api.cpanauthors.org/kwalitee/" . shift }

sub _ua {
  my $class = shift;
  $ua = $_[0] if @_;
  $ua ||= HTTP::Tiny->new(env_proxy => 1);
  $ua;
}

sub fetch {
  my ($class, $id) = @_;

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

    }

=head1 DESCRIPTION

This is mainly to create some local kwalitee rankings for you :)

=head1 METHODS

=head2 fetch

returns kwalitee information for the author of the id.
This information is scraped from http://cpants.perl.org/.

=head1 AUTHOR

Kenichi Ishigaki, E<lt>ishigaki at cpan.orgE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2007 by Kenichi Ishigaki.

t/01_basic.t  view on Meta::CPAN

use strict;
use warnings;
use lib 't/lib';
use Test::More 0.88;
use Acme::CPANAuthors;

my $authors = Acme::CPANAuthors->new('Test');

my $count = $authors->count;
is($count, 1, 'author count');

my @ids = $authors->id;
is(@ids, 1, 'author ids');

my $ishigaki = $authors->id('ISHIGAKI');
ok($ishigaki, 'ISHIGAKI is a member');

my @names = $authors->name;
is(@names, 1, 'author names');

my $name = $authors->name('ISHIGAKI');
like($name, qr/Ishigaki/i, 'Ishigaki is a member');

my @categories = $authors->categories;
is(@categories, 1, '1 category');
is($categories[0], 'Test', 'category');

done_testing;

t/02_standalone.t  view on Meta::CPAN

use strict;
use warnings;
use lib 't/lib';
use Test::More 0.88;
use Acme::CPANAuthors::Test;

my %authors = Acme::CPANAuthors::Test->authors;

is(keys(%authors), 1, 'one author');

is(Acme::CPANAuthors::Test->authors->{ISHIGAKI}, 'Kenichi Ishigaki', 'id -> name mapping');

foreach my $name ( keys %{ Acme::CPANAuthors::Test->authors } ) {
  is($authors{$name}, Acme::CPANAuthors::Test->authors->{$name}, 'all mappings');
}

is(Acme::CPANAuthors::Test->category, 'Test', 'category');

done_testing;

t/03_extra.t  view on Meta::CPAN


BEGIN {
  eval {require Gravatar::URL; 1} or
    plan skip_all => "this test requires Gravatar::URL";
}

plan tests => 1;

local $ENV{ACME_CPANAUTHORS_HOME} = 't/data';

my $authors = Acme::CPANAuthors->new('TestExtra');

my $avatar_url = $authors->avatar_url('AADLER');
ok $avatar_url;

t/06_parse_mailrc.t  view on Meta::CPAN

# this test is ripped from Parse::CPAN::Authors

use strict;
use warnings;
#use lib 'lib';
#use IO::Zlib;
#use Test::Exception;
use Test::More tests => 23;
use_ok('Acme::CPANAuthors::Utils::Authors');

my $filename   = "t/data/authors/01mailrc.txt";
my $gzfilename = "t/data/authors/01mailrc.txt.gz";

#my $fh = IO::Zlib->new( $gzfilename, "rb" )
#    || die "Failed to read $filename: $!";
#my $contents = join '', <$fh>;
#$fh->close;

# try with no filename - not supported
#chdir "t";
#my $p = Acme::CPANAuthors::Utils::Authors->new();
#is_fine($p);

t/06_parse_mailrc.t  view on Meta::CPAN


# try with fake gzipped filename
eval { Acme::CPANAuthors::Utils::Authors->new("xyzzy.gz") };
like $@ => qr/Failed to read/;

sub is_fine {
    my $p = shift;

    isa_ok( $p, 'Acme::CPANAuthors::Utils::Authors' );

    my $a = $p->author('AASSAD');
    isa_ok( $a, 'Acme::CPANAuthors::Utils::Authors::Author' );
    is( $a->pauseid, 'AASSAD' );
    is( $a->name,    "Arnaud 'Arhuman' Assad" );
    is( $a->email,   'arhuman@hotmail.com' );

    $a = $p->author('AJOHNSON');
    isa_ok( $a, 'Acme::CPANAuthors::Utils::Authors::Author' );
    is( $a->pauseid, 'AJOHNSON' );
    is( $a->name,    'Andrew L. Johnson' );
    is( $a->email,   'andrew-johnson@shaw.ca' );

    is_deeply(
        [ sort map { $_->pauseid } $p->authors ],
        [   qw(AADLER AALLAN
                AANZLOVAR AAR AARDEN AARONJJ AARONSCA AASSAD ABARCLAY AJOHNSON)
        ]
    );
}

t/07_parse_packages.t  view on Meta::CPAN

my @packages = sort map { $_->package } $p->packages;
is_deeply(
    \@packages,
    [   qw(Acme::Colour Acme::Colour::Old Acme::ComeFrom Acme::Comment Acme::CramCode Acme::Currency accessors accessors::chained accessors::classic )
    ]
);

is( $p->file, '02packages.details.txt', 'file' );
is( $p->url, 'http://www.perl.com/CPAN/modules/02packages.details.txt',
    'url' );
is( $p->description, 'Package names found in directory $CPAN/authors/id/',
    'description' );
is( $p->columns, 'package name, version, path', 'columns' );
is( $p->intended_for, 'Automated fetch routines, namespace documentation.',
    'intended for' );
is( $p->written_by, 'Id: mldistwatch 479 2004-01-04 13:29:05Z k ',
    'written by' );
is( $p->line_count, 23609, 'line count' );
is( $p->last_updated, 'Fri, 13 Feb 2004 13:50:21 GMT', 'last updated' );

my $m = $p->package("Acme::Colour");

t/08_inline_package.t  view on Meta::CPAN


package # hide from pause
  Acme::CPANAuthors::TestInline;
use Acme::CPANAuthors::Register (
  ISHIGAKI => 'Kenichi Ishigaki',
);

package main;
use Acme::CPANAuthors;

my $authors = eval { Acme::CPANAuthors->new('TestInline') };
ok !$@, "no errors";
ok $authors && $authors->name('ISHIGAKI') eq 'Kenichi Ishigaki', "got a correct name";

t/09_factory.t  view on Meta::CPAN

use strict;
use warnings;

use Test::More 0.88;
use Test::Deep;
use Acme::CPANAuthors::Factory;

my $authors = Acme::CPANAuthors::Factory->create(
    Nonhuman => {
        ETHER => 'Karen Etheridge',
    },
    Japanese => {
        ISHIGAKI => 'Kenichi Ishigaki',
    },
);

is($authors->count, 2, 'author count');

is($authors->id, 2, 'author ids');

ok($authors->id('ISHIGAKI'), 'ISHIGAKI is a member');

my @names = $authors->name;
is(@names, 2, 'author names');

like($authors->name('ISHIGAKI'), qr/Ishigaki/i, 'Ishigaki is a member');

my @categories = $authors->categories;
is(@categories, 2, '2 categories');
cmp_deeply(
    \@categories,
    bag(qw(Nonhuman Japanese)),
    'categories',
);

done_testing;

t/data/modules/02packages.details.txt  view on Meta::CPAN

File:         02packages.details.txt
URL:          http://www.perl.com/CPAN/modules/02packages.details.txt
Description:  Package names found in directory $CPAN/authors/id/
Columns:      package name, version, path
Intended-For: Automated fetch routines, namespace documentation.
Written-By:   Id: mldistwatch 479 2004-01-04 13:29:05Z k 
Line-Count:   23609
Last-Updated: Fri, 13 Feb 2004 13:50:21 GMT

Acme::Colour                       1.00  L/LB/LBROCARD/Acme-Colour-1.00.tar.gz
Acme::Colour::Old                  1.00  L/LB/LBROCARD/Acme-Colour-0.95.tar.gz
Acme::ComeFrom                     0.07  A/AU/AUTRIJUS/Acme-ComeFrom-0.07.tar.gz
Acme::Comment                      1.02  K/KA/KANE/Acme-Comment-1.02.tar.gz



( run in 2.325 seconds using v1.01-cache-2.11-cpan-5c0b1e786e0 )