line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Messaging::Courier::Config; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
25521
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
38
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
30
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
1786
|
use EO::File; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use EO::Singleton; |
8
|
|
|
|
|
|
|
use base qw( EO::Singleton ); |
9
|
|
|
|
|
|
|
use File::HomeDir; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub filefor { |
12
|
|
|
|
|
|
|
my $self = shift; |
13
|
|
|
|
|
|
|
my $name = shift; |
14
|
|
|
|
|
|
|
return EO::File->new( path => [home(),'.courier', $name] ); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub getvalue { |
18
|
|
|
|
|
|
|
my $self = shift; |
19
|
|
|
|
|
|
|
my $key = shift; |
20
|
|
|
|
|
|
|
my $file = $self->filefor( $key ); |
21
|
|
|
|
|
|
|
my $val = eval { $file->load->content; }; |
22
|
|
|
|
|
|
|
if ($@) { |
23
|
|
|
|
|
|
|
return ''; |
24
|
|
|
|
|
|
|
} else { |
25
|
|
|
|
|
|
|
chomp $val; |
26
|
|
|
|
|
|
|
return $val; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub group { |
31
|
|
|
|
|
|
|
my $self = Messaging::Courier::Config->new(); |
32
|
|
|
|
|
|
|
$self->{ group } ||= $self->getvalue('group'); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub host { |
36
|
|
|
|
|
|
|
my $self = Messaging::Courier::Config->new(); |
37
|
|
|
|
|
|
|
$self->{ host } ||= $self->getvalue('host'); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub port { |
41
|
|
|
|
|
|
|
my $self = Messaging::Courier::Config->new(); |
42
|
|
|
|
|
|
|
$self->{ port } ||= $self->getvalue('port'); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |