Using Exception::Class
- An example from RT::Client::REST
use Exception::Class ( 'RT::Client::REST::OddNumberOfArgumentsException' => { isa => __PACKAGE__, description => "This means that we wanted name/value pairs", }, 'RT::Client::REST::InvaildObjectTypeException' => { isa => __PACKAGE__, description => "Invalid object type was specified", }, 'RT::Client::REST::MalformedRTResponseException' => { isa => __PACKAGE__, description => "Malformed RT response received from server", }, # ... );