use Exception::Class ( 'My::Project::Exception::Queue' => {}, # abstrakt 'My::Project::Exception::Queue::Underrun' => { isa => 'My::Project::Exception::Queue', alias => 'throw_queue_underrun', }, 'My::Project::Exception::Queue::AllocationFail' => { isa => 'My::Project::Exception::Queue', fields => [qw(caused_by)], alias => 'throw_queue_allocationfail', }, ); throw_queue_underrun(sprintf( 'tried to deallocate %u, but only %u left', scalar(@q_remove), $self->queue->stat->count )); # das Beispiel hier drüber ist Murks und kann ein bisschen Nachbesserung # vertragen, so dass man die Zahlen nicht herausparsen muss, sondern als # Attribut am Fehlerobjekt verfügbar hat throw_queue_allocationfail message => 'Reserved memory exhausted', caused_by => 'rigging layer';