line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
577829
|
use strictures 2; |
|
2
|
|
|
|
|
3364
|
|
|
2
|
|
|
|
|
108
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Tie::Redis::Candy; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# ABSTRACT: Tie Redis to HashRef or ArrayRef |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
2573
|
use Redis; |
|
2
|
|
|
|
|
115199
|
|
|
2
|
|
|
|
|
70
|
|
8
|
2
|
|
|
2
|
|
1212
|
use Tie::Redis::Candy::Hash; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
59
|
|
9
|
2
|
|
|
2
|
|
1113
|
use Tie::Redis::Candy::Array; |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
61
|
|
10
|
2
|
|
|
2
|
|
14
|
use Exporter qw(import); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
402
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '1.001'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @EXPORT_OK = qw(redis_hash redis_array); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub redis_hash { |
17
|
2
|
|
|
2
|
1
|
1508
|
my ( $redis, $key, %init ) = @_; |
18
|
2
|
|
|
|
|
18
|
tie( my %hash, 'Tie::Redis::Candy::Hash', $redis, $key ); |
19
|
2
|
|
|
|
|
17
|
$hash{$_} = delete $init{$_} for keys %init; |
20
|
2
|
|
|
|
|
816
|
bless( \%hash, 'Tie::Redis::Candy::Hash' ); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub redis_array { |
24
|
2
|
|
|
2
|
1
|
1599
|
my ( $redis, $listname, @init ) = @_; |
25
|
2
|
|
|
|
|
16
|
tie( my @array, 'Tie::Redis::Candy::Array', $redis, $listname ); |
26
|
2
|
|
|
|
|
6
|
while ( my $item = shift @init ) { |
27
|
4
|
|
|
|
|
461
|
push @array => $item; |
28
|
|
|
|
|
|
|
} |
29
|
2
|
|
|
|
|
431
|
bless( \@array, 'Tie::Redis::Candy::Array' ); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |