modperl_prev_and_next

This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.



To: modperl@apache.org
From: "B. Burke" <bcburke@mindspring.com>
Subject: help with custom Error documents/redirection
Date: Wed, 13 Dec 2000 10:44:15 -0500

I'm looking to implement custom error handling, and I'm hitting a snag.
I'm hoping to do something like on pg.168 of the Eagle book, where you
have a handler and user $r->prev to get the original request.

I'm wanting to redirect to 1 of 2 pages, depending on what the
requested page was.  I plan on using $r->custom_response to do the
redirection (as shown on pg. 170 of the Eagle bk).

The problem I'm having is that $r->prev doesn't seem to be getting
the request.  I setup a <Location> for the handler, and setup an
ErrorDocument to point to the Location.  It works, except that I can't
seem to get $r->prev to tell me what the request was.

Any help will be greatly appreciated.

Thanks,
Brian B.

===

To: "'bcburke@mindspring.com'" <bcburke@mindspring.com>,
modperl@apache.org
From: Geoffrey Young <gyoung@laserlink.net>
Subject: RE: help with custom Error documents/redirection
Date: Wed, 13 Dec 2000 11:03:43 -0500

> -----Original Message-----
> From: B. Burke [mailto:bcburke@mindspring.com]
> Sent: Wednesday, December 13, 2000 10:44 AM
> To: modperl@apache.org
> Subject: help with custom Error documents/redirection
> 
> 
> I'm looking to implement custom error handling, and I'm 
> hitting a snag.
> I'm hoping to do something like on pg.168 of the Eagle book, where you
> have a handler and user $r->prev to get the original request.
> 
> I'm wanting to redirect to 1 of 2 pages, depending on what the
> requested page was.  I plan on using $r->custom_response to do the
> redirection (as shown on pg. 170 of the Eagle bk).
> 
> The problem I'm having is that $r->prev doesn't seem to be getting
> the request.  I setup a <Location> for the handler, and setup an
> ErrorDocument to point to the Location.  It works, except that I can't
> seem to get $r->prev to tell me what the request was.

you know that $r->prev returns a request object, and not anthing specific
(like the previous location), right?  :)

if you're still unable to get it working, try pointing custom_response to a
script that gleans $r->prev->uri and returns the proper response based on
that...  the whole error document cycle is hard to get until you get it.
keep playing and you'll see the light eventually :)

BTW, it's always good (at least I've found) to call
my $prev_uri = $r->prev ? $r->prev->uri : $r->uri;
because if the page/script is accessed directly then $r->prev is undefined
and you get a runtime error.

HTH

===

To: Geoffrey Young <gyoung@laserlink.net>
From: Doug MacEachern <dougm@covalent.net>
Subject: RE: help with custom Error documents/redirection
Date: Thu, 21 Dec 2000 22:13:40 -0800 (PST)

On Wed, 13 Dec 2000, Geoffrey Young wrote:
 
> BTW, it's always good (at least I've found) to call
> my $prev_uri = $r->prev ? $r->prev->uri : $r->uri;

or with one less method call :)
my $prev_uri = ($r->prev || $r)->uri; 

===

To: "'Doug MacEachern'" <dougm@covalent.net>
From: Geoffrey Young <gyoung@laserlink.net>
Subject: RE: help with custom Error documents/redirection
Date: Fri, 22 Dec 2000 08:29:26 -0500

now that's cool - I just love perl...

===


the rest of The Pile (a partial mailing list archive)

doom@kzsu.stanford.edu