| 1 | package WWW::Ohloh::API::ContributorLanguageFact; | ||||||||||
| 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 | |||||||||||
| 11 | 29 | our $VERSION = '1.0_1'; | |||||||||
| 12 | |||||||||||
| 13 | 29 | my @ohloh_of : Field : Arg(ohloh) : Get(_ohloh); | |||||||||
| 14 | 29 | my @request_url_of : Field : Arg(request_url) : Get( request_url ); | |||||||||
| 15 | 29 | my @xml_of : Field : Arg(xml); | |||||||||
| 16 | |||||||||||
| 17 | 29 | my @api_fields = qw/ | |||||||||
| 18 | analysis_id | ||||||||||
| 19 | contributor_id | ||||||||||
| 20 | contributor_name | ||||||||||
| 21 | language_id | ||||||||||
| 22 | language_nice_name | ||||||||||
| 23 | comment_ratio | ||||||||||
| 24 | man_months | ||||||||||
| 25 | commits | ||||||||||
| 26 | median_commits | ||||||||||
| 27 | /; | ||||||||||
| 28 | |||||||||||
| 29 | 29 | my @analysis_id_of : Field : Set(_set_analysis_id) : Get(analysis_id); | |||||||||
| 30 | 29 | my @contributor_id_of : Field : Set(_set_contributor_id) : | |||||||||
| 31 | Get(contributor_id); | ||||||||||
| 32 | 29 | my @contributor_name_of : Field : Set(_set_contributor_name) : | |||||||||
| 33 | Get(contributor_name); | ||||||||||
| 34 | 29 | my @language_id_of : Field : Set(_set_language_id) : Get(language_id); | |||||||||
| 35 | 29 | my @language_nice_name_of : Field : Set(_set_language_nice_name) : | |||||||||
| 36 | Get(language_nice_name); | ||||||||||
| 37 | 29 | my @comment_ratio_of : Field : Set(_set_comment_ratio) : Get(comment_ratio); | |||||||||
| 38 | 29 | my @man_months_of : Field : Set(_set_man_months) : Get(man_months); | |||||||||
| 39 | 29 | my @commits_of : Field : Set(_set_commits) : Get(commits); | |||||||||
| 40 | 29 | my @median_commits_of : Field : Set(_set_median_commits) : | |||||||||
| 41 | Get(median_commits); | ||||||||||
| 42 | |||||||||||
| 43 | #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||||||||||
| 44 | |||||||||||
| 45 | 7 | ▶ | sub _init : Init { | ||||||||
|
Subroutine
_init: called CC=2 SCAR=6.9
| |||||||||||
| 46 | 7 | my $self = shift; | |||||||||
| 47 | |||||||||||
| 48 | 7 | ▶ | my $dom = $xml_of[$$self] or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | |||||||||||
| 50 | 7 | $self->_set_analysis_id( $dom->findvalue("analysis_id/text()") ); | |||||||||
| 51 | 7 | $self->_set_contributor_id( $dom->findvalue("contributor_id/text()") ); | |||||||||
| 52 | 7 | $self->_set_contributor_name( | |||||||||
| 53 | $dom->findvalue("contributor_name/text()") ); | ||||||||||
| 54 | 7 | $self->_set_language_id( $dom->findvalue("language_id/text()") ); | |||||||||
| 55 | 7 | $self->_set_language_nice_name( | |||||||||
| 56 | $dom->findvalue("language_nice_name/text()") ); | ||||||||||
| 57 | 7 | $self->_set_comment_ratio( $dom->findvalue("comment_ratio/text()") ); | |||||||||
| 58 | 7 | $self->_set_man_months( $dom->findvalue("man_months/text()") ); | |||||||||
| 59 | 7 | $self->_set_commits( $dom->findvalue("commits/text()") ); | |||||||||
| 60 | 7 | $self->_set_median_commits( $dom->findvalue("median_commits/text()") ); | |||||||||
| 61 | |||||||||||
| 62 | 29 | ▶ | } | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 63 | |||||||||||
| 64 | 1 | ▶ | sub as_xml { | ||||||||
|
Subroutine
as_xml: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 65 | 1 | my $self = shift; | |||||||||
| 66 | 1 | my $xml; | |||||||||
| 67 | 1 | my $w = XML::Writer->new( OUTPUT => \$xml ); | |||||||||
| 68 | |||||||||||
| 69 | 1 | $w->startTag('contributor_language_fact'); | |||||||||
| 70 | |||||||||||
| 71 | 1 | for my $attr (@api_fields) { | |||||||||
| 72 | 9 | $w->dataElement( $attr => $self->$attr ); | |||||||||
| 73 | } | ||||||||||
| 74 | |||||||||||
| 75 | 1 | $w->endTag; | |||||||||
| 76 | |||||||||||
| 77 | 1 | return $xml; | |||||||||
| 78 | } | ||||||||||
| 79 | |||||||||||
| 80 | 29 | 'end of WWW::Ohloh::API::ContributorLanguageFact'; | |||||||||
| 81 | |||||||||||
| 82 | __END__ | ||||||||||