line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Deeme::Backend::Memory; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
1106
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
99
|
|
4
|
3
|
|
|
3
|
|
65
|
use 5.008_005; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
159
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
6
|
3
|
|
|
3
|
|
14
|
use Deeme::Obj 'Deeme::Backend'; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
20
|
|
7
|
3
|
|
|
3
|
|
25
|
use Carp 'croak'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1063
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub events_get { |
10
|
86
|
|
|
86
|
0
|
98
|
my $self = shift; |
11
|
86
|
|
|
|
|
95
|
my $name = shift; |
12
|
86
|
|
50
|
|
|
296
|
my $deserialize = shift || 1; |
13
|
|
|
|
|
|
|
#deserializing subs and returning a reference |
14
|
|
|
|
|
|
|
#return undef if ( !$event ); |
15
|
86
|
|
|
|
|
437
|
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
|
60
|
my $self = shift; |
25
|
45
|
|
|
|
|
56
|
my $name = shift; |
26
|
|
|
|
|
|
|
#deserializing subs and returning a reference |
27
|
45
|
|
|
|
|
44
|
return @{ $self->{'events'}{$name}{'onces'} }; |
|
45
|
|
|
|
|
186
|
|
28
|
|
|
|
|
|
|
} #get events |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub once_update { |
31
|
7
|
|
|
7
|
0
|
11
|
my $self = shift; |
32
|
7
|
|
|
|
|
10
|
my $name = shift; |
33
|
7
|
|
|
|
|
9
|
my $onces = shift; |
34
|
7
|
|
|
|
|
24
|
$self->{'events'}{$name}{'onces'} = $onces; |
35
|
|
|
|
|
|
|
} #get events |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub event_add { |
38
|
29
|
|
|
29
|
0
|
42
|
my $self = shift; |
39
|
29
|
|
|
|
|
38
|
my $name = shift; |
40
|
29
|
|
|
|
|
27
|
my $cb = shift; |
41
|
29
|
|
100
|
|
|
77
|
my $once = shift || 0; |
42
|
29
|
|
100
|
|
|
33
|
push @{$self->{'events'}{$name}{'functions'} ||= []}, $cb; |
|
29
|
|
|
|
|
153
|
|
43
|
29
|
|
100
|
|
|
33
|
push @{$self->{'events'}{$name}{'onces'} ||= []}, $once; |
|
29
|
|
|
|
|
127
|
|
44
|
|
|
|
|
|
|
|
45
|
29
|
|
|
|
|
86
|
return $cb; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub event_delete { |
49
|
15
|
|
|
15
|
0
|
20
|
my $self = shift; |
50
|
15
|
|
|
|
|
18
|
my $name = shift; |
51
|
|
|
|
|
|
|
|
52
|
15
|
|
|
|
|
87
|
delete $self->{'events'}{$name}; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
} #delete event |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub event_update { |
57
|
7
|
|
|
7
|
0
|
11
|
my $self = shift; |
58
|
7
|
|
|
|
|
9
|
my $name = shift; |
59
|
7
|
|
|
|
|
8
|
my $functions = shift; |
60
|
7
|
|
|
|
|
9
|
my $serialize = shift; |
61
|
|
|
|
|
|
|
|
62
|
7
|
|
|
|
|
23
|
$self->{'events'}{$name}{'functions'} = $functions; |
63
|
|
|
|
|
|
|
} #update event |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__END__ |