Re: Pushing OutputHandler using PerlFixupHandler

[prev] [thread] [next] [Date index for 2005/03/22]

From: Stas Bekman
Subject: Re: Pushing OutputHandler using PerlFixupHandler
Date: 15:33 on 22 Mar 2005
Tom Schindl wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> [...]
> 
> Stas Bekman wrote:
> 
> |
> | I suppose it'd be nice to mention those in
> | http://perl.apache.org/docs/2.0/user/handlers/filters.html
> | patches are welcome :)
> |
> 
> [...]
> 
> Here's a proposed patch for the docs. I didn't manage to create diff
> using the svn diff -u. Is this command apropiate for svn? My client
> tells me that -u means update and is not accepted by subcommand diff. Is
> this an error in the docs?
> 
> http://perl.apache.org/download/docs.html#Submitting_documentation_patches

Yeah, the remnants of the cvs notes :( I thin 'svn diff' does the unified 
diff by default. I've fixed that. Thanks Tom.

> Index: src/docs/2.0/api/Apache/RequestUtil.pod
> ===================================================================
> --- src/docs/2.0/api/Apache/RequestUtil.pod	(Revision 158584)
> +++ src/docs/2.0/api/Apache/RequestUtil.pod	(Arbeitskopie)
> @@ -890,6 +890,11 @@
>    $ok = $r->push_handlers($hook_name => \&handler);
>    $ok = $r->push_handlers($hook_name => ['Foo::Bar::handler', \&handler2]);
>  
> +Please note: To push input/output filters you have to use 
> +C<L<Apache::Filter|docs::2.0::api::Apache::Filter>> methods 
> +C<Apache::Filter-E<gt>add_input_filter($callback)> and
> +C<Apache::Filter-E<gt>add_output_filter($callback)>.
> +
>  =over 4

Better to add an xref L<>, but I'll do that.

>  =item obj: C<$r>
> Index: src/docs/2.0/user/handlers/filters.pod
> ===================================================================
> --- src/docs/2.0/user/handlers/filters.pod	(Revision 158584)
> +++ src/docs/2.0/user/handlers/filters.pod	(Arbeitskopie)
> @@ -909,9 +909,29 @@
>  C<L<DIR|docs::2.0::user::config::config/item_DIR>>.
>  
>  
> +=head2 Adding OutFilters dynamically
>  
> +If you have the need to add output filters dymically during the request. 
> +mod_perl 2.0 offers you the possibility to push filter callbacks during 
> +the request is processed:
>  
> +  package MyApache::AddFilterDyn;
> +  
> +  use Apache::RequestRec;

this is not used by the module as far as I can see.

> +  use Apache::Const qw(:common);

why importing constants when you don't use them in the imported form?

> +  use Apache::Filter;
> +  use MyApache::FilterObfuscate;
>  
> +  sub handler {
> +    my $r = shift;
> +
> +    $r->add_output_filter(\&MyApache::FilterObfuscate::handler);
> +
> +    return Apache::OK;
> +  }

and finally the config section is lucking. Otherwise users will not know 
when this handler is run :)

Thanks Tom.

        -- 
        __________________________________________________________________
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

(message missing)

Pushing OutputHandler using PerlFixupHandler
Thomas Schindl 12:08 on 21 Mar 2005

Re: Pushing OutputHandler using PerlFixupHandler
Geoffrey Young 12:47 on 21 Mar 2005

Re: Pushing OutputHandler using PerlFixupHandler
Stas Bekman 15:33 on 22 Mar 2005

Generated at 15:10 on 27 Mar 2005 by mariachi v0.52