|
The proper way is to create an appropriate Exception::Class
class that subclasses OIO:
package Foo; {
use Object::InsideOut;
use Exception::Class (
'Foo::Err' => {
'isa' => 'OIO',
'description' => q/Bad 'Foo' thing happened/,
}
);
sub _init :Init
{
Foo::Err->die('message' => q/Your 'Foo' is bad/);
}
}
package main;
my $obj = Foo->new('arg' => 'bar');
See the
DIAGNOSTICS section of the POD for how to trap such
errors. And, of course, read about
Exception::Class.
|