line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Ukigumo::Agent; |
2
|
2
|
|
|
2
|
|
839
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
63
|
|
3
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
63
|
|
4
|
2
|
|
|
2
|
|
58
|
use 5.010001; |
|
2
|
|
|
|
|
18
|
|
5
|
2
|
|
|
2
|
|
1587
|
use version; our $VERSION = version->declare("v0.1.8"); |
|
2
|
|
|
|
|
4468
|
|
|
2
|
|
|
|
|
11
|
|
6
|
2
|
|
|
2
|
|
874
|
use parent qw(Amon2 Amon2::Web); |
|
2
|
|
|
|
|
265
|
|
|
2
|
|
|
|
|
11
|
|
7
|
2
|
|
|
2
|
|
232446
|
use Carp (); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
243
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub load_config { |
10
|
0
|
|
|
0
|
|
|
my ($c, $file) = @_; |
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
|
|
|
my $config = do $file; |
13
|
0
|
0
|
|
|
|
|
Carp::croak("$file: $@") if $@; |
14
|
0
|
0
|
|
|
|
|
Carp::croak("$file: $!") unless defined $config; |
15
|
0
|
0
|
|
|
|
|
unless ( ref($config) eq 'HASH' ) { |
16
|
0
|
|
|
|
|
|
Carp::croak("$file does not return HashRef."); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
$config; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
2
|
|
1177
|
use Ukigumo::Agent::Dispatcher; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
use Ukigumo::Logger; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
__PACKAGE__->load_plugins(qw(Web::JSON ShareDir)); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub dispatch { |
28
|
|
|
|
|
|
|
my ($c) = @_; |
29
|
|
|
|
|
|
|
return Ukigumo::Agent::Dispatcher->dispatch($c); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
{ |
33
|
|
|
|
|
|
|
use Ukigumo::Agent::View; |
34
|
|
|
|
|
|
|
my $view = Ukigumo::Agent::View->make_instance(__PACKAGE__); |
35
|
|
|
|
|
|
|
sub create_view { $view } |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
{ |
39
|
|
|
|
|
|
|
my $_manager; |
40
|
|
|
|
|
|
|
sub register_manager { $_manager = $_[1] } |
41
|
|
|
|
|
|
|
sub manager { $_manager || die "Missing manager" } |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
{ |
45
|
|
|
|
|
|
|
my $_logger = Ukigumo::Logger->new; |
46
|
|
|
|
|
|
|
sub logger { $_logger } |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
__END__ |