You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by David Wheeler <Da...@Wheeler.net> on 2001/08/18 20:24:38 UTC

$r->handler() Issue

Hey All,

I've got a PerlTransHandler where I want to disable, under certain
circumstances (that is, whenever the content type isn't 'text/html') the
content handler. However, this code doesn't do the trick:

    $r->handler('default-handler');

And neither does this:

    $r->handler("perl-script");
    $r->set_handlers('PerlHandler' => [ \&OK ])

Or even this:

    $r->handler("perl-script");
    $r->set_handlers('PerlHandler' => [ \&DECLINED ])

None of these snippets affects the content phase in any way; the
PerlHandler I install in httpd.conf gets executed every time, no matter
what. Can anyone tell me how I can disable my PerlHandler for the current
request?

Thanks,

David

-- 
David Wheeler                                         AIM: dwTheory
David@Wheeler.net                                     ICQ: 15726394
                                                   Yahoo!: dew7e
                                                   Jabber: Theory@jabber.org


Re: $r->handler() Issue

Posted by Doug MacEachern <do...@covalent.net>.
On Sat, 18 Aug 2001, David Wheeler wrote:

> Hey All,
> 
> I've got a PerlTransHandler where I want to disable, under certain
> circumstances (that is, whenever the content type isn't 'text/html') the
> content handler. However, this code doesn't do the trick:
> 
>     $r->handler('default-handler');
> 
> And neither does this:
> 
>     $r->handler("perl-script");
>     $r->set_handlers('PerlHandler' => [ \&OK ])
> 
> Or even this:
> 
>     $r->handler("perl-script");
>     $r->set_handlers('PerlHandler' => [ \&DECLINED ])
> 
> None of these snippets affects the content phase in any way; the
> PerlHandler I install in httpd.conf gets executed every time, no matter
> what. Can anyone tell me how I can disable my PerlHandler for the current
> request?

you either need to have a PerlTypeHandler that sets $r->handler and
returns OK (to prevent mod_mime from settting it) or set $r->handler with
a PerlFixupHandler.