Shell-Autobox

 view release on metacpan or  search on metacpan

lib/Shell/Autobox.pm  view on Meta::CPAN


use Carp qw(confess);
use IPC::Run3 qw(run3);

# XXX this declaration must be on a single line
# https://metacpan.org/pod/version#How-to-declare()-a-dotted-decimal-version
use version; our $VERSION = version->declare('v2.0.1');

sub import {
    my $class  = shift;
    my $caller = (caller)[0];

    for my $program (@_) {
        my $sub = sub {
            my ($input, @args) = @_;
            my @command = ($program, @args);
            my $command = join(' ', @command);
            my $stdin = (defined($input) && ref($input) eq '') ? \$input : $input;

            run3(\@command, $stdin, \my $stdout, \my $stderr, {
                return_if_system_error => 1, # don't die on error



( run in 1.351 second using v1.01-cache-2.11-cpan-a3c8064c92c )