Webqq/Client/Method/_get_recent_info.pm

filter: Statementstmt 17.3% 4 / 23 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 1 / 2 Podpod n/a totaltotal 13.5% 5 / 37 CC 8 SCAR 41.6
CC
8
Cov
11%
_get_recent_info
72.0
BEGIN
1.0
CRAP 64.1
« Webqq/Client/Method/_get_group_sig.pm ↑ Summary Webqq/Client/Plugin/Perlcode.pm »
1 1 ▶use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 0 ▶sub Webqq::Client::_get_recent_info {
Subroutine _get_recent_info: not called CC=8 SCAR=42.8
3 0 my $self = shift;
4 0 my $ua = $self->{ua};
5 0 ▶ return undef if $self->{type} ne 'smartqq';
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"type"} ne "smartqq" 0 0 0
6 0 my $api_url = 'http://d.web2.qq.com/channel/get_recent_list2';
7 0 my @headers = (
8 Referer => 'http://d.web2.qq.com/proxy.html?v=20130916001&callback=1&id=2',
9 );
10  
11 my %r = (
12 vfwebqq => $self->{qq_param}{vfwebqq},
13 clientid => $self->{qq_param}{clientid},
14 psessionid => $self->{qq_param}{psessionid},
15 0 );
16 0 my $response = $ua->post($api_url,[r=>JSON->new->utf8->encode(\%r)],@headers);
17 0 ▶ if($response->is_success){
Branch: 1 branch
BranchTrueFalseTotal
if ($response->is_success) 0 0 0
18 0 ▶ print $response->content(),"\n" if $self->{debug};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"debug"} 0 0 0
19 0 my $json = JSON->new->utf8->decode($response->content());
20 0 ▶ return undef if $json->{retcode}!=0 ;
Branch: 1 branch
BranchTrueFalseTotal
if $json->{"retcode"} != 0 0 0 0
21 0 my %type = (0 => 'friend',1 => 'group', 2 => 'discuss');
22 0 my @recent;
23 0 for(@{$json->{result}}){
24 0 ▶ next unless exists $type{$_->{type}};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $type{$_->{"type"}} 0 0 0
25 0 $_->{type} = $type{$_->{type}};
26 0 push @recent,$_;
27 }
28 0 ▶ return @recent>0?\@recent:undef;
Branch: 1 branch
BranchTrueFalseTotal
@recent > 0 ? : 0 0 0
29 }
30  
31 }
32 1 1;
« Webqq/Client/Method/_get_group_sig.pm ↑ Summary Webqq/Client/Plugin/Perlcode.pm »