File Coverage

blib/lib/Data/CompactReadonly/V0/TiedDictionary.pm
Criterion Covered Total %
statement 20 20 100.0
branch 2 2 100.0
condition n/a
subroutine 11 11 100.0
pod n/a
total 33 33 100.0


line stmt bran cond sub pod time code
1             package Data::CompactReadonly::V0::TiedDictionary;
2             our $VERSION = '0.1.0';
3              
4 5     5   36 use strict;
  5         11  
  5         155  
5 5     5   28 use warnings;
  5         13  
  5         1634  
6              
7             sub TIEHASH{
8 27     27   77 my($class, $object) = @_;
9 27         118 return bless({ object => $object }, $class);
10             }
11              
12 13     13   218 sub EXISTS { shift()->{object}->exists(shift()); }
13 23     23   263 sub FETCH { shift()->{object}->element(shift()); }
14 1     1   6 sub SCALAR { shift()->{object}->count(); }
15              
16             sub FIRSTKEY {
17 8     8   969 my $tiedhash = shift();
18 8         25 $tiedhash->{nextkey} = 0;
19 8         42 $tiedhash->NEXTKEY();
20             }
21              
22             sub NEXTKEY {
23 23     23   45 my $tiedhash = shift();
24 23 100       73 return undef if($tiedhash->{nextkey} == $tiedhash->{object}->count());
25 15         78 $tiedhash->{object}->_nth_key($tiedhash->{nextkey}++);
26             }
27              
28 3     3   26 sub STORE { die("Illegal access: store: this is a read-only database\n"); }
29 1     1   5 sub DELETE { shift()->STORE() }
30 1     1   6 sub CLEAR { shift()->STORE() }
31              
32             1;