Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Apache2. Passing data between handlers

by gryphon (Abbot)
on Apr 25, 2007 at 00:24 UTC ( #611884=note: print w/ replies, xml ) Need Help??


in reply to Apache2. Passing data between handlers

Greetings artemave,

I think the problem here is that there are two seperate HTTP requests. First, the user sends an HTTP request for a page that executes code out of your first handler and ends with a return of SERVER_ERROR. That's going to complete the HTTP request and redirect the browser to dir_browse::error. So anything in pnotes will not exist across the two requests.

You could try a different approach, maybe. You might want to look into calling dir_browse::error in the first handler just before you return SERVER_ERROR. I don't know the rest of your app, but also, you may want to look at throwing exceptions.

DISCLAIMER: Note that this is all from my tired head without any testing. I could be very wrong.

gryphon
Whitepages.com Development Manager (WDDC)
code('Perl') || die;


Comment on Re: Apache2. Passing data between handlers
Re^2: Apache2. Passing data between handlers
by artemave (Beadle) on Apr 25, 2007 at 16:21 UTC
    Hello, gryphon.

    "You might want to look into calling dir_browse::error in the first handler just before you return SERVER_ERROR"

    That means I don't need special error handler at all, do I?
    The top catch block will do all the work, right?

    That was the way until I thought it could look better. I mean, no need to worry about error handling in the main app, all the stuff will come up behind the scene.

    Either way, still an opened question here: is there a way to pass data between two handlers? Like if I ever need to build a chain of redirects or something.
    I'm pretty sure I'm missing something obvious after all. Or the whole idea is wrong and everybody does this and that, because it is so easy and obvious.

    Thanx,
    Artem.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://611884]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2014-09-03 02:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (35 votes), past polls