| 1 | package App::cdif::Command::OSAscript; | ||
| 2 | |||
| 3 | use parent "App::cdif::Command"; | ||
| 4 | |||
| 5 | use v5.14; | ||
| 6 | use warnings; | ||
| 7 | use utf8; | ||
| 8 | use Carp; | ||
| 9 | use Data::Dumper; | ||
| 10 | |||
| 11 | sub new { | ||
| 12 | my($class, %opt) = @_; | ||
| 13 | my @command = qw(osascript); | ||
| 14 | if (my $lang = delete $opt{LANG}) { | ||
| 15 | push @command, "-l", $lang; | ||
| 16 | } | ||
| 17 | my $obj = $class->SUPER::new(%opt); | ||
| 18 | $obj->command("@command"); | ||
| 19 | $obj; | ||
| 20 | } | ||
| 21 | |||
| 22 | sub exec { | ||
| 23 | my $obj = shift; | ||
| 24 | my $script = shift; | ||
| 25 | $obj->setstdin($script)->update->data; | ||
| 26 | } | ||
| 27 | |||
| 28 | 1; |