NAME

Proch::Cmd - Execute shell commands controlling inputs and outputs

VERSION

version 0.0041

SYNOPSIS

use Proch::Cmd;


# The module is designed with settings affecting every execution
my $settings = Proch::Cmd->new(
      command => '',
      verbose => 1,
      debug => 1
);

# Settings can be edited at any time
$settings->set_global('working_dir', '/hpc-home/telatina/tmp/');

# Create a new command object
my $c1 = Proch::Cmd->new(
                command => 'ls -lh /etc/passwd /etc/vimrc hello',
                input_files => ['/etc/passwd' , '/etc/vimrc', 'hello'],
                output_files => [],
                debug => 0,
                verbose => 0,
                object => \$object,
);

my $simple = $c1->simplerun();

say $simple->{output} if (! $simple->{exit_code});

NAME

Proch::Cmd - a simple library to execute shell commands

VERSION

version 0.004

METHODS

new()

The method creates a new shell command object, with the followin properties:

command [required]

The shell command to execute

workingdir (default: /tmp) [important]

Command temporary directory, should be the pipeline output directory, can be omitted for minor commands like 'mkdir', but should be set for pipeline steps.

description

Optional description of the command, for log and verbose mode

input_files (array)

A list of files that must exist and be not empty before command execution

output_files (array)

A list of files that must exist and be not empty after command execution

die_on_error (default: 1)

If command returns non zero value, die (default behaviour)

verbose

Enable verbose execution

no_cache

Don't skip command execution if the command was already executed

simplerun()

Executes the shell command returning an object

ACCESSORY SCRIPTS

The 'scripts' directory contain a read_cache_files.pl that can be used to display the content of this module's cache files. The 'data' directory contain a valid example of data file called 'data.ok'. To view its content:

perl scripts/read_cache_files.pl -f data/data.ok

AUTHOR

Andrea Telatin <andrea@telatin.com>

COPYRIGHT AND LICENSE

This software is free software under MIT Licence.

AUTHOR

Andrea Telatin <andrea.telatin@quadram.ac.uk>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2019 by Andrea Telatin.

This is free software, licensed under:

The MIT (X11) License