Webqq/Client/Method/_get_user_info.pm

filter: Statementstmt 25.9% 7 / 27 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 2 / 3 Podpod n/a totaltotal 20.4% 9 / 44 CC 8 SCAR 40.6
CC
8
Cov
17%
_get_user_info
72.0
BEGIN
1.0
BEGIN
1.0
CRAP 57.8
« Webqq/Client/Plugin/Perlcode.pm ↑ Summary Webqq/Client/Method/_get_friends_state.pm »
1 1 ▶use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use Webqq::Client::Util qw(code2state code2client);
Subroutine BEGIN: called CC=1 SCAR=0.0
3 0 ▶sub Webqq::Client::_get_user_info{
Subroutine _get_user_info: not called CC=8 SCAR=42.8
4 0 my $self = shift;
5 0 my $webqq_api_url ='http://s.web2.qq.com/api/get_friend_info2';
6 0 my $smartqq_api_url ='http://s.web2.qq.com/api/get_self_info2';
7 0 ▶ my $api_url = $self->{type} eq 'webqq'? $webqq_api_url
Branch: 1 branch
BranchTrueFalseTotal
$self->{'type'} eq 'webqq' ? : 0 0 0
8 : $smartqq_api_url
9 ;
10 0 my $ua = $self->{ua};
11 0 ▶ my @headers = $self->{type} eq 'webqq'? (Referer=>'http://s.web2.qq.com/proxy.html?v=20110412001&callback=1&id=3')
Branch: 1 branch
BranchTrueFalseTotal
$self->{'type'} eq 'webqq' ? : 0 0 0
12 : (Referer=>'http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1');
13 ;
14
15 0 my @query_string = (
16 t => time,
17 );
18 0 ▶ if($self->{type} eq 'webqq'){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"type"} eq "webqq") 0 0 0
19 unshift @query_string,(
20 tuin => $self->{qq_param}{qq},
21 verifysession => undef,
22 code => undef,
23 vfwebqq => $self->{qq_param}{vfwebqq},
24 vfwebqq => $self->{qq_param}{vfwebqq}
25 0 );
26 }
27 0 my @query_string_pairs;
28 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
29 0 my $response = $ua->get($api_url.'?'.join("&",@query_string_pairs),@headers);
30 0 ▶ if($response->is_success){
Branch: 1 branch
BranchTrueFalseTotal
if ($response->is_success) { } 0 0 0
31 0 ▶ print $response->content(),"\n" if $self->{debug};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"debug"} 0 0 0
32 0 my $json = JSON->new->utf8->decode( $response->content() );
33 0 ▶ return undef if $json->{retcode} !=0;
Branch: 1 branch
BranchTrueFalseTotal
if $json->{"retcode"} != 0 0 0 0
34 0 $json->{result}{state} = $self->{qq_param}{state};
35 0 $json->{result}{client_type} = 'web';
36 0 return $json->{result};
37 }
38 0 else{return undef}
39 }
40 1 1;
« Webqq/Client/Plugin/Perlcode.pm ↑ Summary Webqq/Client/Method/_get_friends_state.pm »