| 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; |