21.13. Sharing Information Between Handlers21.13.1. ProblemYou want to share information between handlers, but global variables are global to a process and not automatically cleaned up after every request. 21.13.2. SolutionUse Apache pnotes (Perl notes):
21.13.3. DiscussionApache modules communicate with each other using notes (see Recipe 21.11). Apache notes act like a hash attached to a request—one handler stores a value for a key in the hash, so that another handler can read it later. The Perl notes features is also a hash attached to the request object, but it's only for the Perl handlers. To set a pnote, pass a key and a value to the $r->pnotes method. To retrieve a pnote, pass only the key. You can store complex data structures:
and even objects:
21.13.4. See AlsoRecipe 8.11 in mod_perl Developer's Cookbook; Apache::Table; pnotes method in the Apache manpage
Copyright © 2003 O'Reilly & Associates. All rights reserved. |
|