This is a much better idea, and, no, I don't have to use a null stylesheet, 'ell, I don't even need the "axkit:" URI (vindicating the advice I've heard on this list "there are very few things that require an axkit: URI") -- I was using these to _force_ superfluous style processing just to get the data in the cache. In my experiments, a relative URI in an (LibXSLT at least, it's all I've tried) XSLT document() function calls the handler directly; perfect fit for your technique. Thanks -- it seems to work great.
Glad it worked for you!
One question:
# reset cache file's status in case get_fh is # called again, so it gets reevaluated: $self->source_cache->{mtime} = $self->source_cache->{exists} = undef;
Am I missing something, or is this necessary? I'd rather get recently (i.e., since the first time content was delivered by this request) stale cache data than inconsistent cache data within the context of the same request.
The problem this works around is that the first time the cache->mtime and cache->exists methods are called, they remember their values in the cache->{mtime} and cache->{exists} properties, to avoid excessive reevaluation. So if those methods are called again later on (i.e. on a second call to get_fh) they will still return the same values as the first time they were called, even if the mtime or existence of the cache has changed (which it definitely will since you're forcibly updating it).
So it takes care of the following circumstance:
* get_fh is called, cache is out of date -> source is re-generated and written to cache file.
* get_fh is called again within same request, cache still reports as out of date, even though we know it's up to date because it was just regenerated -> source is re-generated again even though it's not necessary.
Resetting those values (since the Cache's mtime and exists methods) is just a way of saying "I've changed the status of the cache, so forget the stale status you're remembering from before and use the new."
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
