On Sun, Sep 18, 2005 at 07:14:16AM -0700, Peter Scott wrote: > On Sun, 18 Sep 2005 01:43:42 -0500, Peter Rabbitson wrote: > > > sub get_values { > > > > #fail right away > > throw DBException ("Sorry, bank is empty"); > > } > > > > Each exception needs to be a class that inherits from Error, so: > > BEGIN { @DBException::ISA = 'Error' } >
The way the documentation was written I thought that throw is an exported subroutine, whereas in reality the example meant DBException->throw(whatever). Indirect invocation sucks :) By the way, since I throw the exception above as plain text (not as hashref with -text => xxxx), I need to inherit from Error::Simple. This raises another question though - I thought in order to have a class I *must* declare a package. However you get away by simply initiating a variable. Does autovivification work for packages just like it does for hash keys? Thanks! Peter -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>