line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
10
|
|
|
10
|
|
275028
|
use strict; |
|
10
|
|
|
|
|
26
|
|
|
10
|
|
|
|
|
372
|
|
2
|
10
|
|
|
10
|
|
53
|
use warnings; |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
530
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Data::Remember; |
5
|
|
|
|
|
|
|
{ |
6
|
|
|
|
|
|
|
$Data::Remember::VERSION = '0.140490'; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
# ABSTRACT: remember complex information without giving yourself a headache |
9
|
|
|
|
|
|
|
|
10
|
10
|
|
|
10
|
|
53
|
use Carp; |
|
10
|
|
|
|
|
16
|
|
|
10
|
|
|
|
|
1065
|
|
11
|
10
|
|
|
10
|
|
60
|
use Scalar::Util qw/ reftype /; |
|
10
|
|
|
|
|
16
|
|
|
10
|
|
|
|
|
1239
|
|
12
|
10
|
|
|
10
|
|
12688
|
use Class::Load (); |
|
10
|
|
|
|
|
478231
|
|
|
10
|
|
|
|
|
258
|
|
13
|
10
|
|
|
10
|
|
6696
|
use Data::Remember::Class; |
|
10
|
|
|
|
|
37
|
|
|
10
|
|
|
|
|
1315
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub import { |
17
|
10
|
|
|
10
|
|
120
|
my $class = shift; |
18
|
10
|
|
50
|
|
|
64
|
my $brain = shift || 'Memory'; |
19
|
|
|
|
|
|
|
|
20
|
10
|
|
|
|
|
25
|
my $caller = caller; |
21
|
|
|
|
|
|
|
|
22
|
10
|
|
|
|
|
58
|
my $gray_matter = Data::Remember::Class->new($brain, @_); |
23
|
10
|
|
|
|
|
60
|
$class->_import_brain( $gray_matter => $caller ); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _import_brain { |
27
|
10
|
|
|
10
|
|
23
|
my $class = shift; |
28
|
10
|
|
|
|
|
17
|
my $brain = shift; |
29
|
10
|
|
|
|
|
21
|
my $package = shift; |
30
|
|
|
|
|
|
|
|
31
|
10
|
|
|
10
|
|
166
|
no strict 'refs'; |
|
10
|
|
|
|
|
23
|
|
|
10
|
|
|
|
|
5960
|
|
32
|
|
|
|
|
|
|
|
33
|
10
|
|
|
|
|
36
|
*{"$package\::remember"} = remember($brain); |
|
10
|
|
|
|
|
127
|
|
34
|
10
|
|
|
|
|
32
|
*{"$package\::remember_these"} = remember_these($brain); |
|
10
|
|
|
|
|
52
|
|
35
|
10
|
|
|
|
|
34
|
*{"$package\::recall"} = recall($brain); |
|
10
|
|
|
|
|
44
|
|
36
|
10
|
|
|
|
|
34
|
*{"$package\::recall_each"} = recall_each($brain); |
|
10
|
|
|
|
|
41
|
|
37
|
10
|
|
|
|
|
37
|
*{"$package\::recall_and_update"} = recall_and_update($brain); |
|
10
|
|
|
|
|
45
|
|
38
|
10
|
|
|
|
|
31
|
*{"$package\::forget"} = forget($brain); |
|
10
|
|
|
|
|
43
|
|
39
|
10
|
|
|
|
|
30
|
*{"$package\::forget_when"} = forget_when($brain); |
|
10
|
|
|
|
|
42
|
|
40
|
10
|
|
|
|
|
32
|
*{"$package\::brain"} = brain($brain); |
|
10
|
|
|
|
|
23539
|
|
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub remember { |
45
|
10
|
|
|
10
|
1
|
20
|
my $brain = shift; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub ($$) { |
48
|
69
|
|
|
69
|
|
137247
|
my $que = shift; |
49
|
69
|
|
|
|
|
119
|
my $fact = shift; |
50
|
|
|
|
|
|
|
|
51
|
69
|
|
|
|
|
307
|
$brain->remember($que, $fact); |
52
|
69
|
|
|
|
|
246
|
return; |
53
|
10
|
|
|
|
|
51
|
}; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub remember_these { |
58
|
10
|
|
|
10
|
1
|
18
|
my $brain = shift; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub ($$) { |
61
|
12
|
|
|
12
|
|
44
|
my $que = shift; |
62
|
12
|
|
|
|
|
18
|
my $fact = shift; |
63
|
|
|
|
|
|
|
|
64
|
12
|
|
|
|
|
47
|
$brain->remember_these($que, $fact); |
65
|
12
|
|
|
|
|
147
|
return; |
66
|
10
|
|
|
|
|
46
|
}; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub recall { |
71
|
10
|
|
|
10
|
1
|
16
|
my $brain = shift; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub ($) { |
74
|
179
|
|
|
179
|
|
10361
|
my $que = shift; |
75
|
|
|
|
|
|
|
|
76
|
179
|
|
|
|
|
726
|
return scalar $brain->recall($que); |
77
|
10
|
|
|
|
|
40
|
}; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub recall_each { |
82
|
10
|
|
|
10
|
1
|
19
|
my $brain = shift; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub ($) { |
85
|
8
|
|
|
8
|
|
15
|
my $que = shift; |
86
|
|
|
|
|
|
|
|
87
|
8
|
|
|
|
|
46
|
return scalar $brain->recall_each($que); |
88
|
10
|
|
|
|
|
44
|
}; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub recall_and_update { |
93
|
10
|
|
|
10
|
1
|
17
|
my $brain = shift; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub (&$) { |
96
|
4
|
|
|
4
|
|
9150
|
my $code = shift; |
97
|
4
|
|
|
|
|
23
|
my $que = shift; |
98
|
|
|
|
|
|
|
|
99
|
4
|
|
|
|
|
30
|
return scalar $brain->recall_and_update($code, $que); |
100
|
10
|
|
|
|
|
40
|
}; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub forget { |
105
|
10
|
|
|
10
|
1
|
20
|
my $brain = shift; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub ($) { |
108
|
13
|
|
|
13
|
|
32
|
my $que = shift; |
109
|
|
|
|
|
|
|
|
110
|
13
|
|
|
|
|
61
|
$brain->forget($que); |
111
|
13
|
|
|
|
|
120
|
return; |
112
|
10
|
|
|
|
|
34
|
}; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub forget_when { |
117
|
10
|
|
|
10
|
1
|
16
|
my $brain = shift; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub (&$) { |
120
|
32
|
|
|
32
|
|
17486
|
my $code = shift; |
121
|
32
|
|
|
|
|
57
|
my $que = shift; |
122
|
|
|
|
|
|
|
|
123
|
32
|
|
|
|
|
151
|
$brain->forget_when($code, $que); |
124
|
32
|
|
|
|
|
314
|
return; |
125
|
10
|
|
|
|
|
42
|
}; |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub brain { |
130
|
10
|
|
|
10
|
1
|
17
|
my $brain = shift; |
131
|
|
|
|
|
|
|
|
132
|
10
|
|
|
12
|
|
32
|
sub () { return $brain->brain }; |
|
12
|
|
|
|
|
982
|
|
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
1; |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
__END__ |