| 1 | package Bootylicious::PingbackIterator; | ||||||||||
| 2 | |||||||||||
| 3 | 12 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 12 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 12 | ▶ | use base 'Bootylicious::Iterator'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 12 | __PACKAGE__->attr('path'); | |||||||||
| 9 | |||||||||||
| 10 | 12 | ▶ | use Bootylicious::Pingback; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 12 | ▶ | use Bootylicious::Timestamp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | sub new { | ||||||||||
| 14 | 9 | ▶ | my $self = shift->SUPER::new(@_); | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 15 | |||||||||||
| 16 | 9 | return $self->load; | |||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | sub load { | ||||||||||
| 20 | 9 | ▶ | my $self = shift; | ||||||||
|
Subroutine
load: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 21 | |||||||||||
| 22 | 9 | ▶ | open my $fh, '<:encoding(UTF-8)', $self->path or return $self; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||
| 23 | |||||||||||
| 24 | 6 | my @pingbacks; | |||||||||
| 25 | 6 | ▶ | while (my $line = <$fh>) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 6 | chomp $line; | |||||||||
| 27 | |||||||||||
| 28 | 6 | my ($created, $source_uri) = split ' ' => $line; | |||||||||
| 29 | |||||||||||
| 30 | 6 | $created = Bootylicious::Timestamp->new(timestamp => $created); | |||||||||
| 31 | |||||||||||
| 32 | 6 | push @pingbacks, | |||||||||
| 33 | Bootylicious::Pingback->new( | ||||||||||
| 34 | created => $created, | ||||||||||
| 35 | source_uri => $source_uri | ||||||||||
| 36 | ); | ||||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 6 | $self->elements([@pingbacks]); | |||||||||
| 40 | |||||||||||
| 41 | 6 | return $self; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 12 | 1; | |||||||||