File Coverage

blib/lib/WWW/Ohloh/API/Analysis.pm
Criterion Covered Total %
statement 23 36 63.8
branch 0 2 0.0
condition n/a
subroutine 6 7 85.7
pod 1 1 100.0
total 30 46 65.2


line stmt bran cond sub pod time code
1             package WWW::Ohloh::API::Analysis;
2             our $AUTHORITY = 'cpan:YANICK';
3              
4 30     30   203996 use strict;
  30         67  
  30         1199  
5 30     30   163 use warnings;
  30         58  
  30         1900  
6              
7 30     30   183 use Carp;
  30         57  
  30         2001  
8 30     30   1178 use Object::InsideOut;
  30         75948  
  30         460  
9              
10             our $VERSION = '1.0_1';
11              
12             my @request_url_of : Field : Arg(request_url) : Get( request_url );
13             my @xml_of : Field : Arg(xml);
14              
15             my @id_of : Field : Get(id) : Set(_set_id);
16             my @project_id_of : Field : Get(project_id) : Set(_set_project_id);
17             my @updated_at_of : Field : Get(updated_at) : Set(_set_updated_at);
18             my @logged_at_of : Field : Get(logged_at) : Set(_set_logged_at);
19             my @min_month_of : Field : Get(min_month) : Set(_set_min_month);
20             my @max_month_of : Field : Get(max_month) : Set(_set_max_month);
21             my @twelve_month_contributor_count_of : Field :
22             Get(twelve_month_contributor_count) :
23             Set(_set_twelve_month_contributor_count);
24             my @total_code_lines_of : Field : Get(total_code_lines) :
25             Set(_set_total_code_lines);
26             my @main_language_id_of : Field : Get(main_language_id) :
27             Set(_set_main_language_id);
28             my @main_language_name_of : Field : Get(main_language_name) :
29             Set(_set_main_language_name);
30              
31             sub _init : Init {
32 0     0   0 my $self = shift;
33              
34 0 0       0 my $dom = $xml_of[$$self] or return;
35              
36 0         0 $self->_set_id( $dom->findvalue('id/text()') );
37 0         0 $self->_set_project_id( $dom->findvalue('project_id/text()') );
38 0         0 $self->_set_updated_at( $dom->findvalue('updated_at/text()') );
39 0         0 $self->_set_logged_at( $dom->findvalue('logged_at/text()') );
40 0         0 $self->_set_min_month( $dom->findvalue('min_month/text()') );
41 0         0 $self->_set_max_month( $dom->findvalue('max_month/text()') );
42 0         0 $self->_set_twelve_month_contributor_count(
43             $dom->findvalue('twelve_month_contributor_count/text()') );
44 0         0 $self->_set_total_code_lines(
45             $dom->findvalue('total_code_lines/text()') );
46 0         0 $self->_set_main_language_id(
47             $dom->findvalue('main_language_id/text()') );
48 0         0 $self->_set_main_language_name(
49             $dom->findvalue('main_language_name/text()') );
50              
51 0         0 return;
52 30     30   14188 }
  30         1411  
  30         283  
53              
54             sub as_xml {
55 1     1 1 2 my $self = shift;
56 1         1 my $xml;
57 1         4 my $w = XML::Writer->new( OUTPUT => \$xml );
58              
59 1         164 $w->startTag('analysis');
60 1         86 for my $attr (
61             qw/ id project_id
62             updated_at logged_at min_month
63             max_month twelve_month_contributor_count
64             total_code_lines
65             main_language_name
66             main_language_id
67             /
68             ) {
69 10         794 $w->dataElement( $attr, $self->$attr );
70             }
71              
72 1         69 $w->endTag;
73              
74 1         153 return $xml;
75             }
76              
77             *language = *main_language = *main_language_name;
78              
79             'end of WWW::Ohloh::API::Analysis';
80              
81             __END__