From b3c43d44109dea6ebc0753107a8e85a6b322f4ca Mon Sep 17 00:00:00 2001 From: Andy Lester Date: Thu, 3 Oct 2019 20:32:26 -0500 Subject: [PATCH] No longer uses version.pm --- Changes | 2 ++ Makefile.PL | 16 +++++++++++++++- ack | 3 +-- lib/App/Ack.pm | 3 +-- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Changes b/Changes index 8c4fe75a..db024251 100644 --- a/Changes +++ b/Changes @@ -11,6 +11,8 @@ than it should be because it would skip an optimization. Now it's fixed. Fixed test failures that would sometimes happen on Windows machines because of taint mode. Thanks, Tomasz Konojacki. (GH #235) +Remove the use of the version.pm module. + v3.1.1 Sat Aug 31 22:56:10 CDT 2019 ======================================== diff --git a/Makefile.PL b/Makefile.PL index b60e6b1d..ad23c6f5 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -12,7 +12,7 @@ my %parms = ( NAME => 'ack', AUTHOR => 'Andy Lester ', ABSTRACT => 'A grep-like program for searching source code', - VERSION_FROM => 'lib/App/Ack.pm', + VERSION => _version_from( 'lib/App/Ack.pm' ), LICENSE => 'artistic_2', MIN_PERL_VERSION => 5.010001, META_MERGE => { @@ -55,6 +55,20 @@ my %parms = ( WriteMakefile( %parms ); +# VERSION_FROM in MakeMaker can't handle version objects. +sub _version_from { + my $file = shift; + + open( my $fh, '<', $file ) or die "Can't open $file: $!"; + my ($line) = grep { /^\s*\$VERSION\s+=/ } <$fh>; + close $fh; + + die "Couldn't find a version line in $file" unless $line; + $line =~ /^\s*\$VERSION\s+=\s+(v3\.\d+\.\d+);/ or die "Can't parse VERSION on this line: $line"; + + return $1; +} + package MY; # Suppress EU::MM test rule. diff --git a/ack b/ack index 26779702..a25a6a1e 100755 --- a/ack +++ b/ack @@ -3,8 +3,7 @@ use strict; use warnings; -use version; -our $VERSION = version->declare( 'v3.1.1' ); # Check https://beyondgrep.com/ for updates +our $VERSION = v3.1.1; # Check https://beyondgrep.com/ for updates use 5.010001; diff --git a/lib/App/Ack.pm b/lib/App/Ack.pm index 9feaa6c7..2ebb9b67 100644 --- a/lib/App/Ack.pm +++ b/lib/App/Ack.pm @@ -16,8 +16,7 @@ A container for functions for the ack program. our $VERSION; our $COPYRIGHT; BEGIN { - use version; - $VERSION = version->declare( 'v3.1.1' ); # Check https://beyondgrep.com/ for updates + $VERSION = v3.1.1; # Check https://beyondgrep.com/ for updates $COPYRIGHT = 'Copyright 2005-2019 Andy Lester.'; } our $STANDALONE = 0;