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";