forked from wphillipmoore/cpan-afs-command
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.PL
62 lines (44 loc) · 1.33 KB
/
Makefile.PL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
use strict;
use warnings;
use English;
use ExtUtils::MakeMaker;
use IO::File;
my $version = get_version(
in => q{lib/AFS/Command/Version.pm.in},
out => q{lib/AFS/Command/Version.pm},
);
WriteMakefile(
NAME => q{AFS-Command},
MIN_PERL_VERSION => q{5.010},
VERSION => $version,
ABSTRACT => q{AFS Command Utility Interface},
AUTHOR => q{Phillip Moore <[email protected]>},
LICENSE => q{unknown},
dist => {
TARFLAGS => q{-cv --exclude=.git -f},
},
PREREQ_PM => {
q{Moose} => 0,
q{MooseX::Singleton} => 0,
q{Date::Format} => 0,
q{Try::Tiny} => 0,
},
TEST_REQUIRES => {
q{Test::Exception} => 0,
},
);
sub get_version {
my %args = @_;
my $version = $ENV{EFSDEPLOY_RELEASEALIAS} || q{0.001_001};
my $in = IO::File->new( $args{in} ) ||
die qq{Unable to read $args{in}: $ERRNO\n};
my $out = IO::File->new( qq{>$args{out}} ) ||
die qq{Unable to write to $args{out}: $ERRNO\n};
while ( defined($_ = $in->getline) ) {
s{__VERSION__}{$version}ms;
$out->print( $_ );
}
STDOUT->print( qq{Set version to $version in $args{in}\n} );
$out->close || die qq{Unable to close $args{out}: $ERRNO\n};
return $version;
}