File Coverage

blib/lib/Logfile/EPrints/Filter/Period.pm
Criterion Covered Total %
statement 3 11 27.2
branch 0 6 0.0
condition 0 9 0.0
subroutine 1 3 33.3
pod 1 1 100.0
total 5 30 16.6


line stmt bran cond sub pod time code
1             package Logfile::EPrints::Filter::Period;
2              
3 6     6   40 use vars qw( $AUTOLOAD );
  6         11  
  6         1502  
4              
5             sub new {
6 0     0 1   my ($class,%self) = @_;
7 0   0       bless \%self, ref($class) || $class;
8             }
9              
10             sub AUTOLOAD
11             {
12 0     0     $AUTOLOAD =~ s/^.*:://;
13 0 0         return if $AUTOLOAD =~ /[A-Z]$/;
14 0           my ($self,$hit) = @_;
15 0 0 0       return if defined($self->{after}) && $hit->datetime <= $self->{after};
16 0 0 0       return if defined($self->{before}) && $hit->datetime >= $self->{before};
17 0           $self->{handler}->$AUTOLOAD($hit);
18             }
19              
20             1;
21              
22             =pod
23              
24             =head1 NAME
25              
26             Logfile::EPrints::Filter::Period
27              
28             =head1 DESCRIPTION
29              
30             Filter hits for a given time period (given as yyyymmddHHMMSS).
31              
32             =head1 METHODS
33              
34             =over 5
35              
36             =item new(%opts)
37              
38             after=>20040320145959
39             only include records I this datetime
40             before=>20040320160000
41             only include records I this datetime
42              
43             =back
44              
45             =cut