Weixin/Plugin/ShowQRCodeInTerm.pm untested

filter: Statementstmt 0.0% 0 / 14 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 23 CC 3 SCAR 16.5
CC
3
Cov
0%
BEGIN
6.0
call
6.0
BEGIN
2.0
CRAP 5.2
1 package Mojo::Weixin::Plugin::ShowQRCodeInTerm;
2 our $PRIORITY = 0;
3 our $CALL_ON_LOAD = 1;
4 BEGIN{
5 our $has_term_qrcode = 0;
6 eval{require Term::QRCode;};
7 $has_term_qrcode = 1 if not $@;
8 }
9 sub call{
10 my $client = shift;
11 my $data = shift;
12  
13 $client->die("插件[". __PACKAGE__ ."]依赖模块 Term::QRCode,请先确认该模块已经正确安装。
14 \nlinux安装方法:
15 \t1、wget http://fukuchi.org/works/qrencode/qrencode-3.4.4.tar.gz
16 \t2、tar zxf qrencode-3.4.4.tar.gz
17 \t3、cd qrencode-3.4.4;
18 \t4、./configure;
19 \t5、make && make install
20 \t6、export PKG_CONFIG_PATH=\"\$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig\"
21 \t7、cpanm Term::QRCode \n") if not $has_term_qrcode;
22  
23 $client->on(input_qrcode=>sub{
24 $client->info('请扫描屏幕二维码登陆!');
25 print Term::QRCode->new->plot('https://login.weixin.qq.com/l/' . $client->qrcode_uuid) . "\n" ;
26 });
27 }
28 1;