List Info

Thread: Still using compiled template after delete.




Still using compiled template after delete.
user name
2006-01-31 20:40:55
I'm unsure if this is the intended behaviour, but when you
delete a
template TT will continue to use the compiled one.  I expect
this is
to facilitate the deployment of compiled templates.

I dynamically adjust the INCLUDE_PATH to override templates.
If I
delete an overriding template, the default doesn't get
picked up. 
This is because when T::Provider stat()s the template I
deleted it
gets back an undef which is <= the mtime of the compiled
template.

Is this the intended behavior or should that if() in
T::Provider check
for an undef on the stat?

--
Cory 'G' Watson
http://www.onemogin.com

_______________________________________________
templates mailing list
templatestemplate-toolkit.org
http://lists.template-toolkit.org/mailman/listinfo/t
emplates
Still using compiled template after delete.
user name
2006-02-03 22:33:16
Cory Watson wrote:
> I'm unsure if this is the intended behaviour, but when
you delete a
> template TT will continue to use the compiled one.  I
expect this is
> to facilitate the deployment of compiled templates.
> 
> I dynamically adjust the INCLUDE_PATH to override
templates. If I
> delete an overriding template, the default doesn't get
picked up. 
> This is because when T::Provider stat()s the template I
deleted it
> gets back an undef which is <= the mtime of the
compiled template.
> 
> Is this the intended behavior or should that if() in
T::Provider check
> for an undef on the stat?

Andy,

Any word on this issue from Cory?

-- Josh

_______________________________________________
templates mailing list
templatestemplate-toolkit.org
http://lists.template-toolkit.org/mailman/listinfo/t
emplates
Still using compiled template after delete.
user name
2006-02-07 08:08:51
Cory Watson wrote:
> Is this the intended behavior or should that if() in
T::Provider check
> for an undef on the stat?

Hi Cory, 

That's definately not the intended behaviour.  It should
check for 
undef on the stat.

However, we've just replaced that particular bit of code
with a call
to a new _mtime() method:

        if ($compiled && -f $compiled 
-            && (stat($name))[9] <=
(stat($compiled))[9]) {        # v2.14
+            && $self->_mtime($name) <=
(stat($compiled))[9]) {    # v2.14a

See: http://tt2.org/pipermail/templates-cvs/2006-Febr
uary/002191.html

So I think I'll adapt that slightly to allow us to code the
undef
check inside the _mtime() method (which might be better
named "_modified()")

        if ($compiled && -f $compiled 
            && ! $self->_modified($name,
(stat($compiled))[9])) {

When called with 2 args, _modified($name, $time) returns
true if $name
has been modified since $time.  If the stat() on $name
returns undef
(i.e. the file has been deleted), then it returns 1 and the
compiled
file is bypassed.  When called with 1 arg it returns the
modification 
time as before.

Anyone care to code some tests?

A


_______________________________________________
templates mailing list
templatestemplate-toolkit.org
http://lists.template-toolkit.org/mailman/listinfo/t
emplates
Still using compiled template after delete.
user name
2006-02-09 01:18:58
Somewhat related,  I've got $Template::Provider::STAT_TTL
set yet I
noticed something I'm not clear on.

I have in my INCLUDE_PATH two directories, "site"
and "default".  So
on the first request for config.tt I see:

    site/templates/config.tt  (No such file or directory)
    default/templates/config.tt  (Found!)

Now, I think I would expect that once found TT would not
look
again for config.tt until STAT_TTL seconds have passed. 
Yet, every
request I see a stat for:

    site/templates/config.tt (No such file or directory)

In other words, it's still stating the file that was *not*
found on
every request regardless of STAT_TTL.

Since most of my templates are in the "default"
directory, with some
overriding templates in "site" then I end up
stat'ing most of the
templates every request regardless of STAT_TTL settings.

Almost seems like there should be two TTL settings -- one
for how
often to check if the template is newer than the compiled
template,
and another to check that a given template still maps to a
given
path in INCLUDE_PATH.

Whatcha think?



-- 
Bill Moseley
moseleyhank.org


_______________________________________________
templates mailing list
templatestemplate-toolkit.org
http://lists.template-toolkit.org/mailman/listinfo/t
emplates
[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )