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.0.5';
3              
4 5     5   36 use strict;
  5         12  
  5         162  
5 5     5   28 use warnings;
  5         11  
  5         1718  
6              
7             sub TIEHASH{
8 27     27   57 my($class, $object) = @_;
9 27         100 return bless({ object => $object }, $class);
10             }
11              
12 13     13   195 sub EXISTS { shift()->{object}->exists(shift()); }
13 23     23   212 sub FETCH { shift()->{object}->element(shift()); }
14 1     1   6 sub SCALAR { shift()->{object}->count(); }
15              
16             sub FIRSTKEY {
17 8     8   952 my $tiedhash = shift();
18 8         21 $tiedhash->{nextkey} = 0;
19 8         18 $tiedhash->NEXTKEY();
20             }
21              
22             sub NEXTKEY {
23 23     23   42 my $tiedhash = shift();
24 23 100       79 return undef if($tiedhash->{nextkey} == $tiedhash->{object}->count());
25 15         71 $tiedhash->{object}->_nth_key($tiedhash->{nextkey}++);
26             }
27              
28 3     3   23 sub STORE { die("Illegal access: store: this is a read-only database\n"); }
29 1     1   5 sub DELETE { shift()->STORE() }
30 1     1   4 sub CLEAR { shift()->STORE() }
31              
32             1;