|
|
Choosing A Webhost: |
Re: proposal for filter_init implementation (was: Re: rfc: new filtering AP: msg#00046apache.mod-perl.devel
Geoffrey Young wrote:
Why complicating things. If you assign an init sub it's always run once before the filter is invoked for the first time. You don't invoke it by yourself. But if you want to, you don't have to use an init mechanism (once it's added and simply do: sub my_init {} sub my_filter { unless ($f->ctx->{init_done}) { my_init(); $f->ctx->{init_done}++; } } That's exactly why I was asking you, whether we really need the filter init mechanism, since it's so easy to implement it when you need it. [...] sub handler : FilterRequestHandler FilterInitHandler('my_init') {} Mandatory? Why in the world do you want to make them mandatory? as for anonymous subs, we won't be able to use them now or ever? I know there are some incomplete issues with using anonymous subs in certain areas (such as inlined in httpd.conf) but I was assuming that they would be non-issues eventually. Now with handlers. You can certainly push (once anon handlers are supported) $r->add_input_filter(sub {...}); As for attributes I simply don't know how would you go about doing: sub handler : FilterRequestHandler FilterInitHandler( sub {...} ) {} I'm not sure whether this works: $r->add_input_filter(sub FilterInitHandler( sub {...} ) {...} ); 2) Another alternative is to change the way PerlInputFilterHandler is I see what you mean. But that depends on whether the attributes approach will really work. I'll give it a try today. I still think that most filters will have no init handler. I haven't seen the promised arguments of why do you think it should be mandatory. the flip side of this is that if you give the module writer no interface to filter_init (such as solution #1) then module writers have no way to make the init routine required. yucko. Eh? But both give you an interface to filter_init, I don't follow you. The perl API is easy, just change: No special reason at all. It was just copy-n-paste and I guess the editor was showing the input filters at that moment. You may want to run filter_init for input filters to initialize the filter, unless you use the technique with $f->ctx, which seems just fine to me. __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:stas@xxxxxxxxxx http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: proposal for filter_init implementation (was: Re: rfc: new filtering APIs), Geoffrey Young |
|---|---|
| Next by Date: | Re: cvs commit: modperl-2.0 Changes, Stas Bekman |
| Previous by Thread: | Re: proposal for filter_init implementation (was: Re: rfc: new filtering APIs), Geoffrey Young |
| Next by Thread: | Re: proposal for filter_init implementation (was: Re: rfc: new filtering APIs), Geoffrey Young |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |