At 10.41 -0700 10/13/2000, Doug MacEachern wrote:
>On Fri, 13 Oct 2000, Doug MacEachern wrote:
>
>> On Sat, 30 Sep 2000, Yann Ramin wrote:
>>
>> > #0 0x80a2605 in ap_table_get ()
>> > #1 0x808961e in XS_Apache__Table_FETCH ()
>>
>> > package Magrathea::WebAPI;
>> ...
>> > my $driver;
>>
>> you cannot cache data that is tied to $r (e.g., notes table), because
>> the $r->pool is cleared after each request. string values are ok, but not
>> objects such as Apache::Table objects which are tied to the r->pool.
>
>just to be clear on this: it's ok to cache things such as Apache::Table
>for the lifetime of a request (example, between request phases), but once
>the request is over (and r->pool is cleared), such a cache needs to be
>flushed.
On a related topic, a great way to make your life miserable is to cache the Apache
request object in the instance data of an "application object" you wish to stick on
$r->pnotes in order to scope it to the request. Makes a nice leak when your request
finishes -- $r goes out of scope to the request lowering the refcount by 1 -- but the
refcount doesn't drop to 0 because $r->pnotes('APPOBJECT')->{'r'} still holds a
reference to it.
(Solution? $r->register_cleanup(sub { $r->pnotes(APPOBJECT => undef) };))
(Yes, I learned that the hard way. :-)
--
David Pisoni -- <[EMAIL PROTECTED]>
Cnation -- <http://www.cnation.com/>
310/228-6900 -- 310/228-6905 (fax)
"One machine can do the work of fifty ordinary men. No machine can do the work of one
extraordinary man." -Elbert Hubbard, author, editor, printer (1856-1915)