| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Bot::Cobalt::Conf::File::Core; |
|
2
|
|
|
|
|
|
|
$Bot::Cobalt::Conf::File::Core::VERSION = '0.021002'; |
|
3
|
5
|
|
|
5
|
|
12622
|
use v5.10; |
|
|
5
|
|
|
|
|
9
|
|
|
4
|
5
|
|
|
5
|
|
384
|
use strictures 2; |
|
|
5
|
|
|
|
|
1125
|
|
|
|
5
|
|
|
|
|
139
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
636
|
use Carp; |
|
|
5
|
|
|
|
|
7
|
|
|
|
5
|
|
|
|
|
234
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
338
|
use Bot::Cobalt::Common ':types'; |
|
|
5
|
|
|
|
|
6
|
|
|
|
5
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
5
|
|
|
5
|
|
1978
|
use Moo; |
|
|
5
|
|
|
|
|
25365
|
|
|
|
5
|
|
|
|
|
27
|
|
|
11
|
|
|
|
|
|
|
extends 'Bot::Cobalt::Conf::File'; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has language => ( |
|
14
|
|
|
|
|
|
|
lazy => 1, |
|
15
|
|
|
|
|
|
|
is => 'rwp', |
|
16
|
|
|
|
|
|
|
isa => Str, |
|
17
|
|
|
|
|
|
|
default => sub { |
|
18
|
|
|
|
|
|
|
my ($self) = @_; |
|
19
|
|
|
|
|
|
|
$self->cfg_as_hash->{Language} // 'english' ; |
|
20
|
|
|
|
|
|
|
}, |
|
21
|
|
|
|
|
|
|
); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has paths => ( |
|
24
|
|
|
|
|
|
|
lazy => 1, |
|
25
|
|
|
|
|
|
|
weak_ref => 1, |
|
26
|
|
|
|
|
|
|
is => 'rwp', |
|
27
|
|
|
|
|
|
|
isa => HashRef, |
|
28
|
|
|
|
|
|
|
default => sub { |
|
29
|
|
|
|
|
|
|
my ($self) = @_; |
|
30
|
|
|
|
|
|
|
ref $self->cfg_as_hash->{Paths} eq 'HASH' ? |
|
31
|
|
|
|
|
|
|
$self->cfg_as_hash->{Paths} |
|
32
|
|
|
|
|
|
|
: {} |
|
33
|
|
|
|
|
|
|
}, |
|
34
|
|
|
|
|
|
|
); |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has irc => ( |
|
37
|
|
|
|
|
|
|
lazy => 1, |
|
38
|
|
|
|
|
|
|
weak_ref => 1, |
|
39
|
|
|
|
|
|
|
is => 'rwp', |
|
40
|
|
|
|
|
|
|
isa => HashRef, |
|
41
|
|
|
|
|
|
|
default => sub { |
|
42
|
|
|
|
|
|
|
my ($self) = @_; |
|
43
|
|
|
|
|
|
|
$self->cfg_as_hash->{IRC} |
|
44
|
|
|
|
|
|
|
}, |
|
45
|
|
|
|
|
|
|
); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
has opts => ( |
|
48
|
|
|
|
|
|
|
lazy => 1, |
|
49
|
|
|
|
|
|
|
weak_ref => 1, |
|
50
|
|
|
|
|
|
|
is => 'rwp', |
|
51
|
|
|
|
|
|
|
isa => HashRef, |
|
52
|
|
|
|
|
|
|
default => sub { |
|
53
|
|
|
|
|
|
|
my ($self) = @_; |
|
54
|
|
|
|
|
|
|
$self->cfg_as_hash->{Opts} |
|
55
|
|
|
|
|
|
|
}, |
|
56
|
|
|
|
|
|
|
); |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
around 'validate' => sub { |
|
59
|
|
|
|
|
|
|
my ($orig, $self, $cfg) = @_; |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
my $path = $self->cfg_path; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
for my $expected_hash (qw/ IRC Opts /) { |
|
64
|
|
|
|
|
|
|
unless (defined $cfg->{$expected_hash}) { |
|
65
|
|
|
|
|
|
|
die "Directive '$expected_hash' not found; should be a hash\n" |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
unless (ref $cfg->{$expected_hash} eq 'HASH') { |
|
69
|
|
|
|
|
|
|
die "Directive '$expected_hash' should be a hash\n" |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
if (defined $cfg->{Paths} && ref $cfg->{Paths} ne 'HASH') { |
|
73
|
|
|
|
|
|
|
die "Directive 'Paths' specified but not a hash\n" |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1 |
|
78
|
|
|
|
|
|
|
}; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
|
82
|
|
|
|
|
|
|
__END__ |