line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bot::Cobalt::IRC::Event; |
2
|
|
|
|
|
|
|
$Bot::Cobalt::IRC::Event::VERSION = '0.021003'; |
3
|
|
|
|
|
|
|
## Base class for IRC events. |
4
|
|
|
|
|
|
|
|
5
|
11
|
|
|
11
|
|
17918
|
use Bot::Cobalt::Common; |
|
11
|
|
|
|
|
17
|
|
|
11
|
|
|
|
|
63
|
|
6
|
|
|
|
|
|
|
|
7
|
11
|
|
|
11
|
|
490
|
use Moo; |
|
11
|
|
|
|
|
6180
|
|
|
11
|
|
|
|
|
65
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has context => ( |
10
|
|
|
|
|
|
|
required => 1, |
11
|
|
|
|
|
|
|
is => 'rw', |
12
|
|
|
|
|
|
|
isa => Str, |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has src => ( |
16
|
|
|
|
|
|
|
required => 1, |
17
|
|
|
|
|
|
|
is => 'rw', |
18
|
|
|
|
|
|
|
isa => Str, |
19
|
|
|
|
|
|
|
trigger => sub { |
20
|
|
|
|
|
|
|
## If 'src' changes, reset nick/user/host as-needed. |
21
|
|
|
|
|
|
|
my ($self, $value) = @_; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my @types = qw/nick user host/; |
24
|
|
|
|
|
|
|
my %pieces; |
25
|
|
|
|
|
|
|
@pieces{@types} = parse_user($value); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
for my $type (@types) { |
28
|
|
|
|
|
|
|
my $meth = '_set_src_'.$type; |
29
|
|
|
|
|
|
|
my $hasmeth = 'has_src_'.$type; |
30
|
|
|
|
|
|
|
$self->$meth($pieces{$type}) if $self->$hasmeth; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
has src_nick => ( |
36
|
|
|
|
|
|
|
lazy => 1, |
37
|
|
|
|
|
|
|
is => 'rwp', |
38
|
|
|
|
|
|
|
predicate => 'has_src_nick', |
39
|
|
|
|
|
|
|
default => sub { (parse_user($_[0]->src))[0] }, |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
has src_user => ( |
43
|
|
|
|
|
|
|
lazy => 1, |
44
|
|
|
|
|
|
|
is => 'rwp', |
45
|
|
|
|
|
|
|
predicate => 'has_src_user', |
46
|
|
|
|
|
|
|
default => sub { (parse_user($_[0]->src))[1] }, |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
has src_host => ( |
50
|
|
|
|
|
|
|
lazy => 1, |
51
|
|
|
|
|
|
|
is => 'rwp', |
52
|
|
|
|
|
|
|
predicate => 'has_src_host', |
53
|
|
|
|
|
|
|
default => sub { (parse_user($_[0]->src))[2] }, |
54
|
|
|
|
|
|
|
); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
__END__ |