API/Message/Tag.pm

filter: Statementstmt 82.0% 32 / 39 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 72.7% 8 / 11 Podpod 25.0% 1 / 4 totaltotal 75.0% 42 / 56 CC 2 SCAR 3.5
CC
2
Cov
80%
load_xml
2.0
as_xml
2.0
is_project
2.0
CRAP 1.4
« API/Analysis.pm ↑ Summary API/Factoid.pm »
1 package WWW::Ohloh::API::Message::Tag;
2 6 our $AUTHORITY = 'cpan:YANICK';
3  
4 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 6 ▶use Object::InsideOut qw/
Subroutine BEGIN: called CC=1 SCAR=0.0
8 WWW::Ohloh::API::Role::Fetchable
9 WWW::Ohloh::API::Role::LoadXML
10 6 /;
11  
12 6 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 6 ▶use XML::LibXML;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 6 ▶use List::MoreUtils qw/ any /;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 6 our $VERSION = '1.0_1';
18  
19 6 my @type_of : Field : Set(set_type) : Get(type);
20 6 my @uri_of : Field : Set(set_uri) : Get(uri);
21 6 my @content_of : Field : Set(set_content) : Get(content);
22  
23 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24  
25 1 ▶sub load_xml {
Subroutine load_xml: called CC=2 SCAR=7.0
Pod undocumented
26 1 my $self = shift;
27 1 my $dom = shift;
28  
29 1 my $type = $dom->nodeName;
30 die "tag is of type $type, should be 'project' or 'account'"
31 1 ▶ unless any { $_ eq $type } qw/ project account /;
Subroutine __ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
BranchTrueFalseTotal
unless &any(sub { $_ eq $type; } , "project", "account") 0 1 1
32  
33 1 $self->set_type($type);
34 1 $self->set_uri( $dom->getAttribute('uri') );
35 1 $self->set_content( $dom->findvalue('text()') );
36 }
37  
38 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
39  
40 0 ▶sub as_xml {
Subroutine as_xml: not called CC=1 SCAR=6.9
Pod documented
41 0 my $self = shift;
42 0 my $xml;
43 0 my $w = XML::Writer->new( OUTPUT => \$xml );
44  
45 0 $w->dataElement( $self->type, $self->content, uri => $self->uri );
46  
47 0 return $xml;
48 }
49  
50 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
51  
52 0 ▶sub is_project {
Subroutine is_project: not called CC=1 SCAR=6.9
Pod undocumented
53 0 return $_[0]->type eq 'project';
54 }
55  
56 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
57  
58 0 ▶sub is_account {
Subroutine is_account: not called CC=1 SCAR=6.9
Pod undocumented
59 0 return $_[0]->type eq 'account';
60 }
61  
62 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63  
64 6 'end of WWW::Ohloh::API::Message::Tag';
65  
66 __END__
« API/Analysis.pm ↑ Summary API/Factoid.pm »