RE: elusive, disappearing notes?

2000-06-01 Thread Doug MacEachern

On Wed, 31 May 2000, Geoffrey Young wrote:

 I've seen this before and always thought to attribute it to mod_dir creating
 a new request to properly map / to /index.html
 
 since any notes set are for the lifetime of the request only, the new
 request (representing /index.html) would/should have no notes...

right.  you should be able to always get the same notes table with
something like so:

my $notes = $r-main ? $r-main-notes : $r-notes;





RE: elusive, disappearing notes?

2000-05-31 Thread Geoffrey Young

I've seen this before and always thought to attribute it to mod_dir creating
a new request to properly map / to /index.html

since any notes set are for the lifetime of the request only, the new
request (representing /index.html) would/should have no notes...

this makes sense in my head, but my head is weird - I could be wrong...

HTH

--Geoff

 -Original Message-
 From: Roger Espel Llima [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 31, 2000 1:46 PM
 To: [EMAIL PROTECTED]
 Subject: elusive, disappearing notes?
 
 
 I have a TransHandler that's setting a note with 
 $r-notes("something",
 "something") the first time it runs.
 
 When I give it a directory ($r-uri is something like "/whatever/"),
 then Apache runs my TransHandler several times, where $r-uri 
 looks like
 "/whatever/", then "/whatever/index.html".
 
 Now, the second time the TransHandler runs in the same 
 request (with the
 /index.html that mod_dir added), it doesn't see the note that 
 the first
 time left!  I've double-checked the code, and made it dump the notes
 table to stderr, to no avail.  The note just goes away.
 
 Question: is it supposed to do that?  Is there a suggested workaround?
 
 
 Here's a simple test case of a TransHandler that shows this behavior:
 
 sub handler {
   my $r = shift;
   my $uri = $r-uri;
   my $notes = $r-notes;
 
   print STDERR "Notes init ($uri)!\n";
   foreach my $k (keys %$notes) {
 my $v = $notes-{$k};
 print STDERR "NOTE ($k) - ($v)\n";
   }
   print STDERR "-\n";
 
   $r-notes("hello", "world") unless $uri =~ /html/;
 
   print STDERR "Notes exit!\n";
   foreach my $k (keys %$notes) {
 my $v = $notes-{$k};
 print STDERR "NOTE ($k) - ($v)\n";
   }
   print STDERR "-\n";
 
   return DECLINED;
 }
 
 And the error_log of requesting / on this server:
 
 [Wed May 31 19:42:35 2000] [notice] Apache/1.3.12 (Unix) 
 mod_perl/1.21 configure
 d -- resuming normal operations
 Notes init (/)!
 -
 Notes exit!
 NOTE (hello) - (world)
 -
 Notes init (/)!
 -
 Notes exit!
 NOTE (hello) - (world)
 -
 Notes init (/index.html)!
 -
 Notes exit!
 -
 Notes init (/index.html)!
 -
 Notes exit!
 -
 
 -- 
 Roger Espel Llima, [EMAIL PROTECTED]
 http://www.iagora.com/~espel/index.html
 



Re: elusive, disappearing notes?

2000-05-31 Thread Roger Espel Llima

On Wed, May 31, 2000 at 01:57:20PM -0400, Geoffrey Young wrote:
 I've seen this before and always thought to attribute it to mod_dir creating
 a new request to properly map / to /index.html
 
 since any notes set are for the lifetime of the request only, the new
 request (representing /index.html) would/should have no notes...
 
 this makes sense in my head, but my head is weird - I could be wrong...

okay, that makes sense in my head too.  I'll just stick the data on a
global variable and clear it at the end of the request...

thanks!

-- 
Roger Espel Llima, [EMAIL PROTECTED]
http://www.iagora.com/~espel/index.html