Add version template generator
authorHeiko Schlittermann <hs@schlittermann.de>
Thu, 31 Dec 2015 19:01:39 +0100
changeset 76 cc818568a7ec
parent 75 70af8cdbad5a
child 77 3ee9d9b5724c
child 83 33ff1832a096
Add version template generator
lib/version.PL
--- a/lib/version.PL	Wed Dec 30 23:42:56 2015 +0100
+++ b/lib/version.PL	Thu Dec 31 19:01:39 2015 +0100
@@ -1,6 +1,14 @@
 #! /usr/bin/perl
-my $output = shift;
+my $outfile = shift;
+
 chomp(my $version = `hg log -r . --template '{latesttag}-{latesttagdistance}-{node|short}\n'`);
+my $now = localtime;
 
-open(STDOUT, '>', $output) or die "Can't open $output: $!\n";
-print qq{[% vcs.version = "$version"; %]\n};
+open(my $output, '>',  $_ = $outfile) or die "Can't open $_: $!\n";
+
+print {$output} <<_;
+[%# autogenerated at $now by $0 %]
+[% vcs.version = "$version"; %]
+_
+
+utime 0, 0 => $outfile;