API/ActivityFact.pm

filter: Statementstmt 100% 53 / 53 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 1 / 1 totaltotal 98.4% 63 / 64 CC 3 SCAR 3.4
CC
3
Cov
98%
_init
2.0
as_xml
2.0
BEGIN
1.0
CRAP 1.4
« API/Factoid.pm ↑ Summary API/ContributorLanguageFact.pm »
1 package WWW::Ohloh::API::ActivityFact;
2 30 our $AUTHORITY = 'cpan:YANICK';
3  
4 30 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 30 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 30 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 30 ▶use Object::InsideOut;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 30 ▶use XML::LibXML;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 30 our $VERSION = '1.0_1';
12  
13 30 my @request_url_of : Field : Arg(request_url) : Get( request_url );
14 30 my @xml_of : Field : Arg(xml);
15  
16 30 my @api_fields = qw/
17 month
18 code_added
19 code_removed
20 comments_added
21 comments_removed
22 blanks_added
23 blanks_removed
24 commits
25 contributors
26 /;
27  
28 30 my @month_of : Field : Set(_set_month) : Get(month);
29 30 my @code_added_of : Field : Set(_set_code_added) : Get(code_added);
30 30 my @code_removed_of : Field : Set(_set_code_removed) : Get(code_removed);
31 30 my @comments_added_of : Field : Set(_set_comments_added) :
32 Get(comments_added);
33 30 my @comments_removed_of : Field : Set(_set_comments_removed) :
34 Get(comments_removed);
35 30 my @blanks_added_of : Field : Set(_set_blanks_added) : Get(blanks_added);
36 30 my @blanks_removed_of : Field : Set(_set_blanks_removed) :
37 Get(blanks_removed);
38 30 my @commits_of : Field : Set(_set_commits) : Get(commits);
39 30 my @contributors_of : Field : Set(_set_contributors) : Get(contributors);
40  
41 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
42  
43 70 ▶sub _init : Init {
Subroutine _init: called CC=2 SCAR=6.9
44 70 my $self = shift;
45  
46 70 ▶ my $dom = $xml_of[$$self] or return;
Branch: 1 branch
BranchTrueFalseTotal
my $dom = $xml_of[$$self] or return 70 0 70
47  
48 70 $self->_set_month( $dom->findvalue("month/text()") );
49 70 $self->_set_code_added( $dom->findvalue("code_added/text()") );
50 70 $self->_set_code_removed( $dom->findvalue("code_removed/text()") );
51 70 $self->_set_comments_added( $dom->findvalue("comments_added/text()") );
52 70 $self->_set_comments_removed(
53 $dom->findvalue("comments_removed/text()") );
54 70 $self->_set_blanks_added( $dom->findvalue("blanks_added/text()") );
55 70 $self->_set_blanks_removed( $dom->findvalue("blanks_removed/text()") );
56 70 $self->_set_commits( $dom->findvalue("commits/text()") );
57 70 $self->_set_contributors( $dom->findvalue("contributors/text()") );
58  
59 70 return;
60 30 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
61  
62 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63  
64 70 ▶sub as_xml {
Subroutine as_xml: called CC=2 SCAR=6.9
Pod documented
65 70 my $self = shift;
66 70 my $xml;
67 70 my $w = XML::Writer->new( OUTPUT => \$xml );
68  
69 70 $w->startTag('activity_fact');
70  
71 70 for my $e (@api_fields) {
72 630 $w->dataElement( $e => $self->$e );
73 }
74  
75 70 $w->endTag;
76  
77 70 return $xml;
78 }
79  
80 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
81  
82 30 'end of WWW::Ohloh::API::ActivityFact';
83  
84 __END__
« API/Factoid.pm ↑ Summary API/ContributorLanguageFact.pm »