line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::I18N::Command::Initdb; |
2
|
1
|
|
|
1
|
|
2128
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
4
|
1
|
|
|
1
|
|
6
|
use Cwd; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
79
|
|
5
|
1
|
|
|
1
|
|
8
|
use App::I18N::Config; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
6
|
1
|
|
|
1
|
|
7
|
use App::I18N::Logger; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
7
|
1
|
|
|
1
|
|
6
|
use File::Basename; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
81
|
|
8
|
1
|
|
|
1
|
|
7
|
use File::Path qw(mkpath); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
67
|
|
9
|
1
|
|
|
1
|
|
6
|
use File::Find::Rule; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
11
|
|
10
|
1
|
|
|
1
|
|
56
|
use Locale::Maketext::Extract; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
90
|
|
11
|
1
|
|
|
1
|
|
5
|
use base qw(App::I18N::Command); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
122
|
|
12
|
1
|
|
|
1
|
|
8
|
use App::I18N::DB; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
13
|
1
|
|
|
1
|
|
5
|
use DBI; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
75
|
|
14
|
1
|
|
|
1
|
|
6
|
use DBD::SQLite; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
268
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub options { ( |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
0
|
0
|
|
) } |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub run { |
22
|
0
|
|
|
0
|
0
|
|
my ($self,$dbname) = @_; |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
0
|
|
|
|
$dbname ||= 'i18n.sqlite'; |
25
|
0
|
|
|
|
|
|
my $dbpath = File::Spec->join( $ENV{HOME} , $dbname ); |
26
|
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
|
if ( -e $dbpath ) { |
28
|
0
|
|
|
|
|
|
my $ans = $self->prompt( "Database $dbname exists, replace it ? (N/y)", 'n'); |
29
|
0
|
0
|
|
|
|
|
return if( $ans =~ /n/i ); |
30
|
|
|
|
|
|
|
} |
31
|
0
|
|
|
|
|
|
unlink( $dbpath ); |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my $db = App::I18N::DB->new( path => $dbpath ); |
34
|
0
|
|
|
|
|
|
$db->init_schema(); |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
$db->close(); |
37
|
0
|
|
|
|
|
|
print "Database $dbname ($dbpath) created.\n"; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |