Webqq/Plugin/ShowQRcode.pm untested

filter: Statementstmt 0.0% 0 / 16 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 1 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 30 CC 7 SCAR 40.3
CC
7
Cov
0%
call
56.0
CRAP 56.0
1 package Mojo::Webqq::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 $command="xdg-open $qrcode_path";
21 eval(system($command));
22 $client->error($@) if $@;
23 }
24 elsif($^O=~/^darwin/i) # Mac OS X
25 {
26 $command="open $qrcode_path";
27 eval(system($command));
28 $client->error($@) if $@;
29 }
30 }
31 );
32 }
33  
34  
35 1;