(
Strange... I think I submitted this node once. But since I can't
see it here, I'll try to repost. Pardon me if i'm wrong :))
Let me try to help your ignorance ;-).
First, OO-ish style of error handling (where objects such as Error
are involved etc.) is a concept easily understood by anyone
who's ever sinned with any other language than Perl. I
confess to having had a lot of dealing with Java (and continue
to do so until even now) and C/C++. Therefore, dealing with
similar (in terms of look and logic) error handling mechanism
in Perl is something natural to me. It is not to say, however,
that I lack appreciation for the good old eval/die construct.
These are perfectly good in their own right.
Further, OO-ish approach allows for a number of other 'conveniences' (if
I could put it that way...). To name a few, I could for example
encapsulate error handling code inside an easy to understand/work with
Error class. For example, i could write an Error class that would
write to a special Log file and optionally even email certain
party of interest (such as sysadmin...) on any error. Having tucked
this into would also clear my main program code and make the main
logic easy to understand. There also may be certain errors that might
have to be handled in a particular way. For certain purposes
creation of separate Error type classes is well warranted.
Say, you could write an Error::DBIFail exception class to handle
rall back procedures in case of a DBI fail (I know DBI may provide
for a basic rallback mechanism... yet that may not always suffice the need).
I hope my ran was helpful? ;)
|
"There is no system but GNU, and Linux is one of its kernels." -- Confession of Faith
|