Test::Exception

Alternatively, use Test::Exception

use Test::Exception;
use Test::More tests => 2;
throws_ok { die "Wibble\n" } "Wibble\n";
lives_and { is( the_function_that_wouldnt_die(), 42 ) };

| toc |