App-LastStats
view release on metacpan or search on metacpan
lib/App/LastStats.pm view on Meta::CPAN
'Valid periods are: ', join(', ', @valid_periods), "\n";
}
unless (exists $renderer->{$format}) {
die "Invalid format: $format\n",
'Valid formats are: ', join(', ', keys %$renderer), "\n";
}
}
method render_text {
say "* $_->{name} ($_->{playcount})" for @artists;
}
method render_json {
my $pos = 1;
my @data = map { {
position => $pos++,
name => $_->{name},
count => $_->{playcount},
url => $_->{url}
} } @artists;
say JSON->new->canonical(1)->pretty(1)->encode(\@data);
}
method render_html {
my $html = "<ol>\n";
$html .= qq[ <li><a href="$_->{url}">$_->{name}</a> ($_->{playcount})</li>\n] for @artists;
$html .= "</ol>";
say $html;
}
method render {
my $method = $renderer->{$format};
$self->$method;
}
method laststats {
my $page = 1;
( run in 1.577 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )