Acme-CPANAuthors-Acme-CPANAuthors-Authors

 view release on metacpan or  search on metacpan

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

package Acme::CPANAuthors::Acme::CPANAuthors::Authors;
use strict;
use warnings;

=head1 NAME

Acme::CPANAuthors::Acme::CPANAuthors::Authors - We are CPAN authors who have authored Acme::CPANAuthors modules

=cut

use version; our $VERSION = version->declare('v1.0.0');
use Acme::CPANAuthors::Register (
    ABIGAIL  => q[Abigail],          # A::C::Dutch ...or not.
    ACALPINI => q[Aldo Calpini],     # A::C::Italian
    ASHLEY   => q[Ashley Pond V],    # A::C::Misanthrope
    AZAWAWI =>
        q[أحمد محمد زواوي - Ahmad M. Zawawi],    # A::C::Arabic
    BARBIE    => q[Barbie],                               # A::C::British
    BINGOS    => q[Chris Williams],                       # A::C::POE
    BRACETA   => q[Luís Azevedo],                        # A::C::Portuguese
    BURAK     => q[Burak Gürsoy],                        # A::C::Turkish
    ETHER     => q[Karen Etheridge],                      # A::C::Nonhuman
    FAYLAND   => q[Fayland æž—],                          # A::C::Chinese
    FLORA     => q[Florian Ragwitz],                      # A::C::German
    GARU      => q[Breno G. de Oliveira],                 # A::C::Brazilian
    GRAY      => q[gray],                                 # A::C::GitHub
    GUGOD     => q[劉康民],                            # A::C::Taiwanese
    HINRIK    => q[Hinrik Örn Sigurðsson],              # A::C::Icelandic
    ISHIGAKI  => q[Kenichi Ishigaki],                     # The Original
    JEEN      => q[Jeen Lee],                             # A::C::Korean
    JLMARTIN  => q[Jose Luis Martinez Torres],            # A::C::Catalonian
    KAARE     => q[Kaare Rasmussen],                      # A::C::Danish
    KENTARO   => q[Kentaro Kuribayashi],                  # A::C::GeekHouse
    MARCEL    => q[Marcel Grünauer == hanekomu],         # A::C::Austrian
    MONS      => q[Mons Anderson],                        # A::C::AnyEvent
    RBO       => q[Robert Bohne],                         # A::C::German
    SALVA     => q[Salvador Fandiño García],            # A::C::Spanish
    SANKO     => q[Sanko Robinson],                       # Hey, that's me!
    SAPER     => q[Sébastien Aperghis-Tramoni],          # A::C::French
    SFINK     => q[Steve A Fink],                         # A::C::Not
    SHANTANU  => q[Shantanu Bhadoria],                    # A::C::India
    SHARIFULN => q[Анатолий Шарифулин],  # A::C::Russian
    SHARYANTO => q[Steven Haryanto],                      # A::C::Indonesian
    SHLOMIF   => q[Shlomi Fish],                          # A::C::Israeli
    SKIM      => q[Michal Špaček],                      # A::C::Czech
    SROMANOV  => q[Сергей Романов],          # A::C::Belarusian
    VPIT      => q[Vincent Pit],                          # A::C::You're_using
    WOLDRICH  => q[Magnus Woldrich],                      # A::C::Swedish
    ZOFFIX    => q[Zoffix Znet]                           # A::C::Canadian
);

sub _regen {
    require HTTP::Tiny;
    my $data    = '';
    my $authsec = 0;
    my %authors;
    die "Failed\n"
        unless HTTP::Tiny->new->request(
        'GET',
        'http://www.cpan.org/modules/02packages.details.txt',
        {data_callback => sub {    # Don't scrape the whole file
             my $chunk = shift;
             if ($chunk =~ m[^Acme::CPANAuthors]sm) {
                 $authsec++;
                 $data .= $chunk;
             }
             elsif ($authsec) {    # No more Authors in 02packages
                 while ($data
                     =~ m[^(?:Acme::CPANAuthors(?:::(\S+))?).+\w/\w\w/(\w+)/.+$]mg
                     )
                 {   $authors{$2} //= [];
                     push @{$authors{$2}}, $1;
                 }
                 my %old = authors();    # Current authors
                 my @new = grep { defined $old{$_} ? () : $_ } keys %authors;
                 print scalar(@new)
                     . " new Acme::CPANAuthors authors to add\n";
                 return if !@new;
                 require MetaCPAN::API;
                 my $mcpan = MetaCPAN::API->new();
                 binmode(STDOUT, ':utf8');

                 for my $id (sort @new) {
                     my $author = $mcpan->author($id);
                     printf "    %s => q[%s], # %s\n", $id, $author->{name},
                         join ', ', map { 'A::C::' . $_ } @{$authors{$id}};
                 }
                 exit    # We're done
             }
             }
        }
        )->{success};
}
1;

=head1 Synopsis

    use Acme::CPANAuthors;

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

    $number   = $authors->count;
    @ids      = $authors->id;
    @distros  = $authors->distributions('ACALPINI');
    $url      = $authors->avatar_url('SHLOMIF');
    $kwalitee = $authors->kwalitee('SANKO');

=head1 Description

This class provides a hash of Pause IDs/names of Acme::CPANAuthors::*
authorin' CPAN authors.

I started this module because
L<Acme::CPANAuthors::UnitedStates|Acme::CPANAuthors::UnitedStates> doesn't
exist and apparently I'm not listed in
L<Acme::CPANAuthors::Japanese|Acme::CPANAuthors::Japanese>. ((sigh)) I just
want to be a part of something... great... greater... than-- um, sorry, lost
my train of thought.

Anyway, I decided both L<Acme::CPANAuthors::Earth|Acme::CPANAuthors::Earth>
(well covered between http://search.cpan.org/author/ and
http://pause.perl.org/pause/query?ACTION=who_is) and
L<Acme::CPANAuthors::Authors|Acme::CPANAuthors::Authors> (only include authors
who have published at least one distribution, script, etc.) would just be too
time consuming for a 3AM lapse in judgement so... there you are.

=head1 Installation



( run in 1.660 second using v1.01-cache-2.11-cpan-8dfa8b56332 )