From Code to Community: Sponsoring The Perl and Raku Conference 2025 Learn more

NAME

Util::Medley::Spawn - utility methods for system commands

VERSION

version 0.037

SYNOPSIS

...

ATTRIBUTES

confessOnError (optional)

Toggle for to enable/disable confess on error. Default is 1.

METHODS

capture

Executes system command and returns the stdout, stderr, and exit values. Will write to log if enabled.

usage:
($stdout, $stderr, $exit) = $util->capture($cmd, [$stdin], [$wantArrayRef])
($stdout, $stderr, $exit) = $util->capture(cmd => $cmd,
[stdin => $stdin],
[wantArrayRefs => $wantArrayRef])
args:
cmd [ArrayRef|Str]

System command to invoke. Can be an arrayref or a string.

stdin [ArrayRef|Str] (optional)

Stdin to pass to the command.

wantArrayRef [Bool]

If true, returns stdout and stderr as array refs instead of strings. Default is 0.

spawn

Executes system command and returns the exit value. Will write to log if enabled.

usage:
$exit = $util->spawn($cmd);
$exit = $util->spawn(cmd => $cmd);
args:
cmd [ArrayRef|Str]

System command to invoke. Can be an arrayref or a string.