« Interpreter/Delegate/Executor/System.pm
↑ Summary
Interpreter/Delegate/FileStore/LocalFileSystem.pm »
| 1 | package Bat::Interpreter::Delegate::Executor::PartialDryRunner; | ||
| 2 | |||
| 3 | 25 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 25 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 25 | ▶ | use Types::Standard qw(ArrayRef); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 25 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 25 | with 'Bat::Interpreter::Role::Executor'; | |
| 10 | |||
| 11 | 25 | our $VERSION = '0.025'; # VERSION | |
| 12 | |||
| 13 | has 'commands_executed' => ( is => 'ro', | ||
| 14 | isa => ArrayRef, | ||
| 15 | 25 | ▶ | default => sub { [] }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 16 | 25 | ); | |
| 17 | |||
| 18 | 33 | ▶ | sub add_command { |
|
Subroutine
add_command: called CC=1 SCAR=0.0
Pod
documented
| |||
| 19 | 33 | push @{ shift->commands_executed }, @_; | |
| 20 | } | ||
| 21 | |||
| 22 | 33 | ▶ | sub execute_command { |
|
Subroutine
execute_command: called CC=1 SCAR=0.0
Pod
documented
| |||
| 23 | 33 | my $self = shift(); | |
| 24 | 33 | my $command = shift(); | |
| 25 | 33 | $self->add_command($command); | |
| 26 | 33 | return 0; | |
| 27 | } | ||
| 28 | |||
| 29 | 1 | ▶ | sub execute_for_command { |
|
Subroutine
execute_for_command: called CC=1 SCAR=0.0
Pod
documented
| |||
| 30 | 1 | my $self = shift(); | |
| 31 | 1 | my $command = shift(); | |
| 32 | 1 | my $output = `$command`; | |
| 33 | 1 | chomp $output; | |
| 34 | 1 | return $output; | |
| 35 | } | ||
| 36 | |||
| 37 | 25 | 1; | |
| 38 | |||
| 39 | __END__ | ||