| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 10 | 0 | ▶ | return if $json->{ec}!=0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
Condition0%0/3
$category_index == 0 and not defined $json->{"result"}{$category_index}{"gname"}
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"}
| |||||||||||||||||||||||||||||
| 15 | 0 | ▶ | next if ref $json->{result}{$category_index}{mems} ne "ARRAY"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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; | |||||||||||||||||||||||||||