Acme-CPANAuthors-Japanese
view release on metacpan or search on metacpan
bin/unregistered_japanese_authors view on Meta::CPAN
#!perl
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/../lib";
use Acme::CPANAuthors::Utils qw( cpan_authors );
use Acme::CPANAuthors::Japanese;
use Lingua::JA::Romaji::Valid;
use Time::Piece;
use Getopt::Long qw/:config gnu_compat/;
GetOptions(\my %opts, qw/update module exception/);
my $validator = Lingua::JA::Romaji::Valid->new('liberal');
my %known = Acme::CPANAuthors::Japanese->authors;
my %exceptions = _exceptions();
my @authors;
foreach my $author ( cpan_authors->authors ) {
my $email = $author->email;
my $name = lc $author->name or next;
my $id = $author->pauseid;
next if $known{$id};
next if $exceptions{$id};
next unless $validator->as_fullname( $name )
|| $validator->as_name( $name );
# next unless $email and $email =~ /(\.(com|org|net|jp)|CENSORED)$/i;
push @authors, $author;
}
print "num of candidates: " , (scalar @authors), "\n";
foreach my $author ( sort { $a->pauseid cmp $b->pauseid } @authors ) {
my $id = $author->pauseid;
my $name = $author->name;
my $mail = $author->email;
print qq{ $id => '$name', # ($mail)\n};
$exceptions{$id} = $known{$id} = [$name, $mail];
}
if ($opts{exception}) {
my $file = __FILE__;
open my $in, '<', $file or die $!;
open my $out, '>', "$file.tmp" or die $!;
my $flag;
while(<$in>) {
if (/^sub _exceptions/) {
print $out $_;
$flag = 1;
next;
}
if ($flag && /^\)\}/) {
for my $id (sort keys %exceptions) {
if (ref $exceptions{$id}) {
print $out " $id => '$exceptions{$id}[0]', # $exceptions{$id}[1]\n";
} else {
print $out " $id => '$exceptions{$id}',\n";
}
}
$flag = 0;
}
if ($flag) {
my ($id, $name, $comment) = /^\s+(\w+)\s*=>\s*'(.+?)',(?:\s*#\s*(.+))?$/;
if ($id && $name && $comment) {
$exceptions{$id} = [$name, $comment];
}
next;
}
print $out $_;
}
close $in;
close $out;
rename "$file.tmp" => $file or die $!;
}
if ($opts{update}) {
my $file = "$FindBin::Bin/../lib/Acme/CPANAuthors/Japanese.pm";
open my $in, '<', $file or die $!;
open my $out, '>', "$file.tmp" or die $!;
my $flag;
while(<$in>) {
if (/our \$VERSION = /) {
my $ymd = substr(Time::Piece->new->strftime('%Y%m%d'), 2);
print $out "our \$VERSION = '0.$ymd';\n";
next;
}
if (/^use Acme::CPANAuthors::Register/) {
print $out $_;
for my $id (sort keys %known) {
if (ref $known{$id}) {
printf $out " %-9s => '%s', # (%s)\n", $id, $known{$id}[0], $known{$id}[1];
} else {
printf $out " %-9s => '%s',\n", $id, $known{$id};
}
}
$flag = 1;
next;
}
if ($flag && /^\)/) {
$flag = 0;
}
print $out $_ unless $flag;
}
close $in;
close $out;
rename "$file.tmp" => $file;
}
# these authors have names which can be readable as Japanese
sub _exceptions {(
AANARI => 'Ali Anari',
AARONJJ => 'Aaron Johnson',
ABATIE => 'Alan Batie',
ABBYPAN => 'Pan Lanlan',
ADEO => 'Adekunle Olonoh',
ADITYA => 'Aditya Wasudeo',
AESOP => 'AA',
AKISSANE => 'Aidan Kissane',
ALANC => 'Alan Champion',
AMBROSEUS => 'Eugene Samonenko',
AMMODULES => 'Aaron Noraa',
ANAK => 'Mario Rossano',
ANARION => 'Anarion',
ANBU => 'Anbalagan Pugaleesan',
ANDOT => 'MA Bingyao',
ANEI => 'Ailin Nemui',
ANNADURAI => 'Anna Durai',
ANTIPASTA => 'Joe Papperello',
ANTRO => 'Antonio Rosella',
ARACKHAEN => 'Sami Lehtimaki',
AREGGIORI => 'areggiori',
ATTILA => 'attila',
BARTENDER => 'Maroun',
BEANS => 'Ben',
BEDOSHI => 'Bedoshi',
BEN => 'Ben Laurie',
BENBETA => 'Ben Beta',
BENH => 'Benjamin Hare',
BEPPU => 'John Beppu',
BERETTA => 'Joshua Moore',
BIJUA => 'Biju A',
BINOJOHN => 'Bino John',
BINWIND => 'Bin Hu',
BIOJETONE => 'mecha',
BKOLERA => 'Ben Kolera',
BLX => 'lorenzo bellotti',
BOD => 'Ian Boddison',
BOLILA => 'Joao Bolila',
BOMBUP => 'no name',
BOXZOU => 'Bo Zou',
BSAGO => 'Benjamin Sago',
BUGONI => 'Piero Bugoni',
BUNTAR => 'ben',
CAIO => 'Eh',
CGLEE => 'Chae Lee',
CHAROITEL => 'Charoite Lee',
CHAROVARK => 'Charoite Lee',
CHUNZI => 'chunzi',
COMPASS => 'Pan Luo',
CORNO => 'Ian Hansen',
CSELT => 'Emma Tonkin',
( run in 2.783 seconds using v1.01-cache-2.11-cpan-364913b4093 )