| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Hubot::Listener; |
|
2
|
|
|
|
|
|
|
$Hubot::Listener::VERSION = '0.2.7'; |
|
3
|
1
|
|
|
1
|
|
1676
|
use Moose; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
use namespace::autoclean; |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use Hubot::Response; |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has 'robot' => ( is => 'ro', isa => 'Hubot::Robot', ); |
|
9
|
|
|
|
|
|
|
has 'matcher' => ( |
|
10
|
|
|
|
|
|
|
traits => ['Code'], |
|
11
|
|
|
|
|
|
|
is => 'rw', |
|
12
|
|
|
|
|
|
|
isa => 'CodeRef', |
|
13
|
|
|
|
|
|
|
handles => { matching => 'execute', }, |
|
14
|
|
|
|
|
|
|
); |
|
15
|
|
|
|
|
|
|
has 'callback' => ( |
|
16
|
|
|
|
|
|
|
traits => ['Code'], |
|
17
|
|
|
|
|
|
|
is => 'rw', |
|
18
|
|
|
|
|
|
|
isa => 'CodeRef', |
|
19
|
|
|
|
|
|
|
handles => { cb => 'execute', }, |
|
20
|
|
|
|
|
|
|
); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub call { |
|
23
|
|
|
|
|
|
|
my ( $self, $message ) = @_; |
|
24
|
|
|
|
|
|
|
if ( my @match = $self->matching($message) ) { |
|
25
|
|
|
|
|
|
|
$self->cb( |
|
26
|
|
|
|
|
|
|
new Hubot::Response( |
|
27
|
|
|
|
|
|
|
robot => $self->robot, |
|
28
|
|
|
|
|
|
|
message => $message, |
|
29
|
|
|
|
|
|
|
match => \@match, |
|
30
|
|
|
|
|
|
|
) |
|
31
|
|
|
|
|
|
|
); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
return 1; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
else { |
|
36
|
|
|
|
|
|
|
return 0; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=pod |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=encoding utf-8 |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 NAME |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Hubot::Listener |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 VERSION |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
version 0.2.7 |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Nope. |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
base class of L<Hubot::TextListener> |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
try to match all registered regex then execute callback with matching result and input messages. |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
L<Hubot::TextListener> |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 AUTHOR |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Hyungsuk Hong <hshong@perl.kr> |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
This software is copyright (c) 2012 by Hyungsuk Hong. |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
79
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |