Heray-Was-Here
Server : Apache
System : Linux vps103298.mylogin.co 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User : calvet ( 273824)
PHP Version : 7.4.33
Disable Function : NONE
Directory :  /proc/self/root/usr/share/doc/perl-MetaCPAN-Client/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/usr/share/doc/perl-MetaCPAN-Client/fav.pl
#!/usr/bin/env perl

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;
use DDP;
p $favs;
exit;
for my $fav ( $favs->[0]->next ) {
    p $fav;
}

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

Hry