Acme-CPANAuthors-BackPAN-OneHundred

 view release on metacpan or  search on metacpan

examples/author_info  view on Meta::CPAN

die "usage: $0 PAUSE_ID [PAUSE_ID ...]\n" unless @ARGV;

my $authors  = Acme::CPANAuthors->new("CPAN::OneHundred");

for my $id (@ARGV) {
    $id = uc $id;
    my $name     = $authors->name($id) || $id;
    my @dists    = $authors->distributions($id);
    my $kwalitee = $authors->kwalitee($id);

    print "$name has published ", ~~@dists," distributions:\n";

    @dists = sort { lc($a->dist) cmp lc($b->dist) } @dists;

    for my $dist (@dists) {
        printf " - %s v%s, kwalitee %s\n", 
            $dist->dist, $dist->version, 
            $kwalitee->{distributions}{ $dist->dist }{kwalitee},
    }

    print $/ if @ARGV > 1;
}

examples/check100.pl  view on Meta::CPAN


check100.pl - checks the BackPAN 100 list and returns differences

=head1 SYNOPSIS

  perl check100.pl

=head1 DESCRIPTION

Downloads the latest copy of the backpan100.csv file from CPAN Testers Statistics
site. Compares with the previous download, and prints the differences.

=cut

# -------------------------------------
# Library Modules

use File::Basename;
use Text::Diff;
use WWW::Mechanize;

# -------------------------------------
# Variables

# -------------------------------------
# Program

my $base = dirname($0);
chdir($base);
#print "dir=$base\n";

my $mech = WWW::Mechanize->new();
my $source = 'http://stats.cpantesters.org/stats/backpan100.csv';
my $target = basename($source);
$mech->mirror($source,$target);

my $file = 'data/backpan100.csv';

my $diff = diff $file, $target;
print $diff . "\n";

#unlink $target;

__END__

=head1 BUGS, PATCHES & FIXES

There are no known bugs at the time of this release. However, if you spot a
bug or are experiencing difficulties, that is not explained within the POD
documentation, please send bug reports and patches to the RT Queue (see below).

examples/count  view on Meta::CPAN

#!/usr/bin/perl
use warnings;
use strict;
use Acme::CPANAuthors;

my $authors  = Acme::CPANAuthors->new("CPANs::/OneHundred");
my $number   = $authors->count;

print "$number CPAN authors 100 or distributions on CPAN\n";

examples/update100.pl  view on Meta::CPAN

    'delete' => 'See You Again?',
);

# -------------------------------------
# Program

GetOptions(\%options, 'local', 'build', 'release') or die "Usage: $0 [--local] [--build] [--release]\n";

my $base = dirname($0);
chdir($base);
#print "dir=$base\n";

unless($options{local}) {
    my $mech = WWW::Mechanize->new();
    my $source = 'http://stats.cpantesters.org/stats/backpan100.csv';
    my $target = basename($source);
    $mech->mirror($source,$target);
}

# read old file
my $inx = 0;

examples/update100.pl  view on Meta::CPAN

        my ($pause,$cnt,$name) = split(/,/);
        next unless($pause);

        $inx++;
        $old{$inx} = { count => $cnt, pause => $pause, name => $name };
        $pause{$pause} = $cnt;
    }
    $fh->close;
}

#print "pause=" . Dumper(\%pause);
#print "old=" . Dumper(\%old);

# read new file
$inx = 0;
$file = 'backpan100.csv';
my $fh = IO::File->new($file,'r') or die "Cannot open file [$file]: $!\n";
while(<$fh>) {
    s/\s+$//;

    if($_ && $_ =~ /^# DATE: (.*)/) {
        $tvars{WHEN} = $1;

examples/update100.pl  view on Meta::CPAN

        $changed = 1;
    } else {
        delete $pause{$pause};
    }

    $max = length $new{$inx}{pause} if($max < length $new{$inx}{pause});
}
$fh->close;

$tvars{COUNT} = scalar(keys %new);
#print "new=" . Dumper(\%new);
#print "pause=" . Dumper(\%pause);

# counts can go down as well as up
if(scalar(keys %pause)) {
    $changed = 1;
    push @{$changes{delete}}, $_
        for(keys %pause);
}

#print "max=$max, changed=$changed\n";

# bail if nothing has changed
unless($changed) {
    print "Nothing has changed, bailing\n";
    exit 0;
}

$max = (int($max/4) + 1) * 4    if($max % 4);
$max+=2;

# create lists
for my $inx (sort {$new{$a}{pause} cmp $new{$b}{pause}} keys %new) {
    my $pad = $max - length $new{$inx}{pause};
    push @{$tvars{LIST1}}, sprintf "    '%s'%s=> '%s',", $new{$inx}{pause}, (' ' x $pad), $new{$inx}{name};
}

my $cnt = 1;
for my $inx (sort {$new{$b}{count} <=> $new{$a}{count} || $new{$a}{pause} cmp $new{$b}{pause}} keys %new) {
    my $pad = $max - length $new{$inx}{pause};
    push @{$tvars{LIST2}}, sprintf "  %2d.  %3d  %s%s%s", $cnt++, $new{$inx}{count}, $new{$inx}{pause}, (' ' x $pad), $new{$inx}{name};
}

# calculate copyright
$tvars{COPYRIGHT} = '2014';
my $year = DateTime->now->year;
$tvars{COPYRIGHT} .= "-$year"  if($year > 2014);

# calculate version
$file = '../Changes';
my $changes = CPAN::Changes->load( $file );

my @releases = $changes->releases();
my $version  = $releases[-1]->{version};
$version += 0.01;
$tvars{VERSION} = sprintf "%.2f", $version;

# update Changes file
my $release = CPAN::Changes::Release->new( version => $tvars{VERSION}, date => DateTime->now->ymd );
for my $group (qw(insert update delete)) {
    next    unless($changes{$group});

    $release->add_changes(
        { group => $groups{$group} },
        join(', ',@{$changes{$group}})
    );

examples/update100.pl  view on Meta::CPAN

$fh = IO::File->new($file,'w+') or die "Cannot open file [$file]: $!\n";
my $content = $changes->serialize;
my @content = split(/\n/,$content);
$content = '';
for my $line (@content) {
    $line =~ s/^([\d.]+)\s+(.*?)$/$1    $2/;
    $line =~ s/^\s+(.*?)/        $1/;
    $line =~ s/^\s+(.*?)/        - $1/ unless($line =~ /^\s+[\[\-]/);
    $content .= "$line\n";
}
print $fh $content;
$fh->close;

# update other files
my $parser = Template->new(\%config);        # initialise parser
for my $template (@files) {
    eval {
        # parse to text
        $parser->process($template,\%tvars,$template) or die $parser->error();
    };

examples/update100.pl  view on Meta::CPAN

    # build tarball
    system("perl Makfile.PL");
    system("make dist");

    if($options{release}) {
        # submit tarball
        system("cpan-upload Acme-CPANAuthors-BackPAN-OneHundred-$tvars{VERSION}.tar.gz");
    }
}

print "Done!\n";

__END__

=head1 BUGS, PATCHES & FIXES

There are no known bugs at the time of this release. However, if you spot a
bug or are experiencing difficulties, that is not explained within the POD
documentation, please send bug reports and patches to the RT Queue (see below).

Fixes are dependent upon their severity and my availability. Should a fix not



( run in 0.947 second using v1.01-cache-2.11-cpan-de7293f3b23 )