encapsulate reporting in its how function too
This commit is contained in:
parent
0c3f6949fa
commit
40407e9604
16
script.pl
16
script.pl
@ -7,7 +7,10 @@ use List::Util qw(sum);
|
|||||||
use Text::SimpleTable::AutoWidth;
|
use Text::SimpleTable::AutoWidth;
|
||||||
use WWW::Mechanize ();
|
use WWW::Mechanize ();
|
||||||
|
|
||||||
|
use experimental qw/ signatures /;
|
||||||
|
|
||||||
sub get_mersenne_results() {
|
sub get_mersenne_results() {
|
||||||
|
|
||||||
# log in to Mersenne.org and get results for the last year
|
# log in to Mersenne.org and get results for the last year
|
||||||
# excluding everything but PHP and DD results
|
# excluding everything but PHP and DD results
|
||||||
|
|
||||||
@ -39,6 +42,10 @@ sub get_mersenne_results() {
|
|||||||
|
|
||||||
my $ts = get_mersenne_results();
|
my $ts = get_mersenne_results();
|
||||||
|
|
||||||
|
generate_output_table($ts)->draw;
|
||||||
|
|
||||||
|
sub generate_output_table ($ts) {
|
||||||
|
|
||||||
# group GHZ Days results by computer, compute GHZ Days per Day (GHZ Days / Days)
|
# group GHZ Days results by computer, compute GHZ Days per Day (GHZ Days / Days)
|
||||||
my $list;
|
my $list;
|
||||||
|
|
||||||
@ -66,11 +73,10 @@ foreach my $key ( keys %$list ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# sort hash by the average and print to screen
|
# sort hash by the average and print to screen
|
||||||
my $tbl =
|
return Text::SimpleTable::AutoWidth->new(
|
||||||
Text::SimpleTable::AutoWidth->new(
|
|
||||||
captions => [qw/ Computer GHZDaysPerDay /] );
|
captions => [qw/ Computer GHZDaysPerDay /] );
|
||||||
foreach my $key ( reverse sort { $ranks{$a} <=> $ranks{$b} } keys(%ranks) ) {
|
foreach
|
||||||
|
my $key ( reverse sort { $ranks{$a} <=> $ranks{$b} } keys(%ranks) ) {
|
||||||
$tbl->row( $key, $ranks{$key} );
|
$tbl->row( $key, $ranks{$key} );
|
||||||
}
|
}
|
||||||
say $tbl->draw();
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user