On Mon, 31 Dec 2001, William R. Ward wrote:

> >This seems like a reasonable addition to me.  I'd accept a patch that
> >included appropriate modifications to the caching code and some test
> >cases.  Any objections?
>
> Can someone who understands the caching code help with this?

Well, that would be me I guess.  Basically HTML::Template stores the mtime
of every include file it used to build the template object in the cache.
Then when it goes to check if the template object is fresh it looks at the
mtime of each included file on disk and checks that the mtimes match.

A couple issues occur to me: you'll need to put some dummy value (ex.
-1) in for an include that got "skipped".  Then you'll need to check that
the include file still doesn't exist when you check for freshness.  That
way the cache will be correctly invalidated if a previously missing
include file is created.

Sounds simple enough?  Well, be careful - the mtime-checking code had more
bugs in it than the rest of the caching code by many times over!  I bet
that's because I never really created good tests for it...

> Well I've done that too, but then you have to add several lines to
> your Perl code, where adding one line to a Template would be easier.
> Also it means that adding another UI element (another file) would
> require adding more to the Perl code.

True.  Sometimes I'm not nearly lazy enough to be a good Perl programmer!

-sam


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

Reply via email to