Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: and custom Exception

by fmerges (Chaplain)
on Feb 24, 2009 at 11:57 UTC ( #745973=note: print w/ replies, xml ) Need Help??

in reply to and custom Exception


As said already, you don't get $self in the constructor... it's $class, so you should have:

my $self = $class->SUPER::new(...)

Beside of this, I would strongly recommend you to not use, based on my own experience. Some reasons:

* If you forget the ; at the end of your try...catch block you will have hard time trying to find obscure bugs, what you see in the code is not what is being executed.
* You have to include in every place you want to use the try...catch syntax sugar the 'use Error qw(:try)' and not only the subclassed exeption class. You will not get compiling error, it will just not work as expected.
* Debugging is also painful, the code executed inside of the try...catch blocks are wrapped, so it makes debugging using the debugger a pain; check it out for yourself.

For these reasons I would rather recommend you to use Exception::Class instead.


fmerges at

Comment on Re: and custom Exception
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2015-11-26 10:43 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (697 votes), past polls