Webqq/Client/Method/_get_discuss_list_info.pm

filter: Statementstmt 24.1% 7 / 29 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 66.6% 2 / 3 Podpod n/a totaltotal 17.6% 9 / 51 CC 10 SCAR 45.2
CC
10
Cov
15%
_get_discuss_list_info
110.0
BEGIN
1.0
BEGIN
1.0
CRAP 91.8
« Webqq/Client/Method/_get_friend_info.pm ↑ Summary Webqq/Client/Method/_get_img_verify_code.pm »
1 1 ▶use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use Encode;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 0 ▶sub Webqq::Client::_get_discuss_list_info {
Subroutine _get_discuss_list_info: not called CC=10 SCAR=47.0
4 0 my $self = shift;
5 0 my $ua = $self->{ua};
6 0 ▶ return undef if $self->{type} ne 'smartqq';
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"type"} ne "smartqq" 0 0 0
7 0 my $api_url = 'http://s.web2.qq.com/api/get_discus_list';
8 my @query_string = (
9 clientid => $self->{qq_param}{clientid},
10 psessionid => $self->{qq_param}{psessionid},
11 vfwebqq => $self->{qq_param}{vfwebqq},
12 0 t => time(),
13 );
14
15 0 my @headers = (
16 Referer => 'http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1',
17 );
18 0 my @query_string_pairs;
19 0 ▶ push @query_string_pairs , shift(@query_string) . "=" . shift(@query_string) while(@query_string);
Branch: 1 branch
BranchTrueFalseTotal
@query_string and do { push @query_string_pairs, shift(@query_string) . '=' . shift(@query_string) } 0 0 0
20 0 my $response = $ua->get($api_url.'?'.join("&",@query_string_pairs),@headers);
21 0 ▶ if($response->is_success){
Branch: 1 branch
BranchTrueFalseTotal
if ($response->is_success) { } 0 0 0
22 #{"retcode":0,"result":{"dnamelist":[{"name":"测试2","did":2742986730},{"name":"测试","did":3420777698}]}}
23 0 ▶ print $response->content(),"\n" if $self->{debug};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"debug"} 0 0 0
24 0 my $json;
25 0 eval{
26 0 $json = JSON->new->utf8->decode($response->content()) ;
27 };
28 0 ▶ print $@ if $@ and $self->{debug};
Branch: 1 branch
BranchTrueFalseTotal
if $@ and $self->{"debug"} 0 0 0
Condition0%0/3
$@ and $self->{"debug"}
!ll&&!rl&&r
000
MC/DC0%0/2
$@ and $self->{"debug"}
$@ $self->{"debug"}
Truth table0%0/3
A and B
A= $@B= $self->{"debug"}
ABresult
0X0
100
111
29 0 ▶ $json = {} unless defined $json;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $json 0 0 0
30 0 ▶ return undef if $json->{retcode}!=0;
Branch: 1 branch
BranchTrueFalseTotal
if $json->{"retcode"} != 0 0 0 0
31 0 for(@{ $json->{result}{dnamelist} }){
32 0 $_->{name} = encode("utf8",$_->{name});
33 }
34 0 return $json->{result}{dnamelist};
35
36 }
37 0 else{return undef;}
38  
39 }
40  
41 1 1;
« Webqq/Client/Method/_get_friend_info.pm ↑ Summary Webqq/Client/Method/_get_img_verify_code.pm »