92 |
$module =~ s#::#/#g; |
$module =~ s#::#/#g; |
93 |
$module .= '.pm'; |
$module .= '.pm'; |
94 |
$log->debug("require low-level module $self->{module} from $module"); |
$log->debug("require low-level module $self->{module} from $module"); |
95 |
|
|
96 |
require $module; |
require $module; |
97 |
eval $self->{module} .'->import'; |
#eval $self->{module} .'->import'; |
98 |
|
|
99 |
# check if required subclasses are implemented |
# check if required subclasses are implemented |
100 |
foreach my $subclass (qw/open_db fetch_rec/) { |
foreach my $subclass (qw/open_db fetch_rec init/) { |
101 |
if ( $self->can($subclass) ) { |
my $n = $self->{module} . '::' . $subclass; |
102 |
$log->debug("imported $subclass"); |
if (! defined &{ $n }) { |
103 |
|
my $missing = "missing $subclass in $self->{module}"; |
104 |
|
$log->logwarn($missing); |
105 |
|
$self->{$subclass} = sub { warn "$missing\n" }; |
106 |
} else { |
} else { |
107 |
$log->warn("missing $subclass in $self->{module}"); |
$self->{$subclass} = \&{ $n }; |
108 |
} |
} |
109 |
} |
} |
110 |
|
|
111 |
if ($self->can('init')) { |
if ($self->{init}) { |
112 |
$log->debug("calling init"); |
$log->debug("calling init"); |
113 |
$self->init(@_); |
$self->{init}->($self, @_); |
114 |
} |
} |
115 |
|
|
116 |
$self->{'code_page'} ||= 'ISO-8859-2'; |
$self->{'code_page'} ||= 'ISO-8859-2'; |
185 |
# create Text::Iconv object |
# create Text::Iconv object |
186 |
$self->{iconv} = Text::Iconv->new($code_page,$self->{'code_page'}); |
$self->{iconv} = Text::Iconv->new($code_page,$self->{'code_page'}); |
187 |
|
|
188 |
my ($db, $size) = $self->open_db( |
my ($db, $size) = $self->{open_db}->( $self, |
189 |
path => $arg->{path}, |
path => $arg->{path}, |
190 |
); |
); |
191 |
|
|
225 |
|
|
226 |
$log->debug("position: $pos\n"); |
$log->debug("position: $pos\n"); |
227 |
|
|
228 |
my $rec = $self->fetch_rec( $db, $pos ); |
my $rec = $self->{fetch_rec}->($self, $db, $pos ); |
229 |
|
|
230 |
if (! $rec) { |
if (! $rec) { |
231 |
$log->warn("record $pos empty? skipping..."); |
$log->warn("record $pos empty? skipping..."); |