Mapper/Persona/Website.pm

filter: Statementstmt 83.8% 26 / 31 Branchbran 25.0% 1 / 4 Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 6 / 8 Podpod 100% 2 / 2 totaltotal 72.5% 37 / 51 CC 5 SCAR 9.6
CC
5
Cov
74%
feeds
6.0
_normalise_url
3.1
_init
2.0
CRAP 2.6
« Mapper/Persona/Generic.pm ↑ Summary Mapper/Persona/Email.pm »
1 package Net::Social::Mapper::Persona::Website;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use base qw(Net::Social::Mapper::Persona);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use Feed::Find;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =head1 NAME
9  
10 Net::Social::Mapper::Persona::Website - the persona for a website
11  
12 =head2 SYNOPSIS
13  
14 See C<Net::Social::Mapper>
15  
16 =cut
17 2 ▶sub _init {
Subroutine _init: called CC=2 SCAR=7.0
18 2 my $self = shift;
19 2 $self->{service} = 'website';
20 2 $self->{name} = 'Website';
21 2 ▶ my $url = $self->_normalise_url($self->{user}) || return undef;
Condition50%1/2
$self->_normalise_url($self->{'user'}) || (return undef)
l!l
20
MC/DC0%0/1
$self->_normalise_url($self->{'user'}) || (return undef)
$self->_normalise_url($self->{'user'})
Truth table50%1/2
A
A= $self->_normalise_url($self->{'user'})
Aresult
11
00
22 2 $self->{user} = $url->as_string;
23 0 $self->{user} =~ s/\%([A-Fa-f0-9]{2})/pack('C', hex($1))/seg;
24 2 $self->{homepage} = $self->{user};
25 2 $self->{domain} = $url->authority;
26 2 return $self;
27 }
28  
29 =head2 feeds
30  
31 Get the feeds for this website.
32  
33 =cut
34 0 ▶sub feeds {
Subroutine feeds: not called CC=2 SCAR=17.9
Pod documented
35 0 my $self = shift;
36 0 ▶ $self->{feeds} = [ $self->mapper->_get_feeds($self->{homepage}) ] unless defined $self->{feeds};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"feeds"} 0 0 0
37 0 return $self->SUPER::feeds();
38 }
39  
40 2 ▶sub _normalise_url {
Subroutine _normalise_url: called CC=3 SCAR=11.4
41 2 my $self = shift;
42 2 ▶ my $url = shift || return;
Condition50%1/2
shift() || (return)
l!l
20
MC/DC0%0/1
shift() || (return)
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
43 2 ▶ $url = "http://$url" unless $url =~ m![a-z]+:\/\/!i;
Branch: 1 branch
BranchTrueFalseTotal
unless $url =~ m[[a-z]+:\/\/]i 0 2 2
44 2 $url = URI->new($url);
45 }
46  
47 =head2 persona_name
48  
49 The short canonical name for this persona
50  
51 =cut
52 0 ▶sub persona_name { shift->_do('user', @_) }
Subroutine persona_name: not called CC=1 SCAR=6.9
Pod documented
53 4 1;
54  
« Mapper/Persona/Generic.pm ↑ Summary Mapper/Persona/Email.pm »