line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::GitHubWebhooks2Ikachan::Events; |
2
|
9
|
|
|
9
|
|
58
|
use strict; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
491
|
|
3
|
9
|
|
|
9
|
|
53
|
use warnings; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
299
|
|
4
|
9
|
|
|
9
|
|
1182
|
use utf8; |
|
9
|
|
|
|
|
30
|
|
|
9
|
|
|
|
|
73
|
|
5
|
|
|
|
|
|
|
use Class::Accessor::Lite( |
6
|
9
|
|
|
|
|
74
|
new => 1, |
7
|
|
|
|
|
|
|
ro => [qw/dat req/], |
8
|
9
|
|
|
9
|
|
14499
|
); |
|
9
|
|
|
|
|
10891
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub dispatch { |
11
|
18
|
|
|
18
|
0
|
45
|
my ($self, $event_name) = @_; |
12
|
|
|
|
|
|
|
|
13
|
18
|
|
|
|
|
45
|
my $subscribe_all = 0; |
14
|
18
|
|
|
|
|
35
|
my $subscribed_events = {}; |
15
|
18
|
|
|
|
|
80
|
my $subscribe = $self->req->param('subscribe'); |
16
|
18
|
100
|
|
|
|
358
|
if (!$subscribe) { |
17
|
2
|
|
|
|
|
4
|
$subscribe_all = 1; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
else { |
20
|
16
|
|
|
|
|
76
|
for my $subscribed_event (split(/,/, $subscribe)) { |
21
|
16
|
|
|
|
|
63
|
$subscribed_events->{$subscribed_event} = 1; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
18
|
|
|
|
|
73
|
my $klass = __PACKAGE__ . '::' . join('', map({ ucfirst ($_) } split(/_/, $event_name))); |
|
29
|
|
|
|
|
98
|
|
26
|
18
|
|
|
|
|
11879
|
eval "require $klass"; ## no critic |
27
|
18
|
50
|
|
|
|
165
|
if ($@) { |
28
|
0
|
|
|
|
|
0
|
return; # Not supported event |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
18
|
100
|
100
|
|
|
173
|
if ($subscribe_all || $subscribed_events->{$event_name}) { |
32
|
17
|
|
|
|
|
184
|
return $klass->call($self); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
6
|
return; # Not subscribed event |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |