Object Handlers internal_redirect

2003-01-23 Thread Richard Clarke
I am using an object transhandler like so,

PerlTransHandlerUtil::Tour::Translate-handler

I then have a content handler like so,
Location /banner
SetHandlerperl-script
PerlHandler   Util::Tour::Banner
/Location

My content handler is used to select an image by processing data in the
path_info and performing an internal_redirect to the actual image,
$r-internal_redirect(/img/$id/banners/$img.gif);

However, as soon as the internal_redirect happens (which inevitably triggers
the PerlTransHandler again) I get,

[Thu Jan 23 17:35:36 2003] [error] Undefined subroutine
Util::Tour::Translate-handler::handler called at
/home/www.website.com/lib/Util/Tour/Banner.pm line 66.

So I converted Util::Tour::Translate's handler into a regular non object
handler and everythings works fine. I would rather use object handlers but
this doesn't seem possible if a content handler is performing an
internal_redirect which might invoke that handler.

Can somone shed some light on this for me please.

Richard.

p.s. I didnt yet try converting Util::Tour::Banner into an object handler.
Is it neccessary for all handlers in a chain to be either object or regular
but not a mix?.




Re: Object Handlers internal_redirect

2003-01-23 Thread Geoffrey Young



So I converted Util::Tour::Translate's handler into a regular non object
handler and everythings works fine. I would rather use object handlers but
this doesn't seem possible if a content handler is performing an
internal_redirect which might invoke that handler.


this has been reported before - it's in the archives someplace I'm sure - I 
just haven't had the time to investigate it.  I suspect that it needs a 
patch similar to one I have lying around but that doug wasn't too interested 
in putting into core due to some potential side effects.  when I get a 
moment, I'll try and follow up on it.


Can somone shed some light on this for me please.

Richard.

p.s. I didnt yet try converting Util::Tour::Banner into an object handler.
Is it neccessary for all handlers in a chain to be either object or regular
but not a mix?.


it shouldn't be, no.

some things to try are changing your config to

PerlModuleUtil::Tour::Translate
PerlTransHandler  Util::Tour::Translate

that might work out a bit better (though I suspect you'll then get $r only 
in your handler instead of $self and $r).

you might also want to try

sub handler : method  {
  ...
}

instead of sub handler ($$) {
  ...
}

and see if that changes anything (though I doubt it).

HTH

--Geoff