Here is a patch to _refresh that will cause subsequent lookups in the cache
to fail if the template file itself no longer exists. Well actually the
first lookup after the file is deleted will still return the cached file,
then all lookups will fail. I didnt' want to mess around with the LRU cache
and possibly cause memory leaks or something like that, so when the name
lookup is deleted, the template will still take up a slot in the cache list
until it gets bumped.
This has only been tested in our own setup. I would rather have done a more
elegant solution but this works for us and solves our problem.
diff -ru Provider.pm.orig Provider.pm
--- Provider.pm.orig Wed Mar 17 09:34:01 2004
+++ Provider.pm Wed Mar 17 09:50:29 2004
@@ -688,7 +688,10 @@
# if it's more than $STAT_TTL seconds since we last performed a
# stat() on the file then we need to do it again and see if the file
# time has changed
- if ( (time - $slot->[ STAT ]) > $STAT_TTL && stat $slot->[ NAME ] ) {
+
+ my $since_last_modified = time - $slot->[ STAT ];
+
+ if ( $since_last_modified > $STAT_TTL && stat $slot->[ NAME ] ) {
$slot->[ STAT ] = time;
if ( (stat(_))[9] != $slot->[ LOAD ]) {
@@ -706,6 +709,10 @@
$slot->[ LOAD ] = $data->{ time };
}
}
+ }
+
+ elsif ( $since_last_modified > $STAT_TTL) {
+ delete $self->{ LOOKUP }->{ $slot->[ NAME ] };
}
unless( $self->{ HEAD } == $slot ) {
_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates