line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Services::DB::Container::SQLite; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$App::Services::DB::Container::SQLite::VERSION = '0.002'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
29211
|
use Moo; |
|
1
|
|
|
|
|
44935
|
|
|
1
|
|
|
|
|
7
|
|
7
|
|
|
|
|
|
|
#use MooX::Types::MooseLike::Base; |
8
|
1
|
|
|
1
|
|
4199
|
use Bread::Board; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use App::Services::Logger::Container; |
11
|
|
|
|
|
|
|
use App::Services::DB::Container; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
extends 'App::Services::DB::Container'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub BUILD { |
16
|
|
|
|
|
|
|
$_[0]->build_container; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has db_file => ( |
20
|
|
|
|
|
|
|
is => 'rw', |
21
|
|
|
|
|
|
|
isa => sub { ref($_[0]) eq 'SCALAR' and $_[0] =~ /^\w$/ }, |
22
|
|
|
|
|
|
|
default => sub { ':memory:' }, |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has log_conf => ( |
26
|
|
|
|
|
|
|
is => 'rw', |
27
|
|
|
|
|
|
|
isa => sub { ref($_[0]) eq 'SCALAR' or (ref($_[0]) eq 'REF' and ref($$_[0])) eq 'SCALAR'}, |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has +name => ( |
32
|
|
|
|
|
|
|
is => 'rw', |
33
|
|
|
|
|
|
|
isa => sub { ref($_[0]) eq 'SCALAR' and $_[0] =~ /^\w$/ }, |
34
|
|
|
|
|
|
|
default => sub { 'sqlite' }, |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub build_container { |
38
|
|
|
|
|
|
|
my $s = shift; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $log_cntnr = App::Services::Logger::Container->new( |
41
|
|
|
|
|
|
|
log_conf => $s->log_conf, |
42
|
|
|
|
|
|
|
name => 'log' |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my $dsn = "dbi:SQLite:dbname=" . $s->db_file; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
my $db_cntnr = App::Services::DB::Container->new( |
48
|
|
|
|
|
|
|
dsn => $dsn, |
49
|
|
|
|
|
|
|
db_user => '', |
50
|
|
|
|
|
|
|
db_password => '', |
51
|
|
|
|
|
|
|
log_conf => $s->log_conf, |
52
|
|
|
|
|
|
|
name => 'db' |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
container $s => as { |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
service 'db_exec_svc' => ( |
58
|
|
|
|
|
|
|
class => 'App::Services::DB::Exec::Service', |
59
|
|
|
|
|
|
|
dependencies => { |
60
|
|
|
|
|
|
|
logger_svc => depends_on('log/logger_svc'), |
61
|
|
|
|
|
|
|
db_conn => depends_on('db/db_conn_svc'), |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
}; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
$s->add_sub_container($log_cntnr); |
68
|
|
|
|
|
|
|
$s->add_sub_container($db_cntnr); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
return $s; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
no Moose; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
__END__ |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=pod |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 NAME |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
App::Services::DB::Container::SQLite |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 VERSION |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
version 0.002 |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 AUTHOR |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Sean Blanton <sean@blanton.com> |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This software is copyright (c) 2013 by Sean Blanton. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
98
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |