File Coverage

blib/lib/Data/Enumerator/File.pm
Criterion Covered Total %
statement 23 23 100.0
branch 2 2 100.0
condition n/a
subroutine 7 7 100.0
pod 0 2 0.0
total 32 34 94.1


line stmt bran cond sub pod time code
1             package Data::Enumerator::File;
2 9     9   1106 use strict;
  9         23  
  9         521  
3 9     9   48 use warnings;
  9         15  
  9         220  
4 9     9   10253 use IO::File;
  9         148509  
  9         1531  
5 9     9   169 use base qw/Data::Enumerator::Base/;
  9         19  
  9         21877  
6              
7             sub new {
8 1     1 0 16 my ( $class, $file ) = @_;
9 1         8 bless {
10             file => $file,
11             }, $class;
12             }
13              
14             sub iterator {
15 1     1 0 109 my ($self) = @_;
16 1         13 my $file = $self->{file};
17 1         12 my $fh = IO::File->new;
18 1         59 $fh->open( $file, 'r' );
19             return sub {
20 85     85   174 my $line = <$fh>;
21 85 100       361 return $line if( defined $line );
22 1         18 $fh->close;
23 1         36 return $self->LAST;
24             }
25 1         96 }
26             1;