Re: Can't figure out Error.pm

2005-09-18 Thread Matija Papec
Peter Rabbitson wrote: I then tried to change it in the following way, but I get an error: Can't locate object method "catch" via package "DBException" (perhaps you forgot to load "DBException"?) at ./testerror line 16. ^^^ It seems that you're missing "use DBExc

Re: Can't figure out Error.pm

2005-09-18 Thread John Doe
Peter Rabbitson am Sonntag, 18. September 2005 16.37: [...] Hi > 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

Re: Can't figure out Error.pm

2005-09-18 Thread Peter Rabbitson
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 E

Re: Can't figure out Error.pm

2005-09-18 Thread Peter Scott
On Sun, 18 Sep 2005 01:43:42 -0500, Peter Rabbitson wrote: > I am trying to incorporate cleaner exception handling in my code. Here > is a small illustration (meaningless) of what most of my code looks > like: [...] > I then tried to change it in the following way, but I get an error: > Can't lo

Can't figure out Error.pm

2005-09-17 Thread Peter Rabbitson
I am trying to incorporate cleaner exception handling in my code. Here is a small illustration (meaningless) of what most of my code looks like: package main; use warnings; use strict; my $average = Computer::get_average(); unless ($average) { print "$Computer::ERROR\n"; } 1; package Com