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*(.+))?$/;
( run in 3.341 seconds using v1.01-cache-2.11-cpan-364913b4093 )