| 1 | # ABSTRACT: Class to represent the links returned from the SEOmoz API | ||||||||||||
| 2 | package WWW::SEOmoz::Links; | ||||||||||||
| 3 | |||||||||||||
| 4 | 3 | ▶ | use Moose; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 3 | ▶ | use namespace::autoclean; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | 3 | ▶ | use Carp qw( croak ); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | 3 | ▶ | use WWW::SEOmoz::Link; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | |||||||||||||
| 11 | 3 | our $VERSION = '0.03'; # VERSION | |||||||||||
| 12 | |||||||||||||
| 13 | |||||||||||||
| 14 | has 'links' => ( | ||||||||||||
| 15 | isa => 'ArrayRef[WWW::SEOmoz::Link]', | ||||||||||||
| 16 | is => 'rw', | ||||||||||||
| 17 | required => 1, | ||||||||||||
| 18 | 0 | ▶ | default => sub { [] }, | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 19 | 3 | traits => ['Array'], | |||||||||||
| 20 | handles => { | ||||||||||||
| 21 | add_link => 'push', | ||||||||||||
| 22 | all_links => 'elements', | ||||||||||||
| 23 | number_of_links => 'count', | ||||||||||||
| 24 | }, | ||||||||||||
| 25 | |||||||||||||
| 26 | ); | ||||||||||||
| 27 | |||||||||||||
| 28 | 3 | __PACKAGE__->meta->make_immutable; | |||||||||||
| 29 | |||||||||||||
| 30 | |||||||||||||
| 31 | 0 | ▶ | sub new_from_data { | ||||||||||
|
Subroutine
new_from_data: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||
| 32 | 0 | my $class = shift; | |||||||||||
| 33 | 0 | ▶ | my $data = shift || croak 'Requires an array ref of data from the API'; | ||||||||||
|
Condition0%0/2
shift() || croak('Requires an array ref of data from the API')
MC/DC0%0/1
shift() || croak('Requires an array ref of data from the API')
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||
| 34 | |||||||||||||
| 35 | 0 | my $self = $class->new; | |||||||||||
| 36 | 0 | foreach ( @{$data} ) { | |||||||||||
| 37 | 0 | $self->add_link( WWW::SEOmoz::Link->new_from_data( $_ ) ); | |||||||||||
| 38 | } | ||||||||||||
| 39 | |||||||||||||
| 40 | 0 | return $self; | |||||||||||
| 41 | } | ||||||||||||
| 42 | |||||||||||||
| 43 | |||||||||||||
| 44 | 3 | 1; | |||||||||||
| 45 | |||||||||||||
| 46 | __END__ | ||||||||||||