-
Notifications
You must be signed in to change notification settings - Fork 3
/
Build.PL
69 lines (53 loc) · 1.37 KB
/
Build.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
62
63
64
65
66
67
68
69
#!/usr/bin/perl
use warnings;
use FindBin qw( $Bin );
use Module::Build;
my $verbose = grep(/^--showsql$/, @ARGV);
my $mb = Module::Build->new(
'module_name' => 'Locale::Object',
'license' => 'unrestricted',
'requires' => {
'perl' => '5.6.0',
'DateTime::TimeZone' => 0.4,
'DateTime' => 0.3,
'DBI' => 0,
'DBD::SQLite' => 0,
'Scalar::Util' => 1.10,
},
'build_requires' => {
'DBI' => 0,
'DBD::SQLite' => 0,
'Module::Build' => '0.21',
'Test::More' => 0,
'Test::Pod' => 0,
},
);
eval {
require DBI;
require DBD::SQLite;
1;
};
if ($@) {
print "DBD::SQLite is required to run Build.PL. Please check your system configuration.\n";
exit 1;
}
my $db = "$Bin/lib/Locale/Object/locale.db";
unlink($db);
my $dbh;
{
no warnings 'once'; # shut up about $DBI::errstr
$dbh = DBI->connect("dbi:SQLite:$db")
or die "Couldn't connect to $db: $DBI::errstr";
}
open (my $SQL, '<', "$Bin/locale.sql")
or die "Couldn't open SQL file ($Bin/locale.sql) to create database: $!";
{
local $/ = ";\n";
while (<$SQL>) {
next unless $_;
print $_ if $verbose;
$dbh->do($_) or die $dbh->errstr;
}
}
close $SQL;
$mb->create_build_script;