File Coverage

blib/lib/Weixin/Client/Private/_get_qrcode_image.pm
Criterion Covered Total %
statement 3 15 20.0
branch 0 2 0.0
condition n/a
subroutine 1 2 50.0
pod n/a
total 4 19 21.0


line stmt bran cond sub pod time code
1             package Weixin::Client;
2 1     1   600 use File::Temp qw/tempfile/;
  1         7630  
  1         127  
3             sub _get_qrcode_image{
4 0     0     my $self = shift;
5 0           my $qrcode_uuid = shift;
6 0           my $api = 'https://login.weixin.qq.com/qrcode/';
7 0           my @query_string = (
8             t => "webwx",
9             );
10 0           my $r = $self->http_get(Weixin::Util::gen_url($api . "/$qrcode_uuid",@query_string));
11 0 0         return undef unless defined $r;
12 0           my ($fh, $filename) = tempfile("weixin_qrcode_XXXX",SUFFIX =>".jpg",DIR => $self->{tmpdir});
13 0           binmode $fh;
14 0           print $fh $r;
15 0           close $fh;
16 0           console "登录二维码已经下载到本地 [ $filename ] \n";
17 0           return $filename;
18             }
19              
20             1;