File Coverage

blib/lib/WWW/Ohloh/API/ActivityFact.pm
Criterion Covered Total %
statement 26 38 68.4
branch 0 2 0.0
condition n/a
subroutine 7 8 87.5
pod 1 1 100.0
total 34 49 69.3


line stmt bran cond sub pod time code
1             package WWW::Ohloh::API::ActivityFact;
2             our $AUTHORITY = 'cpan:YANICK';
3              
4 30     30   243442 use strict;
  30         64  
  30         1168  
5 30     30   146 use warnings;
  30         54  
  30         1510  
6              
7 30     30   154 use Carp;
  30         88  
  30         2156  
8 30     30   918 use Object::InsideOut;
  30         40557  
  30         256  
9 30     30   3557 use XML::LibXML;
  30         30953  
  30         242  
10              
11             our $VERSION = '1.0_1';
12              
13             my @request_url_of : Field : Arg(request_url) : Get( request_url );
14             my @xml_of : Field : Arg(xml);
15              
16             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             my @month_of : Field : Set(_set_month) : Get(month);
29             my @code_added_of : Field : Set(_set_code_added) : Get(code_added);
30             my @code_removed_of : Field : Set(_set_code_removed) : Get(code_removed);
31             my @comments_added_of : Field : Set(_set_comments_added) :
32             Get(comments_added);
33             my @comments_removed_of : Field : Set(_set_comments_removed) :
34             Get(comments_removed);
35             my @blanks_added_of : Field : Set(_set_blanks_added) : Get(blanks_added);
36             my @blanks_removed_of : Field : Set(_set_blanks_removed) :
37             Get(blanks_removed);
38             my @commits_of : Field : Set(_set_commits) : Get(commits);
39             my @contributors_of : Field : Set(_set_contributors) : Get(contributors);
40              
41             #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
42              
43             sub _init : Init {
44 0     0   0 my $self = shift;
45              
46 0 0       0 my $dom = $xml_of[$$self] or return;
47              
48 0         0 $self->_set_month( $dom->findvalue("month/text()") );
49 0         0 $self->_set_code_added( $dom->findvalue("code_added/text()") );
50 0         0 $self->_set_code_removed( $dom->findvalue("code_removed/text()") );
51 0         0 $self->_set_comments_added( $dom->findvalue("comments_added/text()") );
52 0         0 $self->_set_comments_removed(
53             $dom->findvalue("comments_removed/text()") );
54 0         0 $self->_set_blanks_added( $dom->findvalue("blanks_added/text()") );
55 0         0 $self->_set_blanks_removed( $dom->findvalue("blanks_removed/text()") );
56 0         0 $self->_set_commits( $dom->findvalue("commits/text()") );
57 0         0 $self->_set_contributors( $dom->findvalue("contributors/text()") );
58              
59 0         0 return;
60 30     30   15598 }
  30         64  
  30         215  
61              
62             #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63              
64             sub as_xml {
65 70     70 1 104 my $self = shift;
66 70         72 my $xml;
67 70         130 my $w = XML::Writer->new( OUTPUT => \$xml );
68              
69 70         6514 $w->startTag('activity_fact');
70              
71 70         2568 for my $e (@api_fields) {
72 630         45843 $w->dataElement( $e => $self->$e );
73             }
74              
75 70         5097 $w->endTag;
76              
77 70         4749 return $xml;
78             }
79              
80             #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
81              
82             'end of WWW::Ohloh::API::ActivityFact';
83              
84             __END__