NicoVideo/Content/Thread.pm

filter: Statementstmt 64.4% 58 / 90 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 72.7% 16 / 22 Podpod 0.0% 0 / 4 totaltotal 60.6% 74 / 122 CC 5 SCAR 15.0
CC
5
Cov
60%
parse
20.0
get_comments
6.0
members
2.0
CRAP 4.5
« NicoVideo/Content/Video.pm ↑ Summary NicoVideo/Content/Watch.pm »
1 package Net::NicoVideo::Content::Chat;
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(Class::Accessor::Fast);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use vars qw(@Members);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 @Members = qw(
12 thread
13 no
14 vpos
15 date
16 mail
17 user_id
18 anonymity
19 value
20 );
21 1 __PACKAGE__->mk_accessors(@Members);
22  
23 0 ▶sub members {
Subroutine members: not called CC=1 SCAR=6.9
24 0 @Members;
25 }
26  
27  
28 package Net::NicoVideo::Content::ViewCounter;
29  
30 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
32 1 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
33 1 $VERSION = '0.27_01';
34  
35 1 ▶use base qw(Class::Accessor::Fast);
Subroutine BEGIN: called CC=1 SCAR=0.0
36  
37 1 ▶use vars qw(@Members);
Subroutine BEGIN: called CC=1 SCAR=0.0
38 1 @Members = qw(
39 video
40 id
41 mylist
42 );
43 1 __PACKAGE__->mk_accessors(@Members);
44  
45 0 ▶sub members {
Subroutine members: not called CC=1 SCAR=6.9
46 0 @Members;
47 }
48  
49 package Net::NicoVideo::Content::Thread;
50  
51 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
52 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
53 1 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
54 1 $VERSION = '0.27_01';
55  
56 1 ▶use base qw(Net::NicoVideo::Content Class::Accessor::Fast);
Subroutine BEGIN: called CC=1 SCAR=0.0
57 1 ▶use XML::TreePP;
Subroutine BEGIN: called CC=1 SCAR=0.0
58  
59 1 ▶use vars qw(@Members);
Subroutine BEGIN: called CC=1 SCAR=0.0
60 1 @Members = qw(
61 resultcode
62 thread
63 last_res
64 ticket
65 revision
66 fork
67 server_time
68  
69 view_counter
70 chats
71 );
72 1 __PACKAGE__->mk_accessors(@Members);
73  
74 0 ▶sub members { # implement
Subroutine members: not called CC=1 SCAR=6.9
Pod undocumented
75 0 @Members;
76 }
77  
78 0 ▶sub parse { # implement
Subroutine parse: not called CC=4 SCAR=30.0
Pod undocumented
79 0 my $self = shift;
80 0 ▶ $self->load($_[0]) if( defined $_[0] );
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[0] 0 0 0
81  
82 0 my $tree = XML::TreePP->new( force_array => 'chat' )
83 ->parse($self->_decoded_content);
84
85 0 my @chats = ();
86 0 for my $c ( @{$tree->{packet}->{chat}} ){
87 push @chats, Net::NicoVideo::Content::Chat->new({
88 thread => $c->{-thread},
89 no => $c->{-no},
90 vpos => $c->{-vpos},
91 date => $c->{-date},
92 mail => $c->{-mail},
93 user_id => $c->{-user_id},
94 anonymity => $c->{-anonymity},
95 0 value => $c->{'#text'},
96 });
97 }
98  
99 0 my $v = $tree->{packet}->{view_counter};
100 my $vc = Net::NicoVideo::Content::ViewCounter->new({
101 video => $v->{-video},
102 id => $v->{-id},
103 mylist => $v->{-mylist},
104 0 });
105
106 0 my $t = $tree->{packet}->{thread};
107 0 $self->resultcode( $t->{-resultcode} );
108 0 $self->thread( $t->{-thread} );
109 0 $self->last_res( $t->{-last_res} );
110 0 $self->ticket( $t->{-ticket} );
111 0 $self->revision( $t->{-revision} );
112 0 $self->fork( $t->{-fork} );
113 0 $self->server_time( $t->{-server_time} );
114 0 $self->view_counter($vc );
115 0 $self->chats( \@chats );
116
117 # status
118 0 ▶ if( defined $self->resultcode ){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->resultcode) { } 0 0 0
119 0 $self->set_status_success;
120 }else{
121 0 $self->set_status_error;
122 }
123
124 0 return $self;
125 }
126  
127 0 ▶sub count {
Subroutine count: not called CC=1 SCAR=6.9
Pod undocumented
128 0 my $self = shift;
129 0 scalar @{$self->chats};
130 }
131  
132 0 ▶sub get_comments {
Subroutine get_comments: not called CC=2 SCAR=17.9
Pod undocumented
133 0 my $self = shift;
134 0 ▶ wantarray ? @{$self->chats} : $self->chats;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
135 }
136  
137 1 1;
138 __END__
« NicoVideo/Content/Video.pm ↑ Summary NicoVideo/Content/Watch.pm »