Skip to content

Commit

Permalink
added another example: all authors (pauseid) to blogs URL mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
mickeyn committed Jan 27, 2015
1 parent c27259a commit 4d93956
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions examples/authors_blogs.pl
@@ -0,0 +1,22 @@
use strict;
use warnings;

use MetaCPAN::Client;

my $mcpan = MetaCPAN::Client->new;

my $all_authors = $mcpan->all('authors');

AUTHOR: while ( my $author = $all_authors->next ) {

BLOG: for my $blog ( @{ $author->blog || [] } ) {
$blog and exists $blog->{url} or next BLOG;
my $url = $blog->{url};

my $blogs_csv = ref $url eq 'ARRAY'
? join q{,} => @$url
: $url;

printf "%-10s: %s\n", $author->pauseid, $blogs_csv;
}
}

0 comments on commit 4d93956

Please sign in to comment.