File Coverage

blib/lib/WARC/Index/File/CDX/Entry.pm
Criterion Covered Total %
statement 16 16 100.0
branch 2 2 100.0
condition n/a
subroutine 8 8 100.0
pod 6 6 100.0
total 32 32 100.0


line stmt bran cond sub pod time code
1             package WARC::Index::File::CDX::Entry; # -*- CPerl -*-
2              
3 2     2   70756 use strict;
  2         14  
  2         62  
4 2     2   9 use warnings;
  2         4  
  2         524  
5              
6             require WARC::Index::Entry;
7             our @ISA = qw(WARC::Index::Entry);
8              
9             require WARC; *WARC::Index::File::CDX::Entry::VERSION = \$WARC::VERSION;
10              
11             # This implementation uses a hash as the underlying structure.
12              
13             # Accessible search keys are stored directly in the hash, while internal
14             # values are stored with names with a leading underscore.
15              
16 1     1 1 1782 sub index { (shift)->{_index} }
17 30     30 1 75 sub volume { (shift)->{_g__volume} }
18 1     1 1 5 sub entry_position { (shift)->{_entry_offset} }
19 30     30 1 187 sub record_offset { (shift)->{_Vv__record_offset} }
20              
21             sub next {
22 13     13 1 26 my $self = shift;
23              
24             return $self->{_index}->entry_at($self->{_entry_offset}
25 13         51 + $self->{_entry_length});
26             }
27              
28             sub value {
29 96     96 1 671 my $self = shift;
30 96         174 my $key = shift;
31              
32 96 100       216 return undef if $key =~ m/^_/;
33 94         226 return $self->{$key};
34             }
35              
36             1;
37             __END__