Connector::Builtin::System::Exec
Run a command using Proc::SafeExec.
Allows passing of arguments, stdin and env, each item of those lists is parsed as a template with the path arguments set in ARGS. In set mode the filename generated from content is set to FILE.
my $con = Connector::Proxy::DBI->new({ LOCATION => '/usr/bin/script', args => ['--foo','ARGS.0'], content => '[% payload %]', env => { BAR => 'bar' }, chomp_output => 1, timeout => 2, });
List of parameters that are passed as arguments to the command.
Timeout to wait for the command in seconds, default is 5
A string or an array of strings to pipe as stdin to the command. Items are joined with a newline.
Expects a HashRef where the key is the name of the ENV variable.
A template string used to generate a tempfile when set mode is used.
The following call will create a tempfile with the content 'Hello World' and afterwards runs the systems copy command using the first path argument from the connector call as target filename.
my $con = Connector::Proxy::DBI->new({ LOCATION => '/usr/bin/cp', args => ['[% FILE %]', '[% ARGS.0 %]''], content => '[% payload %]', }); $conn->set('foo.txt', { payload => 'Hello World' } );
To install Connector, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Connector
CPAN shell
perl -MCPAN -e shell install Connector
For more information on module installation, please visit the detailed CPAN module installation guide.