-
Notifications
You must be signed in to change notification settings - Fork 69
/
Makefile.PL
61 lines (51 loc) · 1.5 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 5.006;
use strict;
use warnings;
use ExtUtils::MakeMaker;
use Getopt::Long;
use File::Copy;
my %opt;
GetOptions(
\%opt,
'rename|script-name=s'
);
my $DEFAULT_SCRIPT_NAME = "st";
my $script_name = $DEFAULT_SCRIPT_NAME;
# rename script if necessary
if ($opt{rename} and $opt{rename} =~ /^(\w+)$/) {
my $new_script_name = $1;
open my $in, '<', "script/$DEFAULT_SCRIPT_NAME" or die "Can't read 'script/$DEFAULT_SCRIPT_NAME': $!";
open my $out, '>', "script/$new_script_name" or die "Can't write to 'script/$new_script_name': $!";
my $found_pod;
while (my $line = <$in>) {
if ($line eq "__END__\n" or $found_pod) { # only after __END__
if ($line !~ m{http.+/$DEFAULT_SCRIPT_NAME}) { # only if not in url
$line =~ s/\b$DEFAULT_SCRIPT_NAME\b/$new_script_name/g;
}
$found_pod = 1;
}
print $out $line;
}
close $out;
close $in;
$script_name = $new_script_name;
}
WriteMakefile(
NAME => 'App::St',
AUTHOR => q{Nelson Ferraz <[email protected]>},
VERSION_FROM => 'lib/App/St.pm',
ABSTRACT_FROM => 'lib/App/St.pm',
LICENSE => 'MIT',
EXE_FILES => [ "script/$script_name", ],
PL_FILES => { },
MIN_PERL_VERSION => 5.006,
CONFIGURE_REQUIRES => {
'ExtUtils::MakeMaker' => 0,
},
BUILD_REQUIRES => {
'Test::More' => 0,
},
PREREQ_PM => { },
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
clean => { FILES => 'App-*' },
);