File Coverage

blib/lib/Data/Enumerator/File.pm
Criterion Covered Total %
statement 12 23 52.1
branch 0 2 0.0
condition n/a
subroutine 4 7 57.1
pod 0 2 0.0
total 16 34 47.0


line stmt bran cond sub pod time code
1             package Data::Enumerator::File;
2 1     1   513 use strict;
  1         1  
  1         24  
3 1     1   3 use warnings;
  1         1  
  1         22  
4 1     1   382 use IO::File;
  1         6232  
  1         91  
5 1     1   5 use base qw/Data::Enumerator::Base/;
  1         1  
  1         346  
6              
7             sub new {
8 0     0 0   my ( $class, $file ) = @_;
9 0           bless {
10             file => $file,
11             }, $class;
12             }
13              
14             sub iterator {
15 0     0 0   my ($self) = @_;
16 0           my $file = $self->{file};
17 0           my $fh = IO::File->new;
18 0           $fh->open( $file, 'r' );
19             return sub {
20 0     0     my $line = <$fh>;
21 0 0         return $line if( defined $line );
22 0           $fh->close;
23 0           return $self->LAST;
24             }
25 0           }
26             1;