Webqq/Model/Remote/_get_group_list_info.pm

filter: Statementstmt 12.9% 4 / 31 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 25.0% 1 / 4 Podpod n/a totaltotal 11.6% 5 / 43 CC 7 SCAR 29.4
CC
7
Cov
10%
__ANON__
30.0
_get_group_list_info
12.0
__ANON__
2.0
CRAP 18.9
« Webqq/Model/Remote/get_qq_from_id.pm ↑ Summary Webqq/Plugin/Pu.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 0 ▶sub Mojo::Webqq::Model::_get_group_list_info{
Subroutine _get_group_list_info: not called CC=3 SCAR=24.8
3 0 my $self = shift;
4 0 my $callback = shift;
5 0 my $api_url = 'https://s.web2.qq.com/api/get_group_name_list_mask2';
6 0 my $headers = {
7 Referer => 'https://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1',
8 json=>1,
9 ua_request_timeout => $self->model_update_timeout,
10 ua_retry_times => 3,
11 };
12 0 my %r = (
13 hash => $self->hash($self->ptwebqq,$self->uid),
14 vfwebqq => $self->vfwebqq,
15 );
16 0 ▶ my $is_blocking = ref $callback eq "CODE"?0:1;
Branch: 1 branch
BranchTrueFalseTotal
ref $callback eq 'CODE' ? : 0 0 0
17 0 ▶ my $handle = sub{
Subroutine __ANON__: not called CC=5 SCAR=34.0
18 0 my $json = shift;
19 0 ▶ return undef unless defined $json;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $json 0 0 0
20 0 ▶ return undef unless exists $json->{result}{gnamelist};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $json->{"result"}{"gnamelist"} 0 0 0
21 0 my $group_list_info = $json->{result}{gnamelist};
22 0 my %gmarklist;
23 0 for(@{ $group_list_info }){
24 0 $gmarklist{$_->{gid}} = $_->{markname};
25 }
26 0 for(@{$group_list_info}){
27 0 $_->{markname} = $self->xmlescape_parse($gmarklist{$_->{gid}});
28 0 $_->{name} = $self->xmlescape_parse($_->{name});
29 0 $_->{id} = delete $_->{gid};
30 0 delete $_->{flag} ;
31 }
32 0 return $group_list_info;
33 0 };
34 0 ▶ if($is_blocking){
Branch: 1 branch
BranchTrueFalseTotal
if ($is_blocking) { } 0 0 0
35 0 return $handle->($self->http_get($api_url,$headers,form=>{r=>$self->to_json(\%r)},) );
36 }
37 else{
38 0 ▶ $self->http_get($api_url,$headers,form=>{r=>$self->to_json(\%r)},sub{
Subroutine __ANON__: not called CC=1 SCAR=6.9
39 0 my $json = shift;
40 0 $callback->( $handle->($json) );
41 0 });
42 }
43 }
44 1 1;
« Webqq/Model/Remote/get_qq_from_id.pm ↑ Summary Webqq/Plugin/Pu.pm »