File Coverage

blib/lib/Webqq/Client/Method/logout.pm
Criterion Covered Total %
statement 3 23 13.0
branch 0 6 0.0
condition n/a
subroutine 1 2 50.0
pod 1 1 100.0
total 5 32 15.6


line stmt bran cond sub pod time code
1 1     1   4 use Webqq::Client::Util qw(console);
  1         1  
  1         217  
2             sub Webqq::Client::logout {
3 0     0 1   my $self = shift;
4 0           console "正在注销...\n";
5 0 0         if($self->{type} eq 'smartqq'){
6 0           $self->{cookie_jar}->set_cookie(0,"ptwebqq",undef,"/","qq.com",undef,undef,undef,-1);
7 0           $self->{cookie_jar}->set_cookie(0,"skey",undef,"/","qq.com",undef,undef,undef,-1);
8 0           console "注销完毕\n";
9 0           return 1;
10             }
11 0           my $ua = $self->{ua};
12 0           my $api_url = 'http://d.web2.qq.com/channel/logout2';
13 0           my @query_string = (
14             ids => undef,
15             clientid => $self->{qq_param}{clientid},
16             psessionid => $self->{qq_param}{psessionid},
17             t => time,
18             );
19 0           my @headers = (Referer => 'http://d.web2.qq.com/proxy.html?v=20110331002&callback=1&id=3');
20 0           my @query_string_pairs;
21 0           push @query_string_pairs , shift(@query_string) . "=" . shift(@query_string) while(@query_string);
22 0           my $response = $ua->get($api_url.'?'.join("&",@query_string_pairs),@headers);
23 0 0         if($response->is_success){
  0            
24 0           my $content = $response->content();
25 0 0         print $content,"\n" if $self->{debug};
26 0           console "注销完毕\n";
27 0           return 1;
28             }
29             else{return 0}
30             }
31             1;