line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Hubot::User; |
2
|
|
|
|
|
|
|
$Hubot::User::VERSION = '0.2.7'; |
3
|
1
|
|
|
1
|
|
4800
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
118
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
7
|
0
|
|
|
0
|
0
|
|
my ( $class, $ref ) = @_; |
8
|
0
|
|
0
|
|
|
|
$ref->{name} ||= $ref->{id}; |
9
|
0
|
|
|
|
|
|
bless $ref, $class; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
0
|
0
|
|
sub TO_JSON { return { %{ shift() } } } |
|
0
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
1; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=pod |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=encoding utf-8 |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 NAME |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Hubot::User - storage object for hubot users. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 VERSION |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
version 0.2.7 |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 SYNOPSIS |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $user = Hubot::User->new( |
31
|
|
|
|
|
|
|
id => '1234', |
32
|
|
|
|
|
|
|
name => 'aanoaa', |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
$user->{something} = 'awesome'; # if you using external storage for Hubot::Brain |
36
|
|
|
|
|
|
|
# this will stored. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 DESCRIPTION |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
L<Hubot::User> is a storage object to chat rooms user's data. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
L<Hubot::Robot> has L<Hubot::User> pool. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
$robot->userForId($id, $data); # make new user with $data if not found $id |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
L<Hubot::Script::redisBrain> save users data to C<hubot:storage>. |
47
|
|
|
|
|
|
|
so L<Hubot::Robot> can reuse it. |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$ redis-cli |
50
|
|
|
|
|
|
|
redis 127.0.0.1:6379> get hubot:storage |
51
|
|
|
|
|
|
|
... |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 SEE ALSO |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
L<Hubot::Script::redisBrain> |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 AUTHOR |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Hyungsuk Hong <hshong@perl.kr> |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This software is copyright (c) 2012 by Hyungsuk Hong. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
66
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=cut |