Re: [mp2] Dynamically pushing output filters -- Questions

[prev] [thread] [next] [Date index for 2005/05/21]

From: Stas Bekman
Subject: Re: [mp2] Dynamically pushing output filters -- Questions
Date: 03:19 on 21 May 2005
Chris Jacobson wrote:
> Stas Bekman wrote:
> 
>> Chris Jacobson wrote:
>>
>>> Hello,
>>>
>>>    I am attempting to write a system which allows output filters to 
>>> be dynamicaly pushed on the output filter stack at the end of a 
>>> PerlResponseHandler. 
>>
>>
>>
>> That doesn't make any sense, Chris. By the end of the 
>> PerlResponseHandler the response is gone and there is nothing to 
>> filter. You can only add it *before* you start sending any data.
>>
> Sorry about that.  I am attempting to push the output filter handler 
> before the end of the PerlResponseHandler.   The  code snippet from 
> before which is generating the filter objects is run before calling 
> $r->print().

That's better :)

>> The fact that you get a segfault is not good, we should take care of 
>> that. regardless you code is incorrect.
>>
>>> I can not seem to get anything to work here except a simple coderef.  
>>> This defeats my entire purpose of dynamically pushing filter 
>>> handlers, if they can only be a simple subroutine.  Is there any 
>>> possible way to use an object as a filter handler, or can it only be 
>>> a monolithic subroutine code reference?
>>
>>
>>
>> Filter handlers are very similar to all other mod_perl handlers, so 
>> whatever works for mod_perl handlers works should work for filters.
>> I haven't tried using objects as filter handlers. May be in a few days 
>> unless someone beats me to it.
>>
> Thanks for the response.  I will keep tinkering with it over the weekend 
> to see if I can resolve the seg faults.

I suppose we didn't put enough defense in the code accepting the callback 
argument, expecting the user to do the right thing.


        -- 
        __________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxx.xxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Re: [mp2] Dynamically pushing output filters -- Questions
Stas Bekman 03:19 on 21 May 2005

Generated at 15:53 on 25 May 2005 by mariachi v0.52