Webqq/Model/Remote/_get_user_friends_ext.pm

filter: Statementstmt 14.8% 4 / 27 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 25.0% 1 / 4 Podpod n/a totaltotal 10.4% 5 / 48 CC 10 SCAR 38.6
CC
10
Cov
10%
__ANON__
72.0
_get_user_friends_ext
12.0
__ANON__
2.0
CRAP 47.3
« Webqq/Plugin/PostQRcode.pm ↑ Summary Webqq/Plugin/MobileInfo.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 0 ▶sub Mojo::Webqq::Model::_get_user_friends_ext {
Subroutine _get_user_friends_ext: not called CC=3 SCAR=24.8
3 0 my $self = shift;
4 0 my $callback = shift;
5 0 my $api = 'http://qun.qq.com/cgi-bin/qun_mgr/get_friend_list';
6 0 ▶ my $is_blocking = ref $callback eq "CODE"?0:1;
Branch: 1 branch
BranchTrueFalseTotal
ref $callback eq 'CODE' ? : 0 0 0
7 0 ▶ my $handle = sub{
Subroutine __ANON__: not called CC=8 SCAR=42.8
8 0 my $json = shift;
9 0 ▶ return if not defined $json;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $json 0 0 0
10 0 ▶ return if $json->{ec}!=0;
Branch: 1 branch
BranchTrueFalseTotal
if $json->{"ec"} != 0 0 0 0
11 #{"ec":0,"result":{"0":{"mems":[{"name":"卖茶叶和眼镜per","uin":744891290}]},"1":{"gname":"朋友"},"2":{"gname":"家人"},"3":{"gname":"同学"}}}
12 0 my @result;
13 0 for my $category_index (keys %{$json->{result}}){
14 0 ▶ my $category = ($category_index==0 and !defined $json->{result}{$category_index}{gname})?"我的好友":($json->{result}{$category_index}{gname});
Branch: 1 branch
BranchTrueFalseTotal
$category_index == 0 && !defined($json->{'result'}{$category_index}{'gname'}) ? : 0 0 0
Condition0%0/3
$category_index == 0 and not defined $json->{"result"}{$category_index}{"gname"}
!ll&&!rl&&r
000
MC/DC0%0/2
$category_index == 0 and not defined $json->{"result"}{$category_index}{"gname"}
$category_index == 0 not defined $json->{"result"}{$category_index}{"gname"}
Truth table0%0/3
A and not(B)
A= $category_index == 0B= not defined $json->{"result"}{$category_index}{"gname"}
ABresult
0X0
100
111
15 0 ▶ next if ref $json->{result}{$category_index}{mems} ne "ARRAY";
Branch: 1 branch
BranchTrueFalseTotal
if ref $json->{"result"}{$category_index}{"mems"} ne "ARRAY" 0 0 0
16 0 for my $f (@{ $json->{result}{$category_index}{mems} }){
17 my $friend = {
18 category => $self->xmlescape_parse($category),
19 displayname => $self->xmlescape_parse($f->{name}),
20 uid => $f->{uin},
21 0 } ;
22 0 push @result,$friend;
23 }
24 }
25 0 return \@result;
26 0 };
27 0 ▶ if($is_blocking){
Branch: 1 branch
BranchTrueFalseTotal
if ($is_blocking) { } 0 0 0
28 0 return $handle->($self->http_post($api,{Referer=>"http://qun.qq.com/member.html",json=>1},form=>{bkn=>$self->get_csrf_token},) );
29 }
30 else{
31 0 ▶ $self->http_post($api,{Referer=>"http://qun.qq.com/member.html",json=>1},form=>{bkn=>$self->get_csrf_token},sub{
Subroutine __ANON__: not called CC=1 SCAR=6.9
32 0 my $json = shift;
33 0 $callback->( $handle->($json) );
34 0 });
35 }
36 }
37 1 1;
« Webqq/Plugin/PostQRcode.pm ↑ Summary Webqq/Plugin/MobileInfo.pm »