Best error handling mechanism?

R

Rob Hoelz

I've read numerous articles on the internet, and I haven't come to a
clear conclusion yet: What form of error handling is best in Perl?
I've seen try/catch with Error.pm, eval/die with Exception.pm, and just
plain old eval/die. What's the best way to go about creating a robust
error handler?

Thanks,
Rob
 
A

anno4000

Rob Hoelz said:
I've read numerous articles on the internet, and I haven't come to a
clear conclusion yet: What form of error handling is best in Perl?
I've seen try/catch with Error.pm, eval/die with Exception.pm, and just
plain old eval/die. What's the best way to go about creating a robust
error handler?

There is no best way.

You haven't even hinted at what kind of project you need error handling
for. It takes intimate knowledge about a project and its surrounding
conditions to make an informed decision about a detail like that.

There is a chapter (or section) about error handling in _Perl Best
Practices_ by Damian Conway. I'd take a look at that for general
points of view. Otherwise, you'll have to do what everybody has to
do: Evaluate the options, identify their advantages and disadvantages
in relation to the project and take a pick.

If that's too tedious (it is tedious) just take a pick and hope for the
best.

Anno
 
M

Michele Dondi

clear conclusion yet: What form of error handling is best in Perl?

The best way is not to make errors at all. Corporate policies should
always include a clause to that effect.


Michele
 
L

Lars Haugseth

* Michele Dondi said:
The best way is not to make errors at all. Corporate policies should
always include a clause to that effect.

assert($USER_IS_INFALLIBLE, 'Go away!');
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Exception Handling 33
Error Handling 27
exception handling mechanism 1
Best practice error handling? 12
Error Handling 1
A general error handling facility 7
should we Go now? 12
Questions about (non-blocking) sockets 8

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top