File Coverage

blib/lib/Plucene/SearchEngine/Index/Text.pm
Criterion Covered Total %
statement 10 12 83.3
branch 2 6 33.3
condition n/a
subroutine 2 2 100.0
pod 0 1 0.0
total 14 21 66.6


line stmt bran cond sub pod time code
1             package Plucene::SearchEngine::Index::Text;
2 1     1   1182 use base 'Plucene::SearchEngine::Index::Base';
  1         4  
  1         371  
3              
4             =head1 NAME
5              
6             Plucene::SearchEngine::Index::Text - Backend for plain text files
7              
8             =head1 DESCRIPTION
9              
10             This backend sucks a plain text file into the C field.
11              
12             =cut
13              
14             sub gather_data_from_file {
15 1     1 0 2 my ($self, $file) = @_;
16 1         2 my $in;
17 1 50       5 if (exists $self->{encoding}) {
18 0         0 my $encoding = $self->{encoding}{data}[0];
19 0 0       0 open $in, "<:encoding($encoding)", $file or die $!;
20             } else {
21 1 50       47 open $in, $file or die $!;
22             }
23 1         32 while (<$in>) {
24 15         40 $self->add_data("text" => "UnStored" => $_);
25             }
26 1         17 return $self;
27             }
28             1;