Class::AutoClass::Root $obj->throw("This is an exception"); eval { $obj->throw("This is catching an exception"); }; if( $@ ) { print "Caught exception"; } else { print "no exception"; } This package is borrowed from bioperl project (http://bioperl.org/). Because of the formidable size of the bioperl library, Root.pm is included here with modifications. These modifications were to pare its functioanlity down for its simple job here (removing routines that are out of context and removing references to bioperl to avoid confusion). Functions originally from Steve Chervitz of bioperl. Refactored by Ewan Birney of bioperl. Re-refactored by Lincoln Stein of bioperl.

Throwing Exceptions
One of the functionalities that Class::AutoClass::Root provides is the ability to throw() exceptions with pretty stack traces. contact: Chris Cavnor -> ccavnor@systemsbiology.org The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _

new
Purpose : generic instantiation function can be overridden if special needs of a module cannot be done in _initialize

verbose
Title : verbose Usage : $self->verbose(1) Function: Sets verbose level for how ->warn behaves -1 = no warning 0 = standard, small warning 1 = warning with stack trace 2 = warning becomes throw Returns : The current verbosity setting (integer between -1 to 2) Args : -1,0,1 or 2

throw
Title : throw Usage : $obj->throw("throwing exception message") Function: Throws an exception, which, if not caught with an eval brace will provide a nice stack trace to STDERR with the message Returns : nothing Args : A string giving a descriptive error message

stack_trace
Title : stack_trace Usage : @stack_array_ref= $self->stack_trace Function: gives an array to a reference of arrays with stack trace info each coming from the caller(stack_number) call Returns : array containing a reference of arrays Args : none

_stack_trace_dump
Title : _stack_trace_dump Usage : Function: Example : Returns : Args :

deprecated
Title : deprecated Usage : $obj->deprecated("Method X is deprecated"); Function: Prints a message about deprecation unless verbose is < 0 (which means be quiet) Returns : none Args : Message string to print to STDERR

warn
Title : warn Usage : $object->warn("Warning message"); Function: Places a warning. What happens now is down to the verbosity of the object (value of $obj->verbose) verbosity 0 or not set => small warning verbosity -1 => no warning verbosity 1 => warning with stack trace verbosity 2 => converts warnings into throw Example : Returns : Args :

debug
Title : debug Usage : $obj->debug("This is debugging output"); Function: Prints a debugging message when verbose is > 0 Returns : none Args : message string(s) to print to STDERR