API/SizeFact.pm

filter: Statementstmt 100% 56 / 56 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 12 / 12 Podpod 100% 2 / 2 totaltotal 98.6% 71 / 72 CC 4 SCAR 4.3
CC
4
Cov
98%
_init
3.0
as_xml
2.0
BEGIN
1.0
CRAP 1.5
« API/Role/Fetchable.pm ↑ Summary API/Analysis.pm »
1 package WWW::Ohloh::API::SizeFact;
2 29 our $AUTHORITY = 'cpan:YANICK';
3  
4 29 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 29 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 29 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 29 ▶use Object::InsideOut;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 29 ▶use XML::LibXML;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 29 ▶use WWW::Ohloh::API::KudoScore;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 29 our $VERSION = '1.0_1';
13  
14 29 my @ohloh_of : Field : Arg(ohloh) : Get(_ohloh);
15 29 my @request_url_of : Field : Arg(request_url) : Get( request_url );
16 29 my @xml_of : Field : Arg(xml);
17  
18 29 my @api_fields = qw/
19 month
20 code
21 comments
22 blanks
23 comment_ratio
24 commits
25 man_months
26 /;
27  
28 29 my @month_of : Field : Set(_set_month) : Get(month);
29 29 my @code_of : Field : Set(_set_code) : Get(code);
30 29 my @comments_of : Field : Set(_set_comments) : Get(comments);
31 29 my @blanks_of : Field : Set(_set_blanks) : Get(blanks);
32 29 my @comment_ratio_of : Field : Set(_set_comment_ratio) : Get(comment_ratio);
33 29 my @commits_of : Field : Set(_set_commits) : Get(commits);
34 29 my @man_months_of : Field : Set(_set_man_months) : Get(man_months);
35  
36 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37  
38 73 ▶sub _init : Init {
Subroutine _init: called CC=3 SCAR=11.1
39 73 my $self = shift;
40  
41 73 ▶ my $dom = $xml_of[$$self] or return;
Branch: 1 branch
BranchTrueFalseTotal
my $dom = $xml_of[$$self] or return 73 0 73
42  
43 73 for my $f (@api_fields) {
44 511 my $m = "_set_$f";
45  
46 511 $self->$m( $dom->findvalue("$f/text()") );
47 }
48  
49 29 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
50  
51 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
52  
53 1 ▶sub _overload_array_ref : Arrayify {
Subroutine _overload_array_ref: called CC=1 SCAR=0.0
54 1 my $self = shift;
55  
56 1 return [ $self->stats ];
57 29 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
58  
59 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60  
61 2 ▶sub stats {
Subroutine stats: called CC=1 SCAR=0.0
Pod documented
62 2 my $self = shift;
63  
64 2 return map { $self->$_ } qw/
65 month
66 commits
67 code
68 blanks
69 comments
70 comment_ratio
71 man_months
72 /;
73 }
74  
75 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
76  
77 1 ▶sub as_xml {
Subroutine as_xml: called CC=2 SCAR=6.9
Pod documented
78 1 my $self = shift;
79 1 my $xml;
80 1 my $w = XML::Writer->new( OUTPUT => \$xml );
81  
82 1 $w->startTag('size_fact');
83  
84 1 for my $attr (@api_fields) {
85 7 $w->dataElement( $attr => $self->$attr );
86 }
87  
88 1 $w->endTag;
89  
90 1 return $xml;
91 }
92  
93 29 'end of WWW::Ohloh::API::SizeFact';
94  
95 __END__
« API/Role/Fetchable.pm ↑ Summary API/Analysis.pm »