Coveralia/Result/Artist.pm

filter: Statementstmt 64.0% 32 / 50 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 81.8% 9 / 11 Podpod 100% 2 / 2 totaltotal 58.9% 43 / 73 CC 4 SCAR 14.0
CC
4
Cov
56%
__ANON__
12.0
albums
6.0
BEGIN
1.0
CRAP 4.1
« Coveralia.pm ↑ Summary Coveralia/Artists.pm »
1 package WWW::Search::Coveralia::Result::Artist;
2  
3 1 ▶use 5.014000;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use parent qw/WWW::SearchResult/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 our $VERSION = '0.001';
9  
10 1 ▶use HTML::TreeBuilder;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use List::MoreUtils qw/pairwise/;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use WWW::Search;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use WWW::Search::Coveralia::Result::Album;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 44 ▶sub new{
Subroutine new: called CC=1 SCAR=0.0
Pod documented
16 44 my ($class, $obj, $id, $name) = @_;
17 44 my $self = $class->SUPER::new;
18 44 $self->{id} = $id;
19 44 $self->{obj} = $obj;
20  
21 44 $self->title($name);
22 44 $self->add_url("http//www.coveralia.com/autores/$id.php");
23 44 $self
24 }
25  
26 0 ▶sub albums{
Subroutine albums: not called CC=2 SCAR=17.9
Pod documented
27 0 my ($self) = @_;
28 0 ▶ unless ($self->{albums}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"albums"}) 0 0 0
29 0 my $id = $self->{id};
30 0 my $tree = HTML::TreeBuilder->new_from_url("http://www.coveralia.com/caratulas-de/$id.php");
31 0 my @albums = $tree->look_down(class => 'artista');
32 0 my @cover_lists = $tree->look_down(class => qr/\blista_normal\b/);
33  
34 0 ▶ $self->{albums} = [pairwise {
Subroutine __ANON__: not called CC=3 SCAR=24.8
35 0 my ($album, $cover_list) = ($a, $b);
36 0 ▶ my ($year) = $album->find('span') && ($album->find('span')->as_text =~ /^\((\d+)/);
Condition0%0/3
$album->find('span') && $album->find('span')->as_text =~ /^\((\d+)/u
!ll&&!rl&&r
000
MC/DC0%0/2
$album->find('span') && $album->find('span')->as_text =~ /^\((\d+)/u
$album->find('span') $album->find('span')->as_text =~ /^\((\d+)/u
Truth table0%0/3
A && B
A= $album->find('span')B= $album->find('span')->as_text =~ /^\((\d+)/u
ABresult
0X0
100
111
37 0 ▶ $year = $year || undef;
Condition0%0/2
$year || undef
l!l
00
MC/DC0%0/1
$year || undef
$year
Truth table0%0/2
A
A= $year
Aresult
11
00
38 0 $album = $album->find('a');
39 0 my $title = $album->as_text;
40 0 my $url = $self->{obj}->absurl('', $album->attr('href'));
41 0 my %covers = map {lc $_->as_text => $self->{obj}->absurl('', $_->attr('href'))} $cover_list->find('a');
42 0 WWW::Search::Coveralia::Result::Album->new($self->{obj}, $url, $title, $self->title, $year, \%covers);
43 0 } @albums, @cover_lists];
44 }
45  
46 0 @{$self->{albums}}
47 }
48  
49 1 1;
50 __END__
« Coveralia.pm ↑ Summary Coveralia/Artists.pm »