Re: Passing data to subrequests

2001-04-09 Thread G.W. Haywood

Hi there,

On Fri, 6 Apr 2001, Joachim Zobel wrote:

 Is content negotiation somehow uncool? I could not find an
 Apache::Negotiate to interface with mod_negotiate and its remarkably
 little discussed.

Probably because whatever the results of the negotiation, Internet Exploder
will probably ignore them.

:(

73,
Ged.




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 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
 



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 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 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 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 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 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 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

2000-11-21 Thread darren chamberlain

ASHISH MUKHERJEE ([EMAIL PROTECTED]) said something to this effect:
 Hey all, I am in need of some help. Can anyone pls. tell me how I can pass data from 
a Handler to a script ? Can any session data etc. withing a Handler be made 
accessible within a script ? Also, how can I pass data between Handlers invoked at 
different stages of request processing ? eg. how can I pass some data from an Init 
Handler to PerlHandler or from within a script to a Cleanup Handler 

pnotes is your friend, it lets you pass arbitrary data around (even complex
data structures, or objects).

PerlModule Foo
Location /foo
  SetHandler  perl-script
  PerlHandler Foo::content_handler
  PerlInitHandler Foo::init_handler
  PerlLogHandler  Foo::log_handler
/Location

package Foo;
sub init_handler {
my $r= Apache-request;
my $data = _calculate("stuff");
$r-pnotes('data', $data);
return OK;
}
sub content_handler {
my $r= Apache-request;
my $data = $r-pnotes('data');
$r-print($data);
return OK;
}
sub log_handler {
my $r= Apache-request;
my $data = $r-pnotes('data');
$r-log-info($data);
return OK;
}

(darren)

-- 
I was thrown out of college for cheating on the metaphysics exam; I
looked into the soul of the boy sitting next to me.
-- Woody Allen

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Passing data structures between Stacked Handlers

2000-11-12 Thread Dave Kaufman

"Thomas Klausner" [EMAIL PROTECTED] wrote:
 Is there a module that can do "Stacked Handler Pipelining", but 
 doesn't pass around tied filehandles but data structures ?
 
Andreas König's Apache::HeavyCGI is a nice alternative approach to the use of stacked 
handlers.  

 If there isn't, could it be implemented by dumping the data 
 structure to $r-notes (with Data::Dumper) and have it eval'ed back 
 by the next handler?

I just started playing around with HeavyCGI, but it uses the "Singleton" approach: one 
master handler "dispatches" each request to to all the modules that are needed, first 
allowing each a shot at processing headers (last-mod times, conditional tests, early 
errors, etc), then for content, and finally for cleanup, fixup, etc.  this lets them 
all play together without the strict stacking and inefficient error-handling of 
stacked hadlers.

http://search.cpan.org/search?dist=Apache-HeavyCGI

-dave






Re: Passing data structures between Stacked Handlers

2000-11-12 Thread spam

On Sun, 12 Nov 2000, Dave Kaufman wrote:

  Is there a module that can do "Stacked Handler Pipelining", but 
  doesn't pass around tied filehandles but data structures ?

Can't you allocate some generic namespace, or better yet, create your own
package called config and in that export functions get_config set_config
They will get/set a package wide variable. Then you make new,DESTROY, and
what other functions you need. Then you create/set object in the Init
module and the way you go, call get_config in each of the stacked modules
and insert data into it, so it will be passed along. Simple alternative,
you can store a hash in package wide namespace of the first package, and
access that via hashref, which is more convinient or Package::hashname
notation.
Thats how I did it.

  If there isn't, could it be implemented by dumping the data 
  structure to $r-notes (with Data::Dumper) and have it eval'ed back 
  by the next handler?

God NO! Have you read of overhead incurring on eval? Might as well go back
to the days of PerlCGI,choke, choke

Hope that helped.
Pavel




Re: Passing data structures between Stacked Handlers

2000-11-12 Thread Perrin Harkins

Thomas Klausner wrote:
 If there isn't, could it be implemented by dumping the data
 structure to $r-notes (with Data::Dumper) and have it eval'ed back
 by the next handler?

If you use $r-pnotes, you can just put a reference to an arbitrary data
structure into it and it will still be there in the next handler.  No
need to serialize it with Data::Dumper.  Better than using a normal
global because it gets automatically cleaned up after the request.
- Perrin



Re: Passing data structures between Stacked Handlers

2000-11-12 Thread Thomas Klausner

Hi!

 If you use $r-pnotes, you can just put a reference to an arbitrary data
 structure into it and it will still be there in the next handler.  No
 need to serialize it with Data::Dumper.  Better than using a normal
 global because it gets automatically cleaned up after the request.
Thanks for the info.

Ken Williams [EMAIL PROTECTED] also told me that 
$r-pnotes wasn't included in the Eagle Book because it (pnotes, 
not the book) wasn't implemented then. The old problem with 
books.


-- 
D_OMM  http://domm.zsi.at
O_xyderkes
M_echanenNEU (naja): Wohnungs-Historie
M_asteuei http://domm.zsi.at/curvit/wohnen.html