The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

App::Run::Command::ToFail - Base class for run-command-to-fail tool.

SYNOPSIS

use App::Run::Command::To::Fail;

my $app = App::Run::Command::ToFail->new;
my $exit_code = $app->run;

METHODS

new

my $app = App::Run::Command::ToFail->new;

Constructor.

Returns instance of object.

run

my $exit_code = $app->run;

Run.

Returns 1 for error, 0 for success.

EXAMPLE

use strict;
use warnings;

use App::Run::Command::ToFail;
use File::Temp qw(tempfile);
use IO::Barf qw(barf);

my (undef, $tmp_file) = tempfile();
barf($tmp_file, <<'END');
use strict;
use warnings;

print ".";
END

# Arguments.
@ARGV = (
        '-n', '10',
        $tmp_file,
);

# Run.
my $exit = App::Run::Command::ToFail->new->run;

unlink $tmp_file;

exit $exit;

# Output like:
# ..........Everything is ok.

DEPENDENCIES

Getopt::Std, Readonly.

REPOSITORY

https://github.com/michal-josef-spacek/App-Run-Command-ToFail

AUTHOR

Michal Josef Špaček mailto:skim@cpan.org

http://skim.cz

LICENSE AND COPYRIGHT

© 2023-2024 Michal Josef Špaček

BSD 2-Clause License

VERSION

0.05