use strict; use warnings; use Test::More; use Test::Exception; use Capture::Tiny qw(capture); ... # expected death my ($out, $err, @res) = capture { dies_ok { a_sub_that_dies() } 'expected to die without arguments'; }; # verbosity check ($out, $err, @res) = capture { $obj->method( verbose => 2 ); }; ok ((split "\n", $out) > 30 , "30+ lines expected with verbosity = 2"); # checking exit status (you can check 'perl your_modulino_or_script arg1 arg2..' ) my $exit = system "$program /? >nul 2>&1"; ok ( 16 == ($exit>>8), "[$program /? >nul 2>&1] returned the expected value");