From: J. D. B. <jd...@go...> - 2006-12-04 19:54:45
|
I'm trying to do a minimal setup of Log::Log4perl for an existing applica= tion. I've setup my __WARN__ and __DIE__ signal handlers to wrap warn() an= d die(), but I'm running into a problem. A portion of my code expects to d= o the following: eval { ... }; if ($@) { return if $@ =3D~ m/particular error to ignore/; die $@; } In other words, I execute a piece of code that I expect may throw a parti= cular type of exception. If that exception occurs, I don't want to hear ab= out it. I just want to ignore it and go on to the next step. However, if = and only if some other situation occurs, I want the code to die. The problem is that now that __WARN__ and __DIE__ are wrapped, the except= ion that I wanted to ignore is now getting logged. I don't want that. I w= ant it to be completely silent. (Failing that, I'd like to log it at a ver= y low level.) Basically, I'm wanting Log::Log4perl to read my mind and realize that sin= ce I eval'ed the code, I don't want anything to get logged. Can this be ac= complished in some way? Failing that, what is the recommendation for how I= should handle this? I'd rather not customize the %SIG handlers to deal wi= th particular messages ... I may have a situation where I want particular m= essages ignored if they occur in an eval, but not if they occur in regular = code. Is there a way to accomplish this? jdb |