Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: $@ gets set differently on eval and Log::Dispatch::Email

by Pickwick (Beadle)
on Aug 12, 2013 at 17:24 UTC ( [id://1049150]=note: print w/replies, xml ) Need Help??


in reply to Re^2: $@ gets set differently on eval and Log::Dispatch::Email
in thread $@ gets set differently on eval and Log::Dispatch::Email

I couldn't find any combination of DESTROY and eval in Log::Dispatch but there must be one somewhere as without Log::Dispatch everything was working fine...

For some reason the cause of the problem was not in Log:.Dispatch, but in one of my classes and their destructors. I didn't use eval directly, but indirectly it was used somewhere within Log4perl, which was used to log some debug statements in the destructor. After I added local $@; before the logging statements error trapping worked again. Don't know why the problem was only triggered using Log::Dispatch, though.

Looks like I have to really switch to Devel::EvalError in the future, problems like this are very hard to find.

  • Comment on Re^3: $@ gets set differently on eval and Log::Dispatch::Email

Replies are listed 'Best First'.
Re^4: $@ gets set differently on eval and Log::Dispatch::Email
by vsespb (Chaplain) on Aug 12, 2013 at 18:30 UTC
    It would be easier to find, if you always use
    eval { main(); 1; } or do { # error handling with $@ }
    that way you will at least find that error happened.

      Looks pretty nice and creates short lines, thanks!

Log In?
Username:
Password:

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

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

    No recent polls found