Weixin/Plugin/ShowQRcode.pm untested

filter: Statementstmt 0.0% 0 / 13 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 1 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 25 CC 6 SCAR 37.4
CC
6
Cov
0%
call
42.0
CRAP 42.0
1 package Mojo::Weixin::Plugin::ShowQRcode;
2 our $PRIORITY = 0;
3 our $CALL_ON_LOAD=1;
4  
5 sub call
6 {
7 my $client = shift;
8 $client->on(input_qrcode=>sub
9 {
10 my($client,$qrcode_path) = @_;
11 my $command;
12 if($^O=~/^MSWin32/i) # Windows
13 {
14 $command="start $qrcode_path";
15 eval(system($command));
16 $client->error($@) if $@;
17 }
18 elsif($^O=~/^linux/i) # Linux
19 {
20 }
21 elsif($^O=~/^darwin/i) # Mac OS X
22 {
23 $command="open $qrcode_path";
24 eval(system($command));
25 $client->error($@) if $@;
26 }
27 }
28 );
29 }
30  
31  
32 1;