19 |
my $config; |
my $config; |
20 |
|
|
21 |
use index_DBI; # there is no other, right now ;-) |
use index_DBI; # there is no other, right now ;-) |
22 |
|
my $index; |
|
my $index = new index_DBI(); # open index |
|
23 |
|
|
24 |
my %opts; |
my %opts; |
25 |
|
|
31 |
|
|
32 |
getopts('d:m:qs', \%opts); |
getopts('d:m:qs', \%opts); |
33 |
|
|
34 |
my $db_dir; |
my $path; # this is name of database |
35 |
|
|
36 |
Text::Iconv->raise_error(1); # Conversion errors raise exceptions |
Text::Iconv->raise_error(1); # Conversion errors raise exceptions |
37 |
|
|
152 |
if ($filter) { |
if ($filter) { |
153 |
no strict 'refs'; |
no strict 'refs'; |
154 |
foreach my $d (&$filter($index_data)) { |
foreach my $d (&$filter($index_data)) { |
155 |
$index->insert($field, $d, $db_dir); |
$index->insert($field, $d, $path); |
156 |
} |
} |
157 |
} else { |
} else { |
158 |
$index->insert($field, $index_data, $db_dir); |
$index->insert($field, $index_data, $path); |
159 |
} |
} |
160 |
} |
} |
161 |
} |
} |
213 |
|
|
214 |
my $cfg = new Config::IniFiles( -file => $config_file ); |
my $cfg = new Config::IniFiles( -file => $config_file ); |
215 |
|
|
216 |
|
# open index |
217 |
|
$index = new index_DBI( |
218 |
|
$cfg->val('global', 'dbi_dbd'), |
219 |
|
$cfg->val('global', 'dbi_dsn'), |
220 |
|
$cfg->val('global', 'dbi_user'), |
221 |
|
$cfg->val('global', 'dbi_passwd') || '', |
222 |
|
); |
223 |
|
|
224 |
|
# delete [global] section to leave just databases sections |
225 |
|
$cfg->DeleteSection('global'); |
226 |
|
|
227 |
foreach my $database ($cfg->Sections) { |
foreach my $database ($cfg->Sections) { |
228 |
|
|
229 |
my $isis_db = $cfg -> val($database, 'isis_db') || die "$database doesn't have 'isis_db' defined!"; |
my $isis_db = $cfg -> val($database, 'isis_db') || die "$database doesn't have 'isis_db' defined!"; |
262 |
$last_p = $p; |
$last_p = $p; |
263 |
} |
} |
264 |
|
|
265 |
if (my $xml = $cp2utf->convert(isis2xml($row,$add_xml))) { |
my $swishpath = $path."#".int($row->{mfn}); |
266 |
|
|
267 |
|
if (my $xml = isis2xml($row,$add_xml)) { |
268 |
|
$xml = $cp2utf->convert($xml); |
269 |
use bytes; # as opposed to chars |
use bytes; # as opposed to chars |
270 |
print "Path-Name: $path#".int($row->{mfn})."\n"; |
print "Path-Name: $swishpath\n"; |
271 |
print "Content-Length: ".(length($xml)+1)."\n"; |
print "Content-Length: ".(length($xml)+1)."\n"; |
272 |
print "Document-Type: XML\n\n$xml\n"; |
print "Document-Type: XML\n\n$xml\n"; |
273 |
} |
} |