App-sdif

 view release on metacpan or  search on metacpan

lib/App/cdif/Command.pm  view on Meta::CPAN

use warnings;
use utf8;

use parent 'Command::Run';

# Compatibility: expand array reference in command
sub command {
    my $obj = shift;
    if (@_) {
	my @cmd = map { ref eq 'ARRAY' ? @$_ : $_ } @_;
	return $obj->SUPER::command(@cmd);
    }
    $obj->SUPER::command;
}

# Compatibility wrapper for read_error option
sub option {
    my $obj = shift;
    if (@_ == 1) {
	my $key = shift;
	if ($key eq 'read_error') {
	    my $stderr = $obj->SUPER::option('stderr') // '';
	    return $stderr eq 'redirect' ? 1 : 0;
	}
	return $obj->SUPER::option($key);
    } else {
	while (my($k, $v) = splice @_, 0, 2) {
	    if ($k eq 'read_error') {
		$obj->SUPER::option(stderr => $v ? 'redirect' : undef);
	    } else {
		$obj->SUPER::option($k => $v);
	    }
	}
	return $obj;
    }
}

# Compatibility: return INPUT filehandle
sub stdin {
    my $obj = shift;
    $obj->{INPUT};

lib/App/cdif/Command/OSAscript.pm  view on Meta::CPAN

use utf8;
use Carp;
use Data::Dumper;

sub new {
    my($class, %opt) = @_;
    my @command = qw(osascript);
    if (my $lang = delete $opt{LANG}) {
	push @command, "-l", $lang;
    }
    my $obj = $class->SUPER::new(%opt);
    $obj->command("@command");
    $obj;
}

sub exec {
    my $obj = shift;
    my $script = shift;
    $obj->setstdin($script)->update->data;
}



( run in 2.239 seconds using v1.01-cache-2.11-cpan-8f98c5d2c55 )