Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

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 John Coltrane plays...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2018-02-24 08:39 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (310 votes). Check out past polls.