Test-Exit
view release on metacpan or search on metacpan
lib/Test/Exit.pm view on Meta::CPAN
# We provide one that does effectively nothing, and then override it locally.
# Of course, if anyone else overrides CORE::GLOBAL::exit as well, bad stuff happens.
our $exit_handler = sub {
CORE::exit $_[0];
};
BEGIN {
*CORE::GLOBAL::exit = sub (;$) { $exit_handler->(@_ ? 0 + $_[0] : 0) };
}
sub exit_code(&) {
my ($code) = @_;
return with_return {
local $exit_handler = $_[0];
$code->();
undef
};
}
( run in 0.939 second using v1.01-cache-2.11-cpan-49f99fa48dc )