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   70309 use strict;
  2         14  
  2         59  
4 2     2   10 use warnings;
  2         3  
  2         480  
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 1734 sub index { (shift)->{_index} }
17 30     30 1 76 sub volume { (shift)->{_g__volume} }
18 1     1 1 5 sub entry_position { (shift)->{_entry_offset} }
19 30     30 1 165 sub record_offset { (shift)->{_Vv__record_offset} }
20              
21             sub next {
22 13     13 1 21 my $self = shift;
23              
24             return $self->{_index}->entry_at($self->{_entry_offset}
25 13         76 + $self->{_entry_length});
26             }
27              
28             sub value {
29 96     96 1 636 my $self = shift;
30 96         115 my $key = shift;
31              
32 96 100       204 return undef if $key =~ m/^_/;
33 94         187 return $self->{$key};
34             }
35              
36             1;
37             __END__