| 1 | 1 | ▶ | use JSON; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use Encode; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 0 | ▶ | sub Webqq::Client::_get_discuss_list_info { | ||||||||||||||||||||||||||
|
Subroutine
_get_discuss_list_info: not called CC=10 SCAR=47.0
| |||||||||||||||||||||||||||||
| 4 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 5 | 0 | my $ua = $self->{ua}; | |||||||||||||||||||||||||||
| 6 | 0 | ▶ | return undef if $self->{type} ne 'smartqq'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 7 | 0 | my $api_url = 'http://s.web2.qq.com/api/get_discus_list'; | |||||||||||||||||||||||||||
| 8 | my @query_string = ( | ||||||||||||||||||||||||||||
| 9 | clientid => $self->{qq_param}{clientid}, | ||||||||||||||||||||||||||||
| 10 | psessionid => $self->{qq_param}{psessionid}, | ||||||||||||||||||||||||||||
| 11 | vfwebqq => $self->{qq_param}{vfwebqq}, | ||||||||||||||||||||||||||||
| 12 | 0 | t => time(), | |||||||||||||||||||||||||||
| 13 | ); | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 0 | my @headers = ( | |||||||||||||||||||||||||||
| 16 | Referer => 'http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1', | ||||||||||||||||||||||||||||
| 17 | ); | ||||||||||||||||||||||||||||
| 18 | 0 | my @query_string_pairs; | |||||||||||||||||||||||||||
| 19 | 0 | ▶ | push @query_string_pairs , shift(@query_string) . "=" . shift(@query_string) while(@query_string); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | 0 | my $response = $ua->get($api_url.'?'.join("&",@query_string_pairs),@headers); | |||||||||||||||||||||||||||
| 21 | 0 | ▶ | if($response->is_success){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 22 | #{"retcode":0,"result":{"dnamelist":[{"name":"测试2","did":2742986730},{"name":"测试","did":3420777698}]}} | ||||||||||||||||||||||||||||
| 23 | 0 | ▶ | print $response->content(),"\n" if $self->{debug}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | 0 | my $json; | |||||||||||||||||||||||||||
| 25 | 0 | eval{ | |||||||||||||||||||||||||||
| 26 | 0 | $json = JSON->new->utf8->decode($response->content()) ; | |||||||||||||||||||||||||||
| 27 | }; | ||||||||||||||||||||||||||||
| 28 | 0 | ▶ | print $@ if $@ and $self->{debug}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$@ and $self->{"debug"}
MC/DC0%0/2
$@ and $self->{"debug"}
$@
$self->{"debug"}
Truth table0%0/3
A and B
A= $@B= $self->{"debug"}
| |||||||||||||||||||||||||||||
| 29 | 0 | ▶ | $json = {} unless defined $json; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | 0 | ▶ | return undef if $json->{retcode}!=0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 31 | 0 | for(@{ $json->{result}{dnamelist} }){ | |||||||||||||||||||||||||||
| 32 | 0 | $_->{name} = encode("utf8",$_->{name}); | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | 0 | return $json->{result}{dnamelist}; | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | 0 | else{return undef;} | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 1 | 1; | |||||||||||||||||||||||||||