Subject: | Template files with mtime=0 not handled |
Template files with mtime=0 (typically 1970-01-01 on Unix systems)
cannot be handled by Template Toolkit. This can be easily tested with
this script:
#!/usr/bin/perl
use strict;
use File::Temp qw(tempfile);
use Template;
my($tmpfh,$tmpfile) = tempfile(UNLINK => 1);
print $tmpfh "hello, world\n";
close $tmpfh or die $!;
utime 0, 0, $tmpfile or die $!;
Template->new({ABSOLUTE => 1})->process($tmpfile, {}) or die;
__END__
If the "utime" line is removed, then the script runs without problems.
Reason for this: there are a couple of places in Template::Provider,
where modtime checks are not done using "defined", but with a mere "if
(...)" or "... ||". Getting the mtime in TT2 is done using the
_template_modified method, so probably all calls of this methods should
be checked.
(If the problem is accepted, then I can provide a patch for it)
Regards,
Slaven