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

Re: Log4perl swallowing $@

by ikegami (Patriarch)
on Oct 28, 2010 at 20:03 UTC ( [id://868138]=note: print w/replies, xml ) Need Help??


in reply to Log4perl swallowing $@

You're surprised that a commonly used global variable gets used? Yeah, the logger should localise it's use — file a bug report — but that's rarely done, and it's not biggy that it doesn't.
if (my $e = $@) { print $e; $logger->debug('test'); print $e; print 'after printing $e'; }

Replies are listed 'Best First'.
Re^2: Log4perl swallowing $@
by saberworks (Curate) on Oct 28, 2010 at 20:31 UTC
    You're right, it should be obvious that any external bit of code could use $@, thanks for that. I'm so used to seeing if($@) { # handle error } that I didn't really think about it properly.
      Oh I don't know about that. Actually, I think you *are* thinking about it properly. Although it makes sense that external code will refer to certain variables, it is natural to expect that said code won't walk all over those variables without restoring them or at least telling you about it in some way. File that report, in my opinion.
        There is no bug, the expectations are wrong

        The variable $@ is never touched in Log4perl

        However log4perl does use eval

        Its just like $!, its only valid immediately after a system call, if you want to use it at few lines later, you have to cache it.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2026-04-15 10:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.