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.6';
3              
4 5     5   30 use strict;
  5         8  
  5         132  
5 5     5   22 use warnings;
  5         7  
  5         1346  
6              
7             sub TIEHASH{
8 27     27   56 my($class, $object) = @_;
9 27         103 return bless({ object => $object }, $class);
10             }
11              
12 13     13   170 sub EXISTS { shift()->{object}->exists(shift()); }
13 23     23   227 sub FETCH { shift()->{object}->element(shift()); }
14 1     1   4 sub SCALAR { shift()->{object}->count(); }
15              
16             sub FIRSTKEY {
17 8     8   833 my $tiedhash = shift();
18 8         17 $tiedhash->{nextkey} = 0;
19 8         18 $tiedhash->NEXTKEY();
20             }
21              
22             sub NEXTKEY {
23 23     23   43 my $tiedhash = shift();
24 23 100       62 return undef if($tiedhash->{nextkey} == $tiedhash->{object}->count());
25 15         65 $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   4 sub DELETE { shift()->STORE() }
30 1     1   4 sub CLEAR { shift()->STORE() }
31              
32             1;