| line | stmt | bran | cond | sub | pod | time | code | 
| 1 | 2 |  |  | 2 |  | 790 | use 5.006; | 
|  | 2 |  |  |  |  | 6 |  | 
|  | 2 |  |  |  |  | 70 |  | 
| 2 | 2 |  |  | 2 |  | 8 | use strict; | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 63 |  | 
| 3 | 2 |  |  | 2 |  | 24 | use warnings; | 
|  | 2 |  |  |  |  | 2 |  | 
|  | 2 |  |  |  |  | 134 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | package CPAN::Distribution::ReleaseHistory::ReleaseIterator; | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | our $VERSION = '0.002003'; | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | # ABSTRACT: A container to iterate a collection of releases for a single distribution | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY | 
| 12 |  |  |  |  |  |  |  | 
| 13 | 2 |  |  | 2 |  | 561 | use Moo qw( has ); | 
|  | 2 |  |  |  |  | 11006 |  | 
|  | 2 |  |  |  |  | 13 |  | 
| 14 | 2 |  |  | 2 |  | 2448 | use CPAN::DistnameInfo; | 
|  | 2 |  |  |  |  | 1553 |  | 
|  | 2 |  |  |  |  | 53 |  | 
| 15 | 2 |  |  | 2 |  | 716 | use CPAN::Distribution::ReleaseHistory::Release; | 
|  | 2 |  |  |  |  | 5 |  | 
|  | 2 |  |  |  |  | 468 |  | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  |  | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  |  | 
| 23 |  |  |  |  |  |  | has 'scroller' => ( is => 'ro', required => 1 ); | 
| 24 |  |  |  |  |  |  |  | 
| 25 |  |  |  |  |  |  |  | 
| 26 |  |  |  |  |  |  |  | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | sub next_release { | 
| 34 | 13 |  |  | 13 | 1 | 18616 | my ($self) = @_; | 
| 35 | 13 |  |  |  |  | 53 | my $scroll_result = $self->scroller->next; | 
| 36 | 13 | 50 |  |  |  | 179 | return if not $scroll_result; | 
| 37 |  |  |  |  |  |  |  | 
| 38 | 13 |  | 33 |  |  | 54 | my $data_hash = $scroll_result->{'_source'} || $scroll_result->{'fields'}; | 
| 39 | 13 | 50 |  |  |  | 42 | return if not $data_hash; | 
| 40 |  |  |  |  |  |  |  | 
| 41 | 13 |  |  |  |  | 19 | my $path = $data_hash->{download_url}; | 
| 42 | 13 |  |  |  |  | 74 | $path =~ s{\A.*/authors/id/}{}msx; | 
| 43 | 13 |  |  |  |  | 39 | my $distinfo = CPAN::DistnameInfo->new($path); | 
| 44 | 13 | 50 | 33 |  |  | 642 | my $distname = | 
| 45 |  |  |  |  |  |  | defined($distinfo) && defined( $distinfo->dist ) | 
| 46 |  |  |  |  |  |  | ? $distinfo->dist | 
| 47 |  |  |  |  |  |  | : $data_hash->{name}; | 
| 48 | 13 |  |  |  |  | 354 | return CPAN::Distribution::ReleaseHistory::Release->new( | 
| 49 |  |  |  |  |  |  | distname  => $distname, | 
| 50 |  |  |  |  |  |  | path      => $path, | 
| 51 |  |  |  |  |  |  | timestamp => $data_hash->{stat}->{mtime}, | 
| 52 |  |  |  |  |  |  | size      => $data_hash->{stat}->{size}, | 
| 53 |  |  |  |  |  |  | ); | 
| 54 |  |  |  |  |  |  | } | 
| 55 |  |  |  |  |  |  |  | 
| 56 | 2 |  |  | 2 |  | 15 | no Moo; | 
|  | 2 |  |  |  |  | 3 |  | 
|  | 2 |  |  |  |  | 6 |  | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | 1; | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | __END__ |