File Coverage

blib/lib/Mojo/Weixin/Client/Remote/_is_need_login.pm
Criterion Covered Total %
statement 0 10 0.0
branch 0 6 0.0
condition n/a
subroutine 0 1 0.0
pod n/a
total 0 17 0.0


line stmt bran cond sub pod time code
1             sub Mojo::Weixin::_is_need_login {
2 0     0     my $self = shift;
3 0           my $api = "https://". $self->domain ."/";
4 0 0         return 1 if $self->login_state eq "relogin";
5 0           $self->debug("检查登录Cookie是否有效...");
6 0           my $data = $self->http_get($api,{ua_debug_res_body=>0});
7 0 0         my $ret = $data=~/window\.MMCgi\s*=\s*{\s*isLogin\s*:\s*(!!"1")\s*}/s?0:1;
8 0 0         if(not $ret){
9 0           $self->debug("登录cookie仍然有效,可以免扫码登录");
10             }
11             else{
12 0           $self->debug("登录cookie不存在或已失效,需要扫码登录");
13             }
14 0           return $ret;
15             }
16             1;