The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Command::Template::Runner::Record

SYNOPSIS

   use Command::Template 'cr';

   my $runner = cr(qw{ ls [options=-l] <dir> });
   my $run = $runner->run(options => '-la', dir => '/usr');

   say $run->stdout if $run->success;
   say $run->stderr if $run->failure; # same as ! $run->success
   say 'killed by signal ' . $run->signal if $run->signal;
   say 'exit value was' . $run->exit_code;

DESCRIPTION

This class represents the outcome of a single run by Command::Template.:Runner; it can be used to investigate the outcome in all its parts (e.g. error conditions, what was printed on standard output, what was printed as standard error, etc.

INTERFACE

command

   my $aref = $run->command;

Returns a reference to an array containing the expanded command that was executed.

command_as_string

   my $s = $run->command_as_string;

Returns a stringification of the whole command (assumes using "command");

exit_code

   my $ec = $run->exit_code;

The process's exit code.

failure

   say 'failed' if $run->failed;

Check whether the invocation failed. It is the opposite of "success".

full_exit_code

   my $integer = $run->full_exit_code;

The *full* exit code, including the exit code in the higher byte of the pair and the termination signal in the lower.

merged

   my $text = $run->merged;

A mix of standard error and standard output. At the moment first standard error, then standard output.

new

   my $object = Command::Template::Runner::Record->new($data);

Constructor (it is not generally meant to be used by end customers).

options

   my $href = $run->options;

A reference to the hash set for options while running. This might e.g. contain a key stdin with the standard input provided to the child process.

signal

   my $sig = $run->signal;

The signal integer code, in case the child process was terminated due to an unhandled signal.

stderr

   my $text = $run->stderr;

What was sent out to standard error.

stdout

   my $text = $run->stdout;

What was sent out to standard output.

success

   say 'everything ok' if $run->success;

Check whether the invocation succeeded. It is the opposite of "failure":

timed_out

   my $bool = $run->timed_out;

Check whether the operation timed out or not.

timeout

   my $int = $run->timeout;

Returns the timeout value. This is 0 if no timeout was set or the command exited without reaching the timeout.

ANYTHING ELSE (INCLUDING AUTHOR, COPYRIGHT AND LICENSE)

See documentation for Command::Template.