CBT::Exception -- base class for exceptions $Id:,v 1.2 2003/05/12 22:24:00 rkh Exp $


 package MyModule::Exception;
 use base CBT::Exception;

 package MyModule;
 if ($failed)
   { throw MyModule::Exception; }


CBT::Exception is a base class for exceptions. It may be used as-is or as a base class for other exceptions. It is based on with enhancements for providing more informative feedback and run-time control of feedback levels.

At the time of this writing, one really needs two components to use exceptions: 1) an exception class, 2) the language extensions which enable the try...catch...finally syntax. This module provides a base class for (1); `use CBT::Exceptions' for (2).

A CBT::Exception instance has these attributes:


error is a short (1 line) description of the problem. Consider using $! if nothing else.

detail (optional)

detail provides more details about the nature of the problem. The contents of this field are word-wrapped.

advice (optional)

advice provides advice about how to rememdy the error. The contents of this field are word-wrapped.

When thrown, a CBT::Exception looks like this:

 ! MyModule::Exception occurred: invalid argument
 Detail: you provided 0 for your IQ; the valid range is 1..10
 Advice: soak your head


::new( {error=>..., detail=>..., advice=>...} )
::new( error, detail, advice )

creates a new exception with the spe

SEE ALSO -- where all the hard work's done


 Reece Hart E<lt>reece@in-machina.comE<gt>

1 POD Error

The following errors were encountered while parsing the POD:

Around line 49:

=back doesn't take any parameters, but you said =back 4