MooX::Ipc::Cmd - Moo role for issuing commands, with debug support, and signal handling
version 1.2.1
This role provides the ability to capture system calls, and to execute system calls.
Features
Prints output in realtime, in debug mode
Handles signals, and kills via signal if configured too.
Uses Log::Any for logging. If in debug mode, will log output of commands, and execution line
Command line option
package Moo_Package; use Moo; use MooX::Options; # required before with statement with qw(MooX::Ipc::Cmd); has '+_cmd_kill' => (default=>1); # override default sub run { my $self=shift $self->_system(['cmd']); my @result=$self->_capture(['results']); } 1; package main use Log::Any::Adapter('Stdout'); #setup Log::Any::Adapter; my $app=Moo_Package->new_with_options(_cmd_kill=>0); #command line processing my $app=Moo_Package->new(_cmd_kill=>0); #no command line processing 1;
If set to 1 will send the propgate signal when cmd exits due to signal.
Reader: _cmd_kill
Default: 1
Mocks the cmd, does not run
Reader: mock
Default: 0
Command line option, via MooX::Options
Runs a command like system call, with the output silently dropped, unless in log::any debug level
$cmd : arrayref of the command to send to the shell %opts valid_exit => [0] - exits to not throw exception, defaults to 0
exit code
Throws an error when case dies, will also log error using log::any category _cmd
Runs a command like qx call. Will display cmd executed
$cmd: arrayref of the command to send to the shell %opts: valid_exit => [0] - exits to not throw exception, defaults to 0
combined stderr stdout
Throws an MooX::Ipc::Cmd::Exception error
Eddie Ash <eddie+cpan@ashfamily.net>
This software is copyright (c) 2015 by Edward Ash.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install MooX::Ipc::Cmd, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MooX::Ipc::Cmd
CPAN shell
perl -MCPAN -e shell install MooX::Ipc::Cmd
For more information on module installation, please visit the detailed CPAN module installation guide.