Navigation Menu

Skip to content

Commit

Permalink
another example (top 20 favorite distributions)
Browse files Browse the repository at this point in the history
  • Loading branch information
mickeyn committed Jan 27, 2015
1 parent 0e85828 commit c27259a
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions examples/top20_favorite_distributions.pl
@@ -0,0 +1,27 @@
use strict;
use warnings;
use Data::Printer;

use MetaCPAN::Client;

# TOP 20 FAVORITE DISTRIBUTIONS

my $mcpan = MetaCPAN::Client->new();
my $favs = $mcpan->all('favorites', {
facets => {
distribution => {
terms => {
field => "distribution",
size => 20,
order => "count",
}
},
}
});

print "TOP 20 FAVORITE DISTRIBUTIONS:\n";

my $count = 1;
for ( @{ $favs->facets->{distribution}{terms} } ) {
printf "%3d) %5d %-20s\n", $count++, @{$_}{qw/count term/};
}

0 comments on commit c27259a

Please sign in to comment.