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