You can use the Test::Exception module and test with either dies_ok(tests for death) or throws_ok (tests for death with a specific error message).
use Test::Exception => 1; throws_ok { dying_sub() } qr/I always die/, "sub dies with correct err +or message";
In reply to Re: testing a croak
by tirwhan
in thread testing a croak
by arcnon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |