File Coverage

blib/lib/Parse/AccessLogEntry/Accessor.pm
Criterion Covered Total %
statement 19 19 100.0
branch 1 2 50.0
condition n/a
subroutine 5 5 100.0
pod 2 2 100.0
total 27 28 96.4


line stmt bran cond sub pod time code
1             package Parse::AccessLogEntry::Accessor;
2              
3 2     2   68783 use warnings;
  2         5  
  2         86  
4 2     2   11 use strict;
  2         3  
  2         96  
5              
6             our $VERSION = '0.01';
7              
8 2     2   10 use base qw( Parse::AccessLogEntry Class::Accessor::Fast );
  2         8  
  2         1621  
9             __PACKAGE__->mk_ro_accessors(qw(
10             host user date time
11             diffgmt rtype file proto
12             code bytes refer agent
13             ));
14              
15              
16             sub new {
17 1     1 1 14 my $class = shift;
18 1         12 my $self = $class->SUPER::new;
19              
20 1         10 return bless $self;
21             }
22              
23             sub parse {
24 1     1 1 5 my $self = shift;
25 1 50       4 my $line = shift or die;
26              
27 1         7 my $ref = $self->SUPER::parse($line);
28              
29 1         54 while (my ($key, $val) = each %{$ref}) {
  13         32  
30 12         34 $self->{$key} = $val;
31             }
32 1         5 return $self;
33             }
34              
35             1;
36             __END__