Re: Passing data among handlers

2001-02-05 Thread Perrin Harkins

Drew Taylor wrote:
> 
> I have a slightly different twist on this question. We run Registry scripts on
> our site for debugging purposes. I would love to have a module for saving
> variables/data structures on a per-request basis (like the current Apache
> notes), but internally using pnotes under mod_perl, and some other mechanism
> (package vars like I'm using now?) under everything else.

We do that.  It's pretty simple.  Just make get and set subs (or
methods) that check for exists $ENV{'MODPERL'} and use pnotes or a
global hash depending owhich they are running under.
- Perrin



Re: Passing data among handlers

2001-01-31 Thread darren chamberlain

Drew Taylor ([EMAIL PROTECTED]) said something to this effect on 01/30/2001:
> I have a slightly different twist on this question. We run Registry
> scripts on our site for debugging purposes. I would love to have a
> module for saving variables/data structures on a per-request basis
> (like the current Apache notes), but internally using pnotes under
> mod_perl, and some other mechanism (package vars like I'm using
> now?) under everything else. The purpose of this being so that I
> could have a nice interface for per-request data that I could pass
> between different (non-OO) modules. This sounds vaguely familiar to
> what you did Barry. Can you elaborate a little?

Hey, wait, now we're talking about Apache::Session. In the perldoc for
Apache::Session, see in particular the section titled "Sharing data
between Apache processes"; it's almost exactly what you're asking for,
except the storage location is arbitrary (and can be transparently
moved around).

(darren)

-- 
If it turns out that there is a God, I don't think that he's evil.
But the worst that you can say about him is that basically he's an
underachiever.
-- Woody Allen



Re: Passing data among handlers

2001-01-30 Thread Piers Cawley

Robert Landrum <[EMAIL PROTECTED]> writes:

> I've never tried this, but you could store things into main using
> one handler and retrieve them with another, provided that you
> cleaned up afterward. If, for any reason you failed to cleanup, the
> server would leak memory... not that it doesn't already.

It doesn't have to leak memory. If you're careful. I've had long lived
processes doing non trivial stuff that've reached a maximum size and
stayed there 'til Maxhits. (And that's not just individual server
processes, but all the servers for that application.)

-- 
Piers





Re: Passing data among handlers

2001-01-30 Thread Barry Hoggard

I'm not sure what we're doing is very applicable.  Ours is meant to be
used in HTML::Mason, so that the object is passed as an argument to any
mason components that need it.  I wanted to have a definitive list of
methods, rather that let people just stick things into pnotes whenever
they felt like it.  So we're not really using pnotes at all.


--- Drew Taylor <[EMAIL PROTECTED]> wrote:
> I have a slightly different twist on this question. We run Registry
> scripts on
> our site for debugging purposes. I would love to have a module for
> saving
> variables/data structures on a per-request basis (like the current
> Apache
> notes), but internally using pnotes under mod_perl, and some other
> mechanism
> (package vars like I'm using now?) under everything else. The purpose
> of this
> being so that I could have a nice interface for per-request data that
> I could
> pass between different (non-OO) modules. This sounds vaguely familiar
> to what
> you did Barry. Can you elaborate a little?




=
Barry Hoggard
http://www.hoggard.org

__
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/



Re: Passing data among handlers

2001-01-30 Thread Drew Taylor

I have a slightly different twist on this question. We run Registry scripts on
our site for debugging purposes. I would love to have a module for saving
variables/data structures on a per-request basis (like the current Apache
notes), but internally using pnotes under mod_perl, and some other mechanism
(package vars like I'm using now?) under everything else. The purpose of this
being so that I could have a nice interface for per-request data that I could
pass between different (non-OO) modules. This sounds vaguely familiar to what
you did Barry. Can you elaborate a little?

Barry Hoggard wrote:
> 
> We created our own "request" object that gets passed to components that
> might need it.  We were concerned about pnotes becoming a big,
> hard-to-debug global area.
> 
> =
> Barry Hoggard
> http://www.hoggard.org

-- 
Drew Taylor
Software Engineer
OpenAir.com - Making Business a Breeze!
http://www.openair.com/



Re: Passing data among handlers

2001-01-30 Thread Kip Cranford

On: Tue, 30 Jan 2001 09:54:42 PST "Paul J. Lucas" wrote:

>   Perhaps I've missed it, but is there a better way than the
>   "notes" mechanism to pass data among handlers?
>
>   The "notes" mechanism not only requires the notes to be
>   scalars, but, apparantly, said scalars must also be simple
>   strings, i.e., no binary data crammed into a scalar.
>
>   Better ideas?  Odds of enhancing the "notes" mechanism?
>
>   - Paul
>

Try the "pnotes" mechanism.  Very similar to "notes", but allows for
complex data structures to be passed.  For a while, it was an
undocumented feature, but afaik is included in more recent dists (I'm
running 1.24).


--kip



Re: Passing data among handlers

2001-01-30 Thread Barry Hoggard

We created our own "request" object that gets passed to components that
might need it.  We were concerned about pnotes becoming a big,
hard-to-debug global area.


=
Barry Hoggard
http://www.hoggard.org

__
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/



Re: Passing data among handlers

2001-01-30 Thread Robert Landrum

I've never tried this, but you could store things into main using one 
handler and retrieve them with another, provided that you cleaned up 
afterward.  If, for any reason you failed to cleanup, the server 
would leak memory... not that it doesn't already.

Robert Landrum

>Paul J. Lucas ([EMAIL PROTECTED]) said something to this effect on 
>01/30/2001:
>>  Perhaps I've missed it, but is there a better way than the
>>  "notes" mechanism to pass data among handlers?
>>
>>  The "notes" mechanism not only requires the notes to be
>>  scalars, but, apparantly, said scalars must also be simple
>>  strings, i.e., no binary data crammed into a scalar.
>>
>>  Better ideas?  Odds of enhancing the "notes" mechanism?
>
>Paul,



Re: Passing data among handlers

2001-01-30 Thread darren chamberlain

Paul J. Lucas ([EMAIL PROTECTED]) said something to this effect on 01/30/2001:
>   Perhaps I've missed it, but is there a better way than the
>   "notes" mechanism to pass data among handlers?
> 
>   The "notes" mechanism not only requires the notes to be
>   scalars, but, apparantly, said scalars must also be simple
>   strings, i.e., no binary data crammed into a scalar.
> 
>   Better ideas?  Odds of enhancing the "notes" mechanism?

Paul,

Use pnotes rather that notes; it let's you pass arbitrary Perl
data structures around. The only caveat about pnotes is that you
can't share data with non-Perl handlers like you can with notes.

(darren)

-- 
...but what is ideology but the rationalisation of a vested interest?



RE: Passing data among handlers

2001-01-30 Thread Geoffrey Young



> -Original Message-
> From: Paul J. Lucas [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 30, 2001 12:55 PM
> To: [EMAIL PROTECTED]
> Subject: Passing data among handlers
> 
> 
>   Perhaps I've missed it, but is there a better way than the
>   "notes" mechanism to pass data among handlers?
> 
>   The "notes" mechanism not only requires the notes to be
>   scalars, but, apparantly, said scalars must also be simple
>   strings, i.e., no binary data crammed into a scalar.

try pnotes() -  it's documented in man Apache

--Geoff

> 
>   Better ideas?  Odds of enhancing the "notes" mechanism?
> 
>   - Paul
> 



Passing data among handlers

2001-01-30 Thread Paul J. Lucas

Perhaps I've missed it, but is there a better way than the
"notes" mechanism to pass data among handlers?

The "notes" mechanism not only requires the notes to be
scalars, but, apparantly, said scalars must also be simple
strings, i.e., no binary data crammed into a scalar.

Better ideas?  Odds of enhancing the "notes" mechanism?

- Paul