| 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
| |||||||||||
| 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
| |||||||||||
| 10 | 0 | ▶ | return if $json->{ec}!=0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 20 | 0 | push @result,$group; | |||||||||
| 21 | } | ||||||||||
| 22 | } | ||||||||||
| 23 | 0 | return \@result; | |||||||||
| 24 | 0 | }; | |||||||||
| 25 | 0 | ▶ | if($is_blocking){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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; | |||||||||