Synopsis
use Shell::Run;
my $bash = Shell::Run->new(name => 'bash');
my ($input, $output);
# input and output, status check
$input = 'fed to cmd';
$bash->run('cat', $output, $input) or warn('bash failed');
print "output is '$output'\n";
# no input
$bash->run('echo hello', $output);
print "output is '$output'\n";
# use shell variable
$bash->run('echo $foo', $output, undef, foo => 'var from env');
print "output is '$output'\n";
# use bash feature
$bash->run('cat <(echo $foo)', $output, undef, foo => 'var from file');
print "output is '$output'\n";
Description
The Shell::Run class provides an alternative interface for executing shell commands from a perl script
Comments
If you do get is to have a more generic interface then you'd want to rename the module to something more generic as well (`Shell::Run` and `Shell::Call` spring to mind as possibilities, but you can probably come up with something better).
Compared to IPC::Run the usage shall be easier for just the special case of calling a small piece of shell code.
The main usage is something like signature="$(echo -n "$signdata" | openssl dgst -sha256 -sign <(echo "$key") -hex", which needs some extra effords even with IPC::Run.
Please sign up to post a review.