line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tanker; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5990
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
5
|
1
|
|
|
1
|
|
4
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
32
|
|
6
|
1
|
|
|
1
|
|
3163
|
use Data::Dumper; |
|
1
|
|
|
|
|
11136
|
|
|
1
|
|
|
|
|
206
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$VERSION = 0.021; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new ($$) |
12
|
|
|
|
|
|
|
{ |
13
|
|
|
|
|
|
|
# standard stuff for creating a new object |
14
|
|
|
|
|
|
|
# I'm not sure if this *should* be an object |
15
|
|
|
|
|
|
|
# but I think it'll probably be useful in the end |
16
|
1
|
|
|
1
|
0
|
87
|
my $proto = shift; |
17
|
1
|
|
33
|
|
|
6
|
my $class = ref($proto) || $proto; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# yes, we must have a config file |
20
|
1
|
|
50
|
|
|
5
|
my $config = shift || die "You must pass a config file to $class\n"; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# bless our self into a hash |
23
|
1
|
|
|
|
|
2
|
my $self = {}; |
24
|
1
|
|
|
|
|
2
|
bless ($self, $class); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# load that with the config |
27
|
1
|
|
|
|
|
4
|
$self->{config_file} = $config; |
28
|
1
|
|
|
|
|
5
|
$self->parse_config(); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# and give it on back |
31
|
0
|
|
|
|
|
0
|
return $self; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# read the config file somehow and load all the plugins |
35
|
|
|
|
|
|
|
# RequestHandlers and ResponseHandlers and stick them global |
36
|
|
|
|
|
|
|
# thinking about it, this shouldn't be in the module but we'll |
37
|
|
|
|
|
|
|
# fix that it a bit |
38
|
|
|
|
|
|
|
sub parse_config ($) |
39
|
|
|
|
|
|
|
{ |
40
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
## todo make this proper |
43
|
1
|
|
|
1
|
|
569
|
use Tanker::Plugin::Log; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
44
|
|
44
|
|
|
|
|
|
|
|
45
|
1
|
|
|
|
|
12
|
my $logger = new Tanker::Plugin::Log ($self); |
46
|
1
|
|
|
|
|
5
|
$self->add_plugin($logger); |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
1
|
|
679
|
use Tanker::RequestGenerator::IRC; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
209
|
|
49
|
1
|
|
|
|
|
12
|
my $irc = new Tanker::RequestGenerator::IRC ($self); |
50
|
0
|
|
|
|
|
0
|
$irc->run(); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub add_plugin ($$) |
55
|
|
|
|
|
|
|
{ |
56
|
1
|
|
|
1
|
0
|
2
|
my ($self, $plugin) = @_; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# so that the plugin will be able to get hold |
59
|
|
|
|
|
|
|
# of us if it needs to |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
1
|
push @{$self->{plugins}}, $plugin; |
|
1
|
|
|
|
|
3
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# this gets called by the Request Generator |
67
|
|
|
|
|
|
|
# it forks and sends off the request |
68
|
|
|
|
|
|
|
sub inject ($$) |
69
|
|
|
|
|
|
|
{ |
70
|
0
|
|
|
0
|
0
|
|
my ($self, $request) = @_; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# send the request down the pipeline asynchronously |
74
|
|
|
|
|
|
|
# this should be handled more defensively |
75
|
0
|
0
|
|
|
|
|
unless (fork()) |
76
|
|
|
|
|
|
|
{ |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
$self->inject_aux($request); |
79
|
0
|
|
|
|
|
|
exit; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub inject_aux ($$) |
85
|
|
|
|
|
|
|
{ |
86
|
0
|
|
|
0
|
0
|
|
my ($self, $request) = @_; |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
foreach my $plugin (@{$self->{plugins}}) |
|
0
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
{ |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
$plugin->handle($request); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |
100
|
|
|
|
|
|
|
__END__ |