Object-InsideOut - Re: Question about multi-field object tests in :Init

Posted on Tue Jun 24 20:02:21 2008 by jdhedden in response to 8148 (See the whole thread of 6)
Re: Question about multi-field object tests in :Init
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.
Direct Responses: 8157 | Write a response