| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WWW::Ohloh::API::Project; |
|
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:YANICK'; |
|
3
|
|
|
|
|
|
|
|
|
4
|
29
|
|
|
29
|
|
160616
|
use strict; |
|
|
29
|
|
|
|
|
76
|
|
|
|
29
|
|
|
|
|
1177
|
|
|
5
|
29
|
|
|
29
|
|
191
|
use warnings; |
|
|
29
|
|
|
|
|
50
|
|
|
|
29
|
|
|
|
|
1615
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
29
|
|
|
29
|
|
155
|
use Carp; |
|
|
29
|
|
|
|
|
57
|
|
|
|
29
|
|
|
|
|
2252
|
|
|
8
|
29
|
|
|
29
|
|
1159
|
use Object::InsideOut; |
|
|
29
|
|
|
|
|
47584
|
|
|
|
29
|
|
|
|
|
276
|
|
|
9
|
29
|
|
|
29
|
|
3771
|
use XML::LibXML; |
|
|
29
|
|
|
|
|
44464
|
|
|
|
29
|
|
|
|
|
475
|
|
|
10
|
29
|
|
|
29
|
|
6790
|
use WWW::Ohloh::API::Analysis; |
|
|
29
|
|
|
|
|
82
|
|
|
|
29
|
|
|
|
|
398
|
|
|
11
|
29
|
|
|
29
|
|
18490
|
use WWW::Ohloh::API::ContributorFact; |
|
|
29
|
|
|
|
|
120
|
|
|
|
29
|
|
|
|
|
212
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '1.0_1'; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my @request_url_of : Field : Arg(request_url) : Get( request_url ); |
|
16
|
|
|
|
|
|
|
my @ohloh_of : Field : Arg(ohloh) : Get( _ohloh ); |
|
17
|
|
|
|
|
|
|
my @xml_of : Field : Arg(xml); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my @id_of : Field : Get(id) : Set(_set_id); |
|
20
|
|
|
|
|
|
|
my @name_of : Field : Get(name) : Set(_set_name); |
|
21
|
|
|
|
|
|
|
my @created_at_of : Field : Get(created_at) : Set(_set_created_at); |
|
22
|
|
|
|
|
|
|
my @updated_at_of : Field : Get(updated_at) : Set(_set_updated_at); |
|
23
|
|
|
|
|
|
|
my @description_of : Field : Get(description) : Set(_set_description); |
|
24
|
|
|
|
|
|
|
my @homepage_url_of : Field : Get(homepage_url) : Set(_set_homepage_url); |
|
25
|
|
|
|
|
|
|
my @download_url_of : Field : Get(download_url) : Set(_set_download_url); |
|
26
|
|
|
|
|
|
|
my @irc_url_of : Field : Get(irc_url) : Set(_set_irc_url); |
|
27
|
|
|
|
|
|
|
my @stack_count_of : Field : Get(stack_count) : Set(_set_stack_count); |
|
28
|
|
|
|
|
|
|
my @average_rating_of : Field : Get(average_rating) : |
|
29
|
|
|
|
|
|
|
Set(_set_average_rating); |
|
30
|
|
|
|
|
|
|
my @rating_count_of : Field : Get(rating_count) : Set(_set_rating_count); |
|
31
|
|
|
|
|
|
|
my @analysis_id_of : Field : Get(analysis_id) : Set(_set_analysis_id); |
|
32
|
|
|
|
|
|
|
my @analysis_of : Field; |
|
33
|
|
|
|
|
|
|
my @facts_of : Field; |
|
34
|
|
|
|
|
|
|
my @factoids_of : Field; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my @contributors_of : Field; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub _init : Init { |
|
39
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
|
40
|
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
|
|
0
|
my $dom = $xml_of[$$self] or return; |
|
42
|
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
0
|
$self->_set_id( $dom->findvalue('id/text()') ); |
|
44
|
0
|
|
|
|
|
0
|
$self->_set_name( $dom->findvalue('name/text()') ); |
|
45
|
0
|
|
|
|
|
0
|
$self->_set_created_at( $dom->findvalue('created_at/text()') ); |
|
46
|
0
|
|
|
|
|
0
|
$self->_set_updated_at( $dom->findvalue('updated_at/text()') ); |
|
47
|
0
|
|
|
|
|
0
|
$self->_set_description( $dom->findvalue('description/text()') ); |
|
48
|
0
|
|
|
|
|
0
|
$self->_set_homepage_url( $dom->findvalue('homepage_url/text()') ); |
|
49
|
0
|
|
|
|
|
0
|
$self->_set_download_url( $dom->findvalue('download_url/text()') ); |
|
50
|
0
|
|
|
|
|
0
|
$self->_set_irc_url( $dom->findvalue('irc_url/text()') ); |
|
51
|
0
|
|
|
|
|
0
|
$self->_set_stack_count( $dom->findvalue('stack_count/text()') ); |
|
52
|
0
|
|
|
|
|
0
|
$self->_set_average_rating( $dom->findvalue('average_rating/text()') ); |
|
53
|
0
|
|
|
|
|
0
|
$self->_set_rating_count( $dom->findvalue('rating_count/text()') ); |
|
54
|
0
|
|
|
|
|
0
|
$self->_set_analysis_id( $dom->findvalue('analysis_id/text()') ); |
|
55
|
|
|
|
|
|
|
|
|
56
|
0
|
0
|
|
|
|
0
|
if ( my ($n) = $dom->findnodes('analysis[1]') ) { |
|
57
|
0
|
|
|
|
|
0
|
$analysis_of[$$self] = WWW::Ohloh::API::Analysis->new( xml => $n ); |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
0
|
return; |
|
61
|
29
|
|
|
29
|
|
16561
|
} |
|
|
29
|
|
|
|
|
70
|
|
|
|
29
|
|
|
|
|
193
|
|
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub analysis { |
|
66
|
2
|
|
|
2
|
1
|
10045
|
my $self = shift; |
|
67
|
2
|
|
|
|
|
3
|
my $id = shift; |
|
68
|
|
|
|
|
|
|
|
|
69
|
2
|
50
|
33
|
|
|
12
|
if ( $id or not $analysis_of[$$self] ) { |
|
70
|
0
|
|
|
|
|
0
|
$analysis_of[$$self] = |
|
71
|
|
|
|
|
|
|
$ohloh_of[$$self]->fetch_analysis( $self->id, $id ); |
|
72
|
0
|
|
|
|
|
0
|
$analysis_id_of[$$self] = $analysis_of[$$self]->id; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
2
|
|
|
|
|
7
|
return $analysis_of[$$self]; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub activity_facts { |
|
81
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
|
82
|
0
|
|
|
|
|
0
|
my $id = shift; |
|
83
|
|
|
|
|
|
|
|
|
84
|
0
|
0
|
0
|
|
|
0
|
if ( $id or not $facts_of[$$self] ) { |
|
85
|
0
|
|
0
|
|
|
0
|
$facts_of[$$self] = |
|
86
|
|
|
|
|
|
|
$ohloh_of[$$self]->fetch_activity_facts( $self->id, |
|
87
|
|
|
|
|
|
|
$id || $self->analysis_id || 'latest' ); |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
0
|
return $facts_of[$$self]; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub as_xml { |
|
96
|
1
|
|
|
1
|
1
|
42
|
my $self = shift; |
|
97
|
1
|
|
|
|
|
1
|
my $xml; |
|
98
|
1
|
|
|
|
|
11
|
my $w = XML::Writer->new( OUTPUT => \$xml ); |
|
99
|
|
|
|
|
|
|
|
|
100
|
1
|
|
|
|
|
210
|
$w->startTag('project'); |
|
101
|
1
|
|
|
|
|
80
|
for my $attr ( |
|
102
|
|
|
|
|
|
|
qw/ id name created_at updated_at |
|
103
|
|
|
|
|
|
|
description homepage_url |
|
104
|
|
|
|
|
|
|
download_url irc_url stack_count |
|
105
|
|
|
|
|
|
|
average_rating rating_count |
|
106
|
|
|
|
|
|
|
analysis_id / |
|
107
|
|
|
|
|
|
|
) { |
|
108
|
12
|
|
|
|
|
1063
|
$w->dataElement( $attr, $self->$attr ); |
|
109
|
|
|
|
|
|
|
} |
|
110
|
1
|
50
|
|
|
|
71
|
$xml .= $self->analysis->as_xml if $analysis_of[$$self]; |
|
111
|
|
|
|
|
|
|
|
|
112
|
1
|
50
|
|
|
|
8
|
if ( my $factoids = $factoids_of[$$self] ) { |
|
113
|
0
|
|
|
|
|
0
|
$xml .= ''; |
|
114
|
0
|
|
|
|
|
0
|
$xml .= $_->as_xml for @$factoids; |
|
115
|
0
|
|
|
|
|
0
|
$xml .= ''; |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
|
|
118
|
1
|
|
|
|
|
3
|
$w->endTag; |
|
119
|
|
|
|
|
|
|
|
|
120
|
1
|
|
|
|
|
78
|
return $xml; |
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub contributors { |
|
126
|
1
|
|
|
1
|
0
|
66
|
my $self = shift; |
|
127
|
|
|
|
|
|
|
|
|
128
|
1
|
50
|
|
|
|
6
|
unless ( $contributors_of[$$self] ) { |
|
129
|
1
|
|
|
|
|
67
|
my ( $url, $xml ) = $self->_ohloh->_query_server( |
|
130
|
|
|
|
|
|
|
'projects/' . $self->id . '/contributors.xml' ); |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
$contributors_of[$$self] = [ |
|
133
|
|
|
|
|
|
|
map { |
|
134
|
1
|
|
|
|
|
63
|
WWW::Ohloh::API::ContributorFact->new( |
|
|
1
|
|
|
|
|
65
|
|
|
135
|
|
|
|
|
|
|
request_url => $url, |
|
136
|
|
|
|
|
|
|
xml => $_, |
|
137
|
|
|
|
|
|
|
ohloh => $self->_ohloh |
|
138
|
|
|
|
|
|
|
) |
|
139
|
|
|
|
|
|
|
} $xml->findnodes('//contributor_fact') ]; |
|
140
|
|
|
|
|
|
|
} |
|
141
|
|
|
|
|
|
|
|
|
142
|
1
|
|
|
|
|
150
|
return @{ $contributors_of[$$self] }; |
|
|
1
|
|
|
|
|
25
|
|
|
143
|
|
|
|
|
|
|
} |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub factoids { |
|
148
|
2
|
|
|
2
|
1
|
14050
|
my $self = shift; |
|
149
|
|
|
|
|
|
|
|
|
150
|
2
|
100
|
|
|
|
12
|
unless ( defined $factoids_of[$$self] ) { |
|
151
|
1
|
|
|
|
|
47
|
$factoids_of[$$self] = |
|
152
|
|
|
|
|
|
|
[ $ohloh_of[$$self]->fetch_factoids( $self->id ) ]; |
|
153
|
|
|
|
|
|
|
} |
|
154
|
|
|
|
|
|
|
|
|
155
|
2
|
|
|
|
|
66
|
return @{ $factoids_of[$$self] }; |
|
|
2
|
|
|
|
|
8
|
|
|
156
|
|
|
|
|
|
|
} |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
'end of WWW::Ohloh::API::Project'; |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
__END__ |