Name : perl-Sys-Cmd
| |
Version : 0.99.0
| Vendor : obs://build_opensuse_org/home:illuusio
|
Release : lp154.2.1
| Date : 2022-10-07 07:25:37
|
Group : Unspecified
| Source RPM : perl-Sys-Cmd-0.99.0-lp154.2.1.src.rpm
|
Size : 0.05 MB
| |
Packager : https://www_suse_com/
| |
Summary : run a system command or spawn a system processes
|
Description :
*Sys::Cmd* lets you run system commands and capture their output, or spawn and interact with a system process through its \'STDIN\', \'STDOUT\', and \'STDERR\' file handles. The following functions are exported on demand by this module:
* run( AATTcmd, [\\%opt] ) => $output | AATToutput
Execute \'AATTcmd\' and return what the command sent to its \'STDOUT\', raising an exception in the event of error. In array context returns a list instead of a plain string.
The first element of \'AATTcmd\' determines what/how things are run:
* * If it is a relative file name it is executed directly using Proc::Spawn.
* * If it is a CODE reference (subroutine) *Sys::Cmd* forks before running it in the child process. This is not supported on Win32.
* * Everything else is looked up using File::Which and then executed with Proc::Spawn.
The command input and environment can be modified with an optional hashref containing the following key/values:
* dir
The working directory the command will be run in.
* encoding
An string value identifying the encoding of the input/output file-handles. Defaults to \'utf8\'.
* env
A hashref containing key/values to be added to the current environment at run-time. If a key has an undefined value then the key is removed from the environment altogether.
* input
A string which is fed to the command via its standard input, which is then closed.
* runx( AATTcmd, [\\%opt] ) => $outerrput | AATTouterrput
The same as the \'run\' function but with the command\'s \'STDERR\' output appended to the \'STDOUT\' output.
* spawn( AATTcmd, [\\%opt] ) => Sys::Cmd
Return a *Sys::Cmd* object (documented below) representing the process running AATTcmd, with attributes set according to the optional \\%opt hashref. The first element of \'AATTcmd\' determines the execution method just like the \'run()\' function.
*Sys::Cmd* objects can of course be created using the standard \'new\' constructor if you prefer that to the \'spawn\' function:
$proc = Sys::Cmd->new( cmd => \\AATTcmd, dir => \'/\', env => { SOME => \'VALUE\' }, enc => \'iso-8859-3\', input => \'feedme\', on_exit => sub { my $proc = shift; print $proc->pid .\' exited with \'. $proc->exit; }, );
Note that *Sys::Cmd* objects created this way will not lookup the command using File::Which the way the \'run\', \'runx\' and \'spawn\' functions do. CODE references in \'$cmd[0]\' are however still recognized and forked off.
*Sys::Cmd* uses Log::Any \'debug\' calls for logging purposes. An easy way to see the output is to add \'use Log::Any::Adapter \'Stdout\'\' in your program.
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/home:/illuusio:/perl/15.4/noarch |