Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is object oriented exception handling in Perl worth it?

I recently read "Object Oriented Exception Handling in Perl" Perl.com article. Is there any point to use exceptions in Perl?

like image 704
mandel Avatar asked Feb 02 '09 13:02

mandel


People also ask

What advantages does object oriented exception handling provide?

In Object-Oriented Programming (OOP), exceptions are a powerful mechanism for centralized processing of errors and exceptional situations. This mechanism replaces the procedure-oriented method of error handling in which each function returns a code indicating an error or a successful execution.


2 Answers

I should note that the article you referenced is old, and that you should now use Exception::Class instead of Error.pm, which is quirky and tends to break (it's what I call "black magick"). I should note that I am now the Error.pm maintainer, but I no longer recommend it or make use of it for my own code.

like image 116
Shlomi Fish Avatar answered Oct 13 '22 21:10

Shlomi Fish


"is there any point to use exceptions in Perl?"

Yes, I highly recommend reading the "Error Handling" chapter in Perl Best Practices by Damian Conway.

It certainly opened my eyes ;-)

like image 36
draegtun Avatar answered Oct 13 '22 21:10

draegtun