"Perl for Perl Newbies" - Part 4ExceptionsThe Error.pm module

6.3. The Error.pm module

The Error.pm module, which is available from CPAN, supplies object oriented exception handling. Namely, one can catch exceptions of a certain class explicitly, and differentiate between several types of exceptions.

Error.pm provides a lot of syntactic sugar that tends to break easily. As such, its use is not too recommended.

On the other side, there's the Exception-Class module which provides object-oriented exceptions with no special syntactic sugar, and which works very well. Its use is highly recommended.

Throwing objects which are associated with classes is a good way to be able to handle one's exceptions programatically .

Written by Shlomi Fish