| 1 | package Tie::Redis::Candy; | ||||||||||
| 2 | |||||||||||
| 3 | # ABSTRACT: Tie Redis to HashRef or ArrayRef | ||||||||||
| 4 | |||||||||||
| 5 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use Tie::Redis::Candy::Hash; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 2 | ▶ | use Tie::Redis::Candy::Array; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 2 | ▶ | use Exporter qw(import); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 2 | our $VERSION = '1.000'; # VERSION | |||||||||
| 12 | |||||||||||
| 13 | 2 | our @EXPORT_OK = qw(redis_hash redis_array); | |||||||||
| 14 | |||||||||||
| 15 | sub redis_hash { | ||||||||||
| 16 | 2 | ▶ | my ( $redis, $prefix, %init ) = @_; | ||||||||
|
Subroutine
redis_hash: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 17 | 2 | tie( my %hash, 'Tie::Redis::Candy::Hash', $redis, $prefix ); | |||||||||
| 18 | 2 | $hash{$_} = delete $init{$_} for keys %init; | |||||||||
| 19 | 2 | bless( \%hash, 'Tie::Redis::Candy::Hash' ); | |||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | sub redis_array { | ||||||||||
| 23 | 2 | ▶ | my ( $redis, $listname, @init ) = @_; | ||||||||
|
Subroutine
redis_array: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 24 | 2 | tie( my @array, 'Tie::Redis::Candy::Array', $redis, $listname ); | |||||||||
| 25 | 2 | ▶ | while ( my $item = shift @init ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 4 | push @array => $item; | |||||||||
| 27 | } | ||||||||||
| 28 | 2 | bless( \@array, 'Tie::Redis::Candy::Array' ); | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 2 | 1; | |||||||||
| 32 | |||||||||||
| 33 | __END__ | ||||||||||