use Test::Exception; dies_ok { testsub("die") } "Dies on inappropriate input"; throws_ok { testsub("die screaming") } qr/arrrgh/, "Dies with appropriate error message"; lives_ok { testsub("survive") } "Survives with appropriate input"; #### use Test::Warn; warning_is { testsub("complain") } qr/nag/, "Gives a specific warning"; warning_is { testsub("quiet") undef, "No warnings given"; #### use Test::NoWarnings;