use LWP;
use URI::Escape;
use List::Util qw/first/;
+use File::Path;
$Estraier::DEBUG = 1;
=head1 VERSION
-Version 0.1
+Version 0.2
=cut
-our $VERSION = '0.1';
+our $VERSION = '0.2';
=head1 SYNOPSIS
$self->{label} ||= "WebPAC $self->{database}";
my $path = 'casket';
+ $path =~ s!/+$!!;
+
+ $self->{_casket_path} = $path;
+
+ $path .= '.tmp';
+ if (-e $path) {
+ rmtree($path) || $log->logdie("can't remove old temporary directory $path: $!");
+ }
+ mkpath($path) || $log->logdie("can't create new temporary directory $path: $!");
my $db = new Database();
unless($db->open($path, Database::DBWRITER | Database::DBCREAT)) {
}
+=head2 finish
+
+Close index and rename of to final path
+
+ $est->finish;
+
+=cut
+
+sub finish {
+ my $self = shift;
+
+ my $log = $self->_get_logger;
+ $log->info("closing Hyper Estraier index make it current...");
+
+ $self->{db}->close || $log->logdie("can't close index");
+
+ my $path = $self->{_casket_path} || $log->logdie("no _casket_path?");
+
+ if (-e $path) {
+ $log->warn("removing old $path");
+ rmtree($path) || $log->logdie("can't remove old temporary directory $path: $!");
+ }
+
+ rename $path . '.tmp', $path || $log->logdie("can't rename ${path}.tmp -> $path: $!");
+
+}
+
+
=head2 convert
my $utf8_string = $self->convert('string in codepage');