Webqq/Model/Remote/_get_group_list_info_ext.pm

filter: Statementstmt 14.2% 4 / 28 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 25.0% 1 / 4 Podpod n/a totaltotal 11.9% 5 / 42 CC 8 SCAR 32.8
CC
8
Cov
11%
__ANON__
42.0
_get_group_list_info_ext
12.0
__ANON__
2.0
CRAP 26.5
« Webqq/Model/Ext.pm ↑ Summary Webqq/Plugin/PostImgVerifycode.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 0 ▶sub Mojo::Webqq::Model::_get_group_list_info_ext {
Subroutine _get_group_list_info_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_group_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=6 SCAR=37.4
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,"join":[{"gc":1299322,"gn":"perl技术","owner":4866832},{"gc":144539789,"gn":"PERL学习交流","owner":419902730},{"gc":213925424,"gn":"PERL","owner":913166583}],"manage":[{"gc":390179723,"gn":"IT狂人","owner":308165330}]}
12 0 my @result;
13 0 for my $t (qw(join manage create)){
14 0 for(@{$json->{$t}}){
15 0 my $group = {};
16 0 $group->{name} = $self->xmlescape_parse($_->{gn});
17 0 $group->{uid} = $_->{gc};
18 0 $group->{owner_uid} = $_->{owner};
19 0 ▶ $group->{role} = $t eq "join"?"attend":$t;
Branch: 1 branch
BranchTrueFalseTotal
$t eq 'join' ? : 0 0 0
20 0 push @result,$group;
21 }
22 }
23 0 return \@result;
24 0 };
25 0 ▶ if($is_blocking){
Branch: 1 branch
BranchTrueFalseTotal
if ($is_blocking) { } 0 0 0
26 0 return $handle->($self->http_post($api,{Referer=>"http://qun.qq.com/member.html",json=>1},form=>{bkn=>$self->get_csrf_token},));
27 }
28 else{
29 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
30 0 my $json = shift;
31 0 $callback->( $handle->($json) );
32 0 });
33 }
34 };
35 1 1;
« Webqq/Model/Ext.pm ↑ Summary Webqq/Plugin/PostImgVerifycode.pm »