Skip to content

Commit

Permalink
added cpan/backpan 100 files to CPAN Stats page creation
Browse files Browse the repository at this point in the history
  • Loading branch information
barbie committed May 18, 2014
1 parent d294d7a commit 714a86e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,8 @@
Revision history for CPAN-Testers-WWW-Statistics Revision history for CPAN-Testers-WWW-Statistics
================================================ ================================================


- added cpan/backpan 100 files to CPAN Stats page creation.

1.11 2014-05-11 1.11 2014-05-11
- build performance data in isolation. - build performance data in isolation.


Expand Down
4 changes: 2 additions & 2 deletions bin/getmailrc.pl
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ =head1 COPYRIGHT AND LICENSE
Copyright (C) 2008-2013 Barbie for Miss Barbell Productions. Copyright (C) 2008-2013 Barbie for Miss Barbell Productions.
This module is free software; you can redistribute it and/or This distribution is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. modify it under the Artistic Licence v2.
=cut =cut
31 changes: 30 additions & 1 deletion lib/CPAN/Testers/WWW/Statistics/Pages.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -943,6 +943,34 @@ sub _report_cpan {
} }


$self->_writepage('statscpan',\%tvars); $self->_writepage('statscpan',\%tvars);


$self->{parent}->_log("building cpan/backpan 100s");

$self->_count_mailrc();
my $directory = $self->{parent}->directory;
my $results = "$directory/stats";
mkpath($results);

# calculate CPAN 100 data
my @rows = $self->{parent}->{CPANSTATS}->get_query('hash',"SELECT t.author,t.count FROM (SELECT author,count(distinct dist) AS count FROM uploads WHERE type!='backpan' GROUP BY author ORDER BY count DESC LIMIT 100) AS t WHERE t.count >= 100");
my $fh = IO::File->new(">$results/cpan100.csv");
printf $fh "# DATE: %s\n", DateTime->now->datetime;
print $fh "#Pause,Count,Name\n";
for my $row (@rows) {
printf $fh "%s,%d,%s\n", $row->{author}, $row->{count}, $self->{alias}{$row->{author}}||'???';
}
$fh->close;

# calculate BACKCPAN 100 data
my @rows = $self->{parent}->{CPANSTATS}->get_query('hash',"SELECT t.author,t.count FROM (SELECT author,count(distinct dist) AS count FROM uploads GROUP BY author ORDER BY count DESC LIMIT 100) AS t WHERE t.count >= 100");
my $fh = IO::File->new(">$results/backpan100.csv");
printf $fh "# DATE: %s\n", DateTime->now->datetime;
print $fh "#Pause,Count,Name\n";
for my $row (@rows) {
printf $fh "%s,%d,%s\n", $row->{author}, $row->{count}, $self->{alias}{$row->{author}}||'???';
}
$fh->close;
} }


sub _update_noreports { sub _update_noreports {
Expand Down Expand Up @@ -1945,7 +1973,8 @@ sub _count_mailrc {


my $fh = IO::File->new($mailrc,'r') or die "Cannot read file [$mailrc]: $!\n"; my $fh = IO::File->new($mailrc,'r') or die "Cannot read file [$mailrc]: $!\n";
while(<$fh>) { while(<$fh>) {
next unless(/^alias\s*\w/); next unless(/^alias\s*(\w+)\s+"([\s\w]+)\s+<[^>]+>"/);
$self->{alias}{$1} = $2;
$count++; $count++;
} }
$fh->close; $fh->close;
Expand Down

0 comments on commit 714a86e

Please sign in to comment.