use strict; use warnings; use Test::More (tests => 3); use Test::Exit; exit_ok { exit } "exit called"; exit_nok { } "exit not called"; exit_with { exit 2; } 2, 'exit code = 2';