NicoVideo/Content/ThumbInfo.pm

filter: Statementstmt 59.4% 22 / 37 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 66.6% 6 / 9 Podpod 0.0% 0 / 3 totaltotal 43.7% 28 / 64 CC 8 SCAR 36.0
CC
8
Cov
45%
parse
72.0
is_failure
2.0
members
2.0
CRAP 36.6
« NicoVideo.pm ↑ Summary NicoVideo/URL.pm »
1 package Net::NicoVideo::Content::ThumbInfo;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 $VERSION = '0.28';
7  
8 1 ▶use base qw(Net::NicoVideo::Content Class::Accessor::Fast);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use XML::TreePP;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use vars qw(@Members);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 @Members = qw(
13 video_id
14 title
15 description
16 thumbnail_url
17 first_retrieve
18 length
19 movie_type
20 size_high
21 size_low
22 view_counter
23 comment_num
24 mylist_counter
25 last_res_body
26 watch_url
27 thumb_type
28 embeddable
29 no_live_play
30 tags
31 user_id
32 );
33  
34 1 __PACKAGE__->mk_accessors(@Members);
35  
36  
37 # DEPRECATED
38 0 ▶sub is_failure {
Subroutine is_failure: not called CC=1 SCAR=6.9
Pod undocumented
39 0 $_[0]->is_error;
40 }
41  
42 0 ▶sub members { # implement
Subroutine members: not called CC=1 SCAR=6.9
Pod undocumented
43 0 my @copy = @Members;
44 0 @copy;
45 }
46  
47 0 ▶sub parse { # implement
Subroutine parse: not called CC=8 SCAR=42.8
Pod undocumented
48 0 my $self = shift;
49 0 ▶ $self->load($_[0]) if( defined $_[0] );
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[0] 0 0 0
50  
51 0 my $tpp = XML::TreePP->new( force_array => 'tags' )
52 ->parse($self->_decoded_content);
53  
54 0 ▶ my $params = $tpp->{nicovideo_thumb_response} || {};
Condition0%0/2
$tpp->{'nicovideo_thumb_response'} || {}
l!l
00
MC/DC0%0/1
$tpp->{'nicovideo_thumb_response'} || {}
$tpp->{'nicovideo_thumb_response'}
Truth table0%0/2
A
A= $tpp->{'nicovideo_thumb_response'}
Aresult
11
00
55 0 ▶ my $thumb = $params->{thumb} || {};
Condition0%0/2
$params->{'thumb'} || {}
l!l
00
MC/DC0%0/1
$params->{'thumb'} || {}
$params->{'thumb'}
Truth table0%0/2
A
A= $params->{'thumb'}
Aresult
11
00
56  
57 0 for my $name ( ($self->members) ){
58 0 ▶ $self->$name( $thumb->{$name} )
Branch: 1 branch
BranchTrueFalseTotal
if $self->can($name) 0 0 0
59 if( $self->can($name) );
60 }
61  
62 # status
63 0 ▶ my $status = $params->{'-status'} || '';
Condition0%0/2
$params->{'-status'} || ''
l!l
00
MC/DC0%0/1
$params->{'-status'} || ''
$params->{'-status'}
Truth table0%0/2
A
A= $params->{'-status'}
Aresult
11
00
64 0 ▶ if( lc($status) eq 'ok' ){
Branch: 1 branch
BranchTrueFalseTotal
if (lc $status eq 'ok') { } 0 0 0
65 0 $self->set_status_success;
66 }else{
67 0 $self->set_status_error;
68 }
69
70 0 return $self;
71 }
72  
73  
74 1 1;
75 __END__
« NicoVideo.pm ↑ Summary NicoVideo/URL.pm »