line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Hubot::Scripts::storable; |
2
|
|
|
|
|
|
|
$Hubot::Scripts::storable::VERSION = '0.1.10'; |
3
|
1
|
|
|
1
|
|
742
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
16
|
|
5
|
1
|
|
|
1
|
|
618
|
use Storable; |
|
1
|
|
|
|
|
2687
|
|
|
1
|
|
|
|
|
189
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub load { |
8
|
0
|
|
|
0
|
0
|
|
my ( $class, $robot ) = @_; |
9
|
0
|
|
0
|
|
|
|
my $store = $ENV{HUBOT_STORABLE_PATH} || './hubot.dat'; |
10
|
|
|
|
|
|
|
|
11
|
0
|
0
|
|
|
|
|
my $data = -f $store ? retrieve($store) : {}; |
12
|
0
|
|
|
|
|
|
$robot->brain->mergeData($data); |
13
|
|
|
|
|
|
|
$robot->brain->on( |
14
|
|
|
|
|
|
|
'save', |
15
|
|
|
|
|
|
|
sub { |
16
|
0
|
|
|
0
|
|
|
my ( $e, $data ) = @_; |
17
|
0
|
|
|
|
|
|
store $data, $store; |
18
|
|
|
|
|
|
|
} |
19
|
0
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
1; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 NAME |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Hubot::Scripts::storable |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 VERSION |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
version 0.1.10 |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 SYNOPSIS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
storable: THIS IS NOT COMMAND |
35
|
|
|
|
|
|
|
storable: retrieve robot's brain at boot up time and save it at shutdown time |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 CONFIGURATION |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=over |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=item HUBOT_STORABLE_PATH |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
F<./hubot.dat> is default to use. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=back |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 SEE ALSO |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
L |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 AUTHOR |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Hyungsuk Hong |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |