--- a/.hgignore Wed Dec 30 23:41:39 2015 +0100
+++ b/.hgignore Wed Dec 30 23:42:56 2015 +0100
@@ -5,3 +5,4 @@
^_build/
^MYMETA.json$
^MYMETA.yml$
+^templates/version\.tt$
--- a/Build.PL Wed Dec 30 23:41:39 2015 +0100
+++ b/Build.PL Wed Dec 30 23:42:56 2015 +0100
@@ -6,6 +6,9 @@
dist_abstract => 'once downloader',
script_files => [qw(bin/once)],
share_dir => [qw(templates)],
+ PL_files => {
+ 'lib/version.PL' => 'templates/version.tt',
+ },
requires => {
'perl' => '5.0.18',
'File::MimeInfo' => 0,
@@ -13,10 +16,3 @@
'experimental' => 0,
},
)->create_build_script;
-
-# create the var.tt to be included
-mkdir 'templates.var' or -d 'templates.var' or die "templates.var: $!";
-chomp(my $version = `hg log -r . --template '{latesttag}-{latesttagdistance}-{node|short}\n'`);
-open(my $o, '>', $_ = 'templates.var/version.tt') or die "Can't open $_: $!\n";
-print $o qq{[% vcs.version = "$version"; %]\n};
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/version.PL Wed Dec 30 23:42:56 2015 +0100
@@ -0,0 +1,6 @@
+#! /usr/bin/perl
+my $output = shift;
+chomp(my $version = `hg log -r . --template '{latesttag}-{latesttagdistance}-{node|short}\n'`);
+
+open(STDOUT, '>', $output) or die "Can't open $output: $!\n";
+print qq{[% vcs.version = "$version"; %]\n};