You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Miroslav Madzarevic <mi...@netymology.com> on 2001/09/06 16:01:55 UTC

sharing % across requests

BlankWhat is the best way to share % across multiple requests ?

I first tried with $r->notes('name'=>'value') but that wasn't persistent
across requests (or maybe I was doing it wrong ?).
Then I made a system to load data from database once at process ($$) startup
and then fetch it from % (module global) on every request reloading hash if
there were any changes (add, delete, I used a file modif. date as an
indicator) and it works well but:
    1) it wasn't easy for me - this was my first time doing this
    2) I think it could be improved by making a module and tying hash to
that class. Now I have to call a sub to see if the hash needs to be reloaded
before using it in any sub.

The main point is that a have a small subset of variables that don't change
often but are often queried.

I'm developing in HTML::Mason. tnx.