perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philippe M. Chiasson" <go...@ectoplasm.org>
Subject Re: Filter and Handlers should not reset $@ if it was set before entering
Date Mon, 09 Aug 2004 22:08:39 GMT


Philippe M. Chiasson wrote:
> 
> Stas Bekman wrote:
> 
>>Philippe M. Chiasson wrote:
>>
>>
>>
>>>>Would it be better to localize $@ instead of copying and restoring it?
>>>
>>>
>>>I wish we could do that, and it was the first thing I attempted.
>>>
>>>The problem is that if we do that, even conditionnaly only when $@ is set
>>>on entry, it means that any _real_ errors triggered during the execution
>>>of the handler (setting $@) will also be lost and replaced with the 
>>>previous
>>>value for $@.
>>>
>>>That's why we need to save $@ if it was set, and only restore if nothing
>>>failed during handler execution, otherwise we squish the new $@.
>>
>>
>>I see. So in case the filter has failed, and the response handler has 
>>failed we won't see the error from a response handler. So that solves 
>>only half a problem, as we still lose handlers $@
> 
> 
> Ah, I see, I didn't consider that failure case.
> 
> 
>>That's why I thought that it'll be better to find a different place to 
>>localize $@, i.e. outside the scope of the code that runs the handler 
>>and checks $@ on return. but this is probably not quite feasible. How 
>>about making a special case for filters (inside the filters code).
> 
> 
> Yes, this $@ save/restore logic could be added to filters only. But, still,
> in the case of a failing response handler & filter handler, you'd lose the
> error from the filter.

At least, here is a patch that does the same thing, but only for filters.

> Maybe we need to be smarter about this a bit and somehow concatenate the
> errors ?
> 

-- 
--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5

Mime
View raw message