Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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. :)


Comment on Re: Perl OO, exceptions, etc.
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2014-09-20 23:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (163 votes), past polls