File Coverage

blib/lib/KinoSearch1/Store/InStream.pm
Criterion Covered Total %
statement 18 18 100.0
branch 1 2 50.0
condition n/a
subroutine 6 6 100.0
pod 0 2 0.0
total 25 28 89.2


line stmt bran cond sub pod time code
1             package KinoSearch1::Store::InStream;
2 40     40   228 use base qw( KinoSearch1::Util::CClass );
  40         78  
  40         15527  
3 40     40   1778 use strict;
  40         84  
  40         1088  
4 40     40   215 use warnings;
  40         86  
  40         999  
5 40     40   202 use KinoSearch1::Util::ToolSet;
  40         81  
  40         18849  
6              
7 392     392 0 2408 sub close { CORE::close shift->get_fh }
8              
9             =for comment
10             Dupe the filehandle and create a new object around the dupe. Seek the dupe
11             to the same spot as the original.
12              
13             =cut
14              
15             sub clone_stream {
16 1979     1979 0 3021 my $self = shift;
17 1979 50       24751 open( my $duped_fh, '<&=', $self->get_fh )
18             or confess("Couldn't dupe filehandle: $!");
19 1979         20064 my $evil_twin
20             = __PACKAGE__->new( $duped_fh, $self->get_offset, $self->length, );
21 1979         9009 $evil_twin->seek( $self->tell );
22 1979         11531 return $evil_twin;
23             }
24              
25             1;
26              
27             __END__