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   66980 use strict;
  2         10  
  2         58  
4 2     2   11 use warnings;
  2         3  
  2         491  
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 1707 sub index { (shift)->{_index} }
17 30     30 1 77 sub volume { (shift)->{_g__volume} }
18 1     1 1 4 sub entry_position { (shift)->{_entry_offset} }
19 30     30 1 231 sub record_offset { (shift)->{_Vv__record_offset} }
20              
21             sub next {
22 13     13 1 23 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 649 my $self = shift;
30 96         134 my $key = shift;
31              
32 96 100       215 return undef if $key =~ m/^_/;
33 94         214 return $self->{$key};
34             }
35              
36             1;
37             __END__