Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Perl OO, exceptions, etc.

by btrott (Parson)
on Dec 31, 2000 at 08:04 UTC ( #49054=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Re:: Adam:: Re:: OO-style question
in thread OO-style question

When speaking of OO methods, you wrote:
> They need to be able to throw named exceptions which the > caller can choose to catch or not. die is the closest thing to a +n > exception in Perl, and eval is a long way from a try block.
Have you tried using a custom Perl solution for this? Graham Barr's Error module (direct doc link) lets you use standard try and catch semantics for exception handling. I've not used it, because I've always just stuck w/ eval, because it works for me. :)

You might also take a look at Exception::Class, a base exception class on which you can base any exceptions your system wishes to throw.

You also wrote:

> Worse, perl's sub routine simplicity of having subroutines > take a variable number of arguments ...
Have you ever looked at Class::MultiMethods? It might help you in this area, if you like that sort of structured stuff. :)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://49054]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2018-06-24 10:10 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.