Skip to content

Commit b3c43d4

Browse files
committed
No longer uses version.pm
1 parent ec343a4 commit b3c43d4

4 files changed

Lines changed: 19 additions & 5 deletions

File tree

Changes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ than it should be because it would skip an optimization. Now it's fixed.
1111
Fixed test failures that would sometimes happen on Windows machines because
1212
of taint mode. Thanks, Tomasz Konojacki. (GH #235)
1313

14+
Remove the use of the version.pm module.
15+
1416

1517
v3.1.1 Sat Aug 31 22:56:10 CDT 2019
1618
========================================

Makefile.PL

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ my %parms = (
1212
NAME => 'ack',
1313
AUTHOR => 'Andy Lester <andy@petdance.com>',
1414
ABSTRACT => 'A grep-like program for searching source code',
15-
VERSION_FROM => 'lib/App/Ack.pm',
15+
VERSION => _version_from( 'lib/App/Ack.pm' ),
1616
LICENSE => 'artistic_2',
1717
MIN_PERL_VERSION => 5.010001,
1818
META_MERGE => {
@@ -55,6 +55,20 @@ my %parms = (
5555

5656
WriteMakefile( %parms );
5757

58+
# VERSION_FROM in MakeMaker can't handle version objects.
59+
sub _version_from {
60+
my $file = shift;
61+
62+
open( my $fh, '<', $file ) or die "Can't open $file: $!";
63+
my ($line) = grep { /^\s*\$VERSION\s+=/ } <$fh>;
64+
close $fh;
65+
66+
die "Couldn't find a version line in $file" unless $line;
67+
$line =~ /^\s*\$VERSION\s+=\s+(v3\.\d+\.\d+);/ or die "Can't parse VERSION on this line: $line";
68+
69+
return $1;
70+
}
71+
5872
package MY;
5973

6074
# Suppress EU::MM test rule.

ack

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
use strict;
44
use warnings;
55

6-
use version;
7-
our $VERSION = version->declare( 'v3.1.1' ); # Check https://beyondgrep.com/ for updates
6+
our $VERSION = v3.1.1; # Check https://beyondgrep.com/ for updates
87

98
use 5.010001;
109

lib/App/Ack.pm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ A container for functions for the ack program.
1616
our $VERSION;
1717
our $COPYRIGHT;
1818
BEGIN {
19-
use version;
20-
$VERSION = version->declare( 'v3.1.1' ); # Check https://beyondgrep.com/ for updates
19+
$VERSION = v3.1.1; # Check https://beyondgrep.com/ for updates
2120
$COPYRIGHT = 'Copyright 2005-2019 Andy Lester.';
2221
}
2322
our $STANDALONE = 0;

0 commit comments

Comments
 (0)