line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Deeme::Backend::Memory; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
860
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
104
|
|
4
|
3
|
|
|
3
|
|
45
|
use 5.008_005; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
133
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.05'; |
6
|
3
|
|
|
3
|
|
12
|
use Deeme::Obj 'Deeme::Backend'; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
17
|
|
7
|
3
|
|
|
3
|
|
51
|
use Carp 'croak'; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
917
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub events_get { |
10
|
89
|
|
|
89
|
0
|
81
|
my $self = shift; |
11
|
89
|
|
|
|
|
79
|
my $name = shift; |
12
|
89
|
|
50
|
|
|
264
|
my $deserialize = shift || 1; |
13
|
|
|
|
|
|
|
#deserializing subs and returning a reference |
14
|
|
|
|
|
|
|
#return undef if ( !$event ); |
15
|
89
|
|
|
|
|
358
|
return $self->{'events'}{$name}{'functions'}; |
16
|
|
|
|
|
|
|
} #get events |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub events_reset{ |
19
|
0
|
|
|
0
|
0
|
0
|
my $self=shift; |
20
|
0
|
|
|
|
|
0
|
delete $self->{'events'}; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub events_onces { |
24
|
45
|
|
|
45
|
0
|
47
|
my $self = shift; |
25
|
45
|
|
|
|
|
33
|
my $name = shift; |
26
|
|
|
|
|
|
|
#deserializing subs and returning a reference |
27
|
45
|
|
|
|
|
26
|
return @{ $self->{'events'}{$name}{'onces'} }; |
|
45
|
|
|
|
|
144
|
|
28
|
|
|
|
|
|
|
} #get events |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub once_update { |
31
|
7
|
|
|
7
|
0
|
10
|
my $self = shift; |
32
|
7
|
|
|
|
|
9
|
my $name = shift; |
33
|
7
|
|
|
|
|
8
|
my $onces = shift; |
34
|
7
|
|
|
|
|
20
|
$self->{'events'}{$name}{'onces'} = $onces; |
35
|
|
|
|
|
|
|
} #get events |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub event_add { |
38
|
29
|
|
|
29
|
0
|
30
|
my $self = shift; |
39
|
29
|
|
|
|
|
29
|
my $name = shift; |
40
|
29
|
|
|
|
|
24
|
my $cb = shift; |
41
|
29
|
|
100
|
|
|
62
|
my $once = shift || 0; |
42
|
29
|
|
100
|
|
|
20
|
push @{$self->{'events'}{$name}{'functions'} ||= []}, $cb; |
|
29
|
|
|
|
|
124
|
|
43
|
29
|
|
100
|
|
|
27
|
push @{$self->{'events'}{$name}{'onces'} ||= []}, $once; |
|
29
|
|
|
|
|
88
|
|
44
|
|
|
|
|
|
|
|
45
|
29
|
|
|
|
|
57
|
return $cb; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub event_delete { |
49
|
15
|
|
|
15
|
0
|
15
|
my $self = shift; |
50
|
15
|
|
|
|
|
13
|
my $name = shift; |
51
|
|
|
|
|
|
|
|
52
|
15
|
|
|
|
|
62
|
delete $self->{'events'}{$name}; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
} #delete event |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub event_update { |
57
|
7
|
|
|
7
|
0
|
9
|
my $self = shift; |
58
|
7
|
|
|
|
|
9
|
my $name = shift; |
59
|
7
|
|
|
|
|
10
|
my $functions = shift; |
60
|
7
|
|
|
|
|
7
|
my $serialize = shift; |
61
|
|
|
|
|
|
|
|
62
|
7
|
|
|
|
|
18
|
$self->{'events'}{$name}{'functions'} = $functions; |
63
|
|
|
|
|
|
|
} #update event |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__END__ |