Bat-Interpreter

 view release on metacpan or  search on metacpan

lib/Bat/Interpreter/Delegate/Executor/System.pm  view on Meta::CPAN

package Bat::Interpreter::Delegate::Executor::System;

use utf8;

use Moo;
use namespace::autoclean;

with 'Bat::Interpreter::Role::Executor';

our $VERSION = '0.025';    # VERSION

sub execute_command {
    my $self    = shift();
    my $command = shift();
    return system($command);
}

sub execute_for_command {
    my $self    = shift();
    my $command = shift();
    my $output  = `$command`;
    chomp $output;
    return $output;
}

1;

__END__

=pod

=encoding utf-8

=head1 NAME

Bat::Interpreter::Delegate::Executor::System

=head1 VERSION

version 0.025

=head1 SYNOPSIS

    use Bat::Interpreter;
    use Bat::Interpreter::Delegate::Executor::System;

    my $system_executor = Bat::Interpreter::Delegate::Executor::System->new;

    my $interpreter = Bat::Interpreter->new(executor => $system_executor);
    $interpreter->run('my.cmd');

=head1 DESCRIPTION

Every command gets through system. So if you are in Linux using bash, bash will try to execute the command.

This executor is as dumb and simple as it can, be cautious.

=head1 NAME

Bat::Interpreter::Delegate::Executor::PartialDryRunner - Executor for executing commands via perl system

=head1 METHODS

=head2 execute_command

Execute general commands.



( run in 1.100 second using v1.01-cache-2.11-cpan-39bf76dae61 )