Candy.pm

filter: Statementstmt 100% 27 / 27 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 2 / 2 totaltotal 100% 38 / 38 CC 3 SCAR 3.7
CC
3
Cov
100%
redis_hash
2.0
redis_array
2.0
BEGIN
1.0
CRAP 1.4
« Candy/Array.pm ↑ Summary Candy/Hash.pm »
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
BranchTrueFalseTotal
if (my $item = shift @init) 4 2 6
27 4 push @array => $item;
28 }
29 2 bless( \@array, 'Tie::Redis::Candy::Array' );
30 }
31  
32 2 1;
33  
34 __END__
« Candy/Array.pm ↑ Summary Candy/Hash.pm »