Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Log4perl swallowing $@

by saberworks (Curate)
on Oct 28, 2010 at 20:31 UTC ( #868143=note: print w/replies, xml ) Need Help??


in reply to Re: Log4perl swallowing $@
in thread Log4perl swallowing $@

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.

Replies are listed 'Best First'.
Re^3: Log4perl swallowing $@
by Urthas (Novice) on Oct 28, 2010 at 23:04 UTC
    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.

        Agree with this one. Nobody shall assume that $@ or $! or $? would keep their values for ever. It would be tedious job trying to properly localize all of the variables that your code may indirectly affect.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://868143]
help
Chatterbox?
[shmem]: perl -e 'warn "test$/", ^@^ '
[Eily]: well, at least it's right about warn doing the same thing as die :)
[shmem]: same with undef as last element
[msh210]: oh, good point. It's the best kind of correct
[shmem]: msh210: but I'd not call it a lie outright. That's when you do know the truth.
[msh210]: I don't have sendmail (I'm on MS Windows), so does one of you think you can report the bug?
[shmem]: msh210: 'tis about time to tell the sad truth to perl5porters - via perlbug
[msh210]: probably whoever wrote that actually knows the truth
[shmem]: msh210: you can save the perlbug text in a file and send that via your mail agent of choice
[msh210]: hm, okay, I'll try, thanks

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (15)
As of 2017-04-24 12:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (439 votes). Check out past polls.