use Test::Exception => 1; throws_ok { dying_sub() } qr/I always die/, "sub dies with correct error message";