| 1 | package WWW::Ohloh::API::KudoScore; | ||||||||||
| 2 | 33 | our $AUTHORITY = 'cpan:YANICK'; | |||||||||
| 3 | |||||||||||
| 4 | 33 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 33 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 33 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 33 | ▶ | use Object::InsideOut; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 33 | ▶ | use XML::LibXML; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 33 | ▶ | use XML::Writer; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 33 | our $VERSION = '1.0_1'; | |||||||||
| 13 | |||||||||||
| 14 | 33 | my @xml_of : Field : Arg(xml); | |||||||||
| 15 | |||||||||||
| 16 | 33 | my @creation_time_of : Field : Get(created_at) : Set(_set_created_at); | |||||||||
| 17 | 33 | my @kudo_rank_of : Field : Get(kudo_rank) : Set(_set_kudo_rank); | |||||||||
| 18 | 33 | my @position_of : Field : Get(position) : Set(_set_position); | |||||||||
| 19 | 33 | my @max_position_of : Field : Get(max_position) : Set(_set_max_position); | |||||||||
| 20 | 33 | my @position_delta_of : Field : Get(position_delta) : | |||||||||
| 21 | Set(_set_position_delta); | ||||||||||
| 22 | |||||||||||
| 23 | 9 | ▶ | sub _init : Init { | ||||||||
|
Subroutine
_init: called CC=2 SCAR=7.0
| |||||||||||
| 24 | 9 | my $self = shift; | |||||||||
| 25 | |||||||||||
| 26 | 9 | ▶ | my $dom = $xml_of[$$self] or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | |||||||||||
| 28 | 9 | $self->_set_created_at( $dom->findvalue('created_at/text()') ); | |||||||||
| 29 | 9 | $self->_set_kudo_rank( $dom->findvalue('kudo_rank/text()') ); | |||||||||
| 30 | 9 | $self->_set_position( $dom->findvalue('position/text()') ); | |||||||||
| 31 | 9 | $self->_set_max_position( $dom->findvalue('max_position/text()') ); | |||||||||
| 32 | 9 | $self->_set_position_delta( $dom->findvalue('position_delta/text()') ); | |||||||||
| 33 | 33 | ▶ | } | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 34 | |||||||||||
| 35 | # aliases | ||||||||||
| 36 | 33 | *rank = *kudo_rank; | |||||||||
| 37 | |||||||||||
| 38 | 3 | ▶ | sub as_xml { | ||||||||
|
Subroutine
as_xml: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 39 | 3 | my $self = shift; | |||||||||
| 40 | 3 | my $xml; | |||||||||
| 41 | 3 | my $w = XML::Writer->new( OUTPUT => \$xml ); | |||||||||
| 42 | |||||||||||
| 43 | 3 | $w->startTag('kudo_score'); | |||||||||
| 44 | 3 | $w->dataElement( 'created_at', $self->created_at ); | |||||||||
| 45 | 3 | $w->dataElement( 'kudo_rank', $self->kudo_rank ); | |||||||||
| 46 | 3 | $w->dataElement( 'position', $self->position ); | |||||||||
| 47 | 3 | $w->dataElement( 'max_position', $self->max_position ); | |||||||||
| 48 | 3 | $w->dataElement( 'position_delta', $self->position_delta ); | |||||||||
| 49 | 3 | $w->endTag; | |||||||||
| 50 | |||||||||||
| 51 | 3 | return $xml; | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 33 | 'end of WWW::Ohloh::API::KudoScore'; | |||||||||
| 55 | |||||||||||
| 56 | __END__ | ||||||||||