PRE_PROCESS the version.tt automatically. v0
authorHeiko Schlittermann <hs@schlittermann.de>
Sat, 09 Jan 2016 15:01:05 +0100
changeset 87 1d82a68eb0a3
parent 86 7903028768ed
child 88 689be4f785ef
PRE_PROCESS the version.tt automatically. Hui, the Template Toolkit does not find files with an mtime @0 (begin of the epoch.) I had hard times to figure it out.
bin/once
lib/version.PL
templates/once.tt
--- a/bin/once	Mon Jan 04 15:16:55 2016 +0100
+++ b/bin/once	Sat Jan 09 15:01:05 2016 +0100
@@ -68,7 +68,7 @@
 my $rxFILE = qr/[a-z\d]{6}-[a-z\d]+-[dme]/i;    # date-filehash-removalmode
 
 my %TT_CONFIG = (
-#  PROCESS => 'version.tt',
+  PRE_PROCESS => 'version.tt',
   INCLUDE_PATH =>
       [ (map { catfile($Bin, $_) } qw(templates templates.default) ),
 	#(map { catfile(dist_dir($DIST), $_) } qw(var templates.override templates)),
--- a/lib/version.PL	Mon Jan 04 15:16:55 2016 +0100
+++ b/lib/version.PL	Sat Jan 09 15:01:05 2016 +0100
@@ -9,8 +9,12 @@
 }
 
 print <<_;
-[%# autogenerated at $now by $0 %]
-[% vcs.version = "$version"; %]
+[% # autogenerated at $now by $0
+   # included automatically via PRE_PROCESS
+   vcs.version = "$version";
+-%]
 _
 
-utime 0, 0 => $outfile
+# zero timestamp does not work! Template/tpage will
+# complain about "file not found"
+utime 1, 1 => $outfile
--- a/templates/once.tt	Mon Jan 04 15:16:55 2016 +0100
+++ b/templates/once.tt	Sat Jan 09 15:01:05 2016 +0100
@@ -2,7 +2,7 @@
 
 <html>
 [%-
-    USE date;
+    USE date;	# for date formattting in inventory.html
 -%]
 <head>
 <title>Once</title>
@@ -22,4 +22,6 @@
 </div>
 </body>
 </html>
-[%# vim:ft=html: %]
+[%
+   # vim:ft=html: 
+%]