Your IP : 216.73.216.1


Current Path : /usr/share/doc/perl-MetaCPAN-Client/examples/
Upload File :
Current File : //usr/share/doc/perl-MetaCPAN-Client/examples/top20_favorites.pl

# examples/top20_favorites

use strict;
use warnings;
use MetaCPAN::Client;

my $top20_fav =
    MetaCPAN::Client->new()->all(
        'favorites',
        {
            aggregations => {
                aggs => {
                    terms => {
                        field => "distribution",
                        size => 20,
                    }
                }
            }
        }
    );

for my $bucket ( @{ $top20_fav->aggregations->{aggs}{buckets} } ) {
    printf "%s : %s\n", $bucket->{doc_count}, $bucket->{key}
}