File: File.pm

package info (click to toggle)
libdbix-fulltextsearch-perl 0.73-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 500 kB
  • sloc: perl: 1,617; makefile: 7
file content (27 lines) | stat: -rw-r--r-- 497 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

package DBIx::FullTextSearch::File;
use DBIx::FullTextSearch::String;
use strict;
use vars qw! @ISA !;
@ISA = qw! DBIx::FullTextSearch::String !;

sub index_document {
	my ($self, $file, $extra_data) = @_;
	my $dbh = $self->{'dbh'};

	open FILE, $file or do {
		$self->{'errstr'} = "Reading the file `$file' failed: $!";
		return;
	};
	my $data;
	{
		local $/ = undef;
		$data = <FILE>;
	}
	$data .= " $extra_data" if $extra_data;
	close FILE;
	$self->SUPER::index_document($file, $data);
}

1;