Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Perl OO, exceptions, etc.

by btrott (Parson)
on Dec 31, 2000 at 08:04 UTC ( [id://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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://49054]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-25 12:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found