sharing % across requests

2001-09-06 Thread Miroslav Madzarevic

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.




RE: sharing % across requests

2001-09-06 Thread Geoffrey Young



 -Original Message-
 From: Miroslav Madzarevic [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 06, 2001 10:02 AM
 To: [EMAIL PROTECTED]
 Subject: sharing % across requests
 
 
 BlankWhat is the best way to share % across multiple requests ?

it's called maintaining state - read the eagle book, chapter 5.

one common solution is Apache::Session

HTH

--Geoff



RE: sharing % across requests

2001-09-06 Thread Geoffrey Young



 -Original Message-
 From: Geoffrey Young [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 06, 2001 10:16 AM
 To: 'Miroslav Madzarevic'; [EMAIL PROTECTED]
 Subject: RE: sharing % across requests
 
 
 
 
  -Original Message-
  From: Miroslav Madzarevic [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, September 06, 2001 10:02 AM
  To: [EMAIL PROTECTED]
  Subject: sharing % across requests
  
  
  BlankWhat is the best way to share % across multiple requests ?
 
 it's called maintaining state - read the eagle book, chapter 5.
 
 one common solution is Apache::Session
 

sorry, I think I misread the question - the verbosity threw me.  If you 
are looking to store a datastructure on disk (such as a hash) then you
can use Storable, which allows you to serialize and deserialize your data
on demand.  Apache::Session has the ability to do the same, but it's not
entirely intuitive if you aren't already familiar with it.

there are also basic constructs like PerlSetVar and PerlAddVar, as well as
Apache::Storage...

again, sorry...

--Geoff



Re: sharing % across requests

2001-09-06 Thread darren chamberlain

Geoffrey Young [EMAIL PROTECTED] said something to this effect on 09/06/2001:
   BlankWhat is the best way to share % across multiple requests ?
  
  it's called maintaining state - read the eagle book, chapter 5.
  
  one common solution is Apache::Session
 
 sorry, I think I misread the question - the verbosity threw me.
 If you are looking to store a datastructure on disk (such as a
 hash) then you can use Storable, which allows you to serialize
 and deserialize your data on demand.  Apache::Session has the
 ability to do the same, but it's not entirely intuitive if you
 aren't already familiar with it.

Since he's using HTML::Mason, though, he has some examples of how
to use Apache::Session, and it's pretty easy to set up.  If I am
remembering correctly, many of the code examples in the Mason
docs assume you are using Apache::Session, and one of sample
handler subroutines shows how to use it.

(darren)

-- 
Never make anything simple and efficient when a way can be found to
make it complex and wonderful.



Re: sharing % across requests

2001-09-06 Thread Perrin Harkins

 sorry, I think I misread the question - the verbosity threw me.

No, I think you got it right.  He wants to share a hash between multiple
Apache children.

I recommend using either MLDBM::Sync or Cache::Cache for this.

- Perrin