8 use Text::Unaccent 1.02; # 1.01 won't compile on my platform,
13 use Fcntl; # for O_RDWR
19 $config_file =~ s/\.pl$/.conf/;
20 $config_file = $ARGV[0] if (-f $ARGV[0]);
21 die "FATAL: can't find configuration file '$config_file'" if (! -e $config_file);
25 #use index_DBI; # default DBI module for index
26 use index_DBI_cache; # faster DBI module using memory cache
33 # -m multiple directories
37 getopts('d:m:qs', \%opts);
39 my $path; # this is name of database
41 Text::Iconv->raise_error(0); # Conversion errors don't raise exceptions
43 # this is encoding of all files on disk, including import_xml/*.xml file and
44 # filter/*.pm files! It will be used to store strings in perl internally!
45 my $codepage = 'ISO-8859-2';
47 my $utf2cp = Text::Iconv->new('UTF-8',$codepage);
48 # this function will convert data from XML files to local encoding
50 return $utf2cp->convert($_[0]);
53 # decode isis/excel or other import codepage
56 # outgoing xml must be in UTF-8
57 my $cp2utf = Text::Iconv->new($codepage,'UTF-8');
59 # mapping between data type and tag which specify
68 my $cache; # for cacheing
70 # lookup hash (tied to file)
72 # this option will cache all lookup entries in memory.
73 # if you are tight on memory, turn this off
74 my $use_lhash_cache = 1;
76 my $last_field_name; # cache to prevent repeated fields
84 my $add_xml = shift @_;
85 # needed to read values from configuration file
87 my $database = shift @_;
93 my $html = ""; # html formatted display output
95 my %field_usage; # counter for usage of each field
97 # sort subrouting using order="" attribute
99 my $va = $config->{indexer}->{$a}->{order} ||
100 $config->{indexer}->{$a};
101 my $vb = $config->{indexer}->{$b}->{order} ||
102 $config->{indexer}->{$b};
108 if ($cache->{tags_by_order}) {
109 @sorted_tags = @{$cache->{tags_by_order}};
111 @sorted_tags = sort by_order keys %{$config->{indexer}};
112 $cache->{tags_by_order} = \@sorted_tags;
118 # cache for field in pages
119 delete $cache->{display_data};
120 delete $cache->{swish_data};
121 delete $cache->{swish_exact_data};
122 delete $cache->{index_data};
123 delete $cache->{index_delimiter};
124 my @page_fields; # names of fields
127 # subs used to produce output
129 sub get_field_name($$$) {
130 my ($config,$field,$field_usage) = @_;
132 # find field name (signular, plural)
134 if ($config->{indexer}->{$field}->{name_singular} && $field_usage == 1) {
135 $field_name = $config->{indexer}->{$field}->{name_singular};
136 } elsif ($config->{indexer}->{$field}->{name_plural}) {
137 $field_name = $config->{indexer}->{$field}->{name_plural};
138 } elsif ($config->{indexer}->{$field}->{name}) {
139 $field_name = $config->{indexer}->{$field}->{name};
141 print STDERR "WARNING: field '$field' doesn't have 'name' attribute!";
144 if (! $last_field_name) {
145 $last_field_name = x($field_name);
146 return $last_field_name;
147 } elsif ($field_name ne $last_field_name) {
148 $last_field_name = x($field_name);
149 return $last_field_name;
155 # init variables for different types
156 sub init_visible_type($) {
159 # swish, swish_exact, display, index, index_lookup
160 # swish and display defaults
161 my ($s,$se,$d,$i,$il) = (1,0,1,0,0);
162 if (lc($type) eq "display") {
164 } elsif (lc($type) eq "swish") {
166 } elsif (lc($type) eq "index") {
167 ($s,$se,$d,$i) = (0,1,0,1);
168 } elsif (lc($type) eq "swish_exact") {
169 ($s,$se,$d,$i) = (0,1,0,0);
170 } elsif (lc($type) =~ /^lookup/) {
171 ($s,$se,$d,$i,$il) = (0,1,0,0,1);
173 return ($s,$se,$d,$i,$il);
180 # <delimiter>, </delimiter>
181 # <value>200a</value>
186 # <tag delimiter=", ">200a</tag>
188 # but without loosing spaces in delimiter (becasue
189 # new XML::Simple strips spaces in attribute values
190 # as defined in XML specification)
195 if (defined $x->{value}) {
196 my ($v,$d) = ($x->{value}->{content}, $x->{delimiter}->{content});
198 delete $x->{delimiter};
200 $x->{delimiter} = $d;
205 # begin real work: go field by field
206 foreach my $field (@sorted_tags) {
209 $field_usage{$field}++;
212 my $swish_exact_data = "";
213 my $display_data = "";
217 my ($swish,$display);
219 my $tag = $type2tag{$type} || die "can't find which tag to use for type $type";
221 # is this field page-by-page?
222 my $iterate_by_page = $config->{indexer}->{$field}->{iterate_by_page};
223 push @page_fields,$field if ($iterate_by_page);
225 # default line_delimiter if using
226 my $page_line_delimiter = $config->{indexer}->{$field}->{page_line_delimiter} || '<br/>';
227 $cache->{index_delimiter}->{$field} = $config->{indexer}->{$field}->{index_delimiter};
229 my $format_name = $config->{indexer}->{$field}->{format_name};
230 my $format_delimiter = $config->{indexer}->{$field}->{format_delimiter};
231 if ($format_name && $format_delimiter) {
232 $cache->{format}->{$field}->{format_name} = $format_name;
233 $cache->{format}->{$field}->{format_delimiter} = $format_delimiter;
236 foreach my $x (@{$config->{indexer}->{$field}->{$tag}}) {
240 my $format = x($x->{content});
241 my $delimiter = x($x->{delimiter}) || ' ';
243 my $repeat_off = 0; # init repeatable offset
245 my ($s,$se,$d,$i,$il) = init_visible_type($x->{type});
247 # what will separate last line from this one?
248 if ($display_data && $x->{append}) {
249 $line_delimiter = $delimiter;
250 } elsif ($display_data) {
251 $line_delimiter = '<br/>';
254 # init vars so that we go into while...
255 ($swish,$display) = (1,1);
257 # placeholder for all repeatable entries for index
260 my $x = shift || die "mkformat needs tag reference";
261 my $data = shift || return;
262 my $format_name = x($x->{format_name}) || return $data;
263 my $fmt = x($config->{format}->{$format_name}->{content}) || die "<format name=\"$format_name\"> is not defined!";
264 my $format_delimiter = x($x->{format_delimiter});
266 if ($format_delimiter) {
267 @data = split(/$format_delimiter/,$data);
273 my $nr = scalar $fmt =~ s/%s/%s/g;
274 if (($#data+1) == $nr) {
275 return sprintf($fmt,@data);
277 #print STDERR "mkformat: [$data] can't be split on [$format_delimiter] to $nr fields!\n";
281 print STDERR "usage of link '$format_name' without defined format (<link> tag)\n";
285 # while because of repeatable fields
286 while ($swish || $display) {
287 my $page = $repeat_off;
288 $page_max{$field} = $page if ($iterate_by_page && $page > ($page_max{$field} || 0));
289 ($swish,$display) = parse_format($type, $format,$row,$repeat_off++,$import2cp);
290 if ($repeat_off > 1000) {
291 print STDERR "loop (more than 1000 repeatable fields) deteced in $row, $format\n";
295 # is this field is lookup?
296 if ($display && $x->{lookup}) {
297 my $null = "<!-- null -->";
298 if ($use_lhash_cache) {
299 if (!defined($cache->{lhash}->{$display})) {
300 my $new_display = $lhash{$display};
301 if (defined($new_display)) {
302 #print STDERR "lookup cache store '$display' = '$new_display'\n";
303 $display = $new_display;
304 $cache->{lhash}->{$display} = $new_display;
306 # print STDERR "WARNING: lookup for '$display' didn't find anything.\n";
308 $cache->{lhash}->{$display} = $null;
311 $display = $cache->{lhash}->{$display};
314 $display = $lhash{$display} || $null;
318 # filter="name" ; filter this field through
320 my $filter = $x->{filter};
321 if ($filter && !$cache->{filter_loaded}->{$filter}) {
322 require "filter/".$filter.".pm";
323 $cache->{filter_loaded}->{$filter}++;
325 # type="swish" ; field for swish
328 if ($filter && ($s || $se)) {
330 $tmp = join(" ",&$filter($tmp)) if ($s || $se);
333 $swish_data .= $tmp if ($s && $tmp);
334 $swish_exact_data .= "xxbxx $tmp xxexx " if ($tmp && $tmp ne "" && $se);
337 # type="display" ; field for display
338 if ($d && $display) {
339 my $ldel = $delimiter;
340 if ($line_delimiter && $display_data) {
341 $ldel = $line_delimiter;
346 foreach my $tmp (&$filter($display)) {
347 my $tmp2 = mkformat($x,$tmp);
348 push @arr,$tmp2 if ($tmp2);
350 $display_data .= $ldel if ($display_data && @arr);
351 $display_data .= join($delimiter,@arr);
353 $display_data .= $ldel if ($display_data);
354 my $tmp = mkformat($x,$display);
355 $display_data .= $tmp if ($tmp);
359 # type="index" ; insert into index
361 if ($i && $display) {
362 $idisplay = $display;
365 $idisplay = &$filter($idisplay);
367 push @index_data, $idisplay if ($idisplay && !$iterate_by_page);
370 # store fields in lookup
371 if ($il && $display) {
372 if (lc($x->{type}) eq "lookup_key") {
374 print STDERR "WARNING: try to redefine lookup_key (keys shouldn't be repeatable fields!)";
378 $lookup_key = &$filter($display);
380 $lookup_key = $display;
383 } elsif (lc($x->{type}) eq "lookup_val") {
387 $lhash{$lookup_key} = &$filter($display);
389 $lhash{$lookup_key} = $display;
392 print STDERR "WARNING: no lookup_key defined for '$display'?";
398 # store data for page-by-page repeatable fields
399 if ($iterate_by_page) {
400 sub iterate_fld($$$$$$) {
401 my ($cache,$what,$field,$page,$data,$append) = @_;
404 my $ldel = $page_line_delimiter;
405 $ldel = " " if ($append);
406 #print STDERR "line delimiter: ",Dumper($ldel) if ($ldel);
407 if (! $cache->{$what}->{$field}->[$page]) {
408 $cache->{$what}->{$field}->[$page] = $data;
410 $cache->{$what}->{$field}->[$page] .= $ldel.$data;
415 iterate_fld($cache,'display_data',$field,$page,$display_data,$x->{append});
419 iterate_fld($cache,'swish_data',$field,$page,$swish_data,$x->{append});
422 if ($swish_exact_data) {
423 iterate_fld($cache,'swish_exact_data',$field,$page,$swish_exact_data,$x->{append});
424 $swish_exact_data = "";
428 my $ldel=$page_line_delimiter;
430 if ($cache->{index_data}->{$field}->[$page]) {
432 @index_data = @{$cache->{index_data}->{$field}->[$page]};
436 $index_data[$#index_data] .= $idisplay;
438 push @index_data, $idisplay;
441 push @index_data, $idisplay;
444 @{$cache->{index_data}->{$field}->[$page]} = @index_data;
449 if (! $iterate_by_page) {
450 my $idel = $x->{index_delimiter};
452 foreach my $tmp (@index_data) {
454 if ($idel && $tmp =~ m/$idel/) {
455 ($i,$d) = split(/$idel/,$tmp);
457 $index->insert($field, $i, $d, $path);
463 # now try to parse variables from configuration file
464 foreach my $x (@{$config->{indexer}->{$field}->{'config'}}) {
468 my $delimiter = x($x->{delimiter}) || ' ';
469 my $val = $cfg->val($database, x($x->{content}));
471 # FIXME index_lookup is not supported!
472 my ($s,$se,$d,$i,$il) = init_visible_type($x->{type});
475 $display_data .= $delimiter.$val if ($d);
476 $swish_data .= " ".$val if ($s);
477 $index->insert($field, $val, $path) if ($i);
480 if ($iterate_by_page) {
481 # FIXME data from config tag will appear just
485 $cache->{display_data}->{$field}->[$page] = $display_data;
489 $cache->{swish_data}->{$field}->[$page] = $swish_data;
492 if ($swish_exact_data) {
493 $cache->{swish_exact_data}->{$field}->[$page] = $swish_exact_data;
494 $swish_exact_data = "";
499 # save data page-by-page
500 foreach my $field (@page_fields) {
501 my $nr_pages = $page_max{$field} || next;
502 #print STDERR "field '$field' iterate over ",($nr_pages || 0)," pages...\n";
503 #print STDERR Dumper($cache->{display_data});
504 for (my $page=0; $page <= $nr_pages; $page++) {
506 if ($cache->{format}->{$field}) {
507 my $tmp = mkformat($cache->{format}->{$field},$cache->{display_data}->{$field}->[$page]);
508 $display_data=$tmp if ($tmp);
510 $display_data = $cache->{display_data}->{$field}->[$page];
512 if ($display_data) { # default
513 if ($field eq "headline") {
514 $xml .= xmlify("headline", $display_data);
517 # fallback to empty field name if needed
518 $html .= get_field_name($config,$field,$field_usage{$field}) || '';
519 $html .= "#-#".$display_data."###\n";
523 my $swish_data = $cache->{swish_data}->{$field}->[$page];
525 # remove extra spaces
526 $swish_data =~ s/ +/ /g;
527 $swish_data =~ s/ +$//g;
529 $xml .= xmlify($field."_swish", unac_string($codepage,$swish_data));
532 my $swish_exact_data = $cache->{swish_exact_data}->{$field}->[$page];
533 if ($swish_exact_data) {
534 $swish_exact_data =~ s/ +/ /g;
535 $swish_exact_data =~ s/ +$//g;
537 # add delimiters before and after word.
538 # That is required to produce exact match
539 $xml .= xmlify($field."_swish_exact", unac_string($codepage,$swish_exact_data));
542 my $idel = $cache->{index_delimiter}->{$field};
543 foreach my $tmp (@{$cache->{index_data}->{$field}->[$page]}) {
546 if ($idel && $tmp =~ m/$idel/) {
547 ($i,$d) = split(/$idel/,$tmp);
549 $index->insert($field, $i, $d, $path);
550 #print STDERR "index [$idel] $field: $i --> $d [$path]\n";
556 if (! $iterate_by_page) {
558 if ($field eq "headline") {
559 $xml .= xmlify("headline", $display_data);
562 # fallback to empty field name if needed
563 $html .= get_field_name($config,$field,$field_usage{$field}) || '';
564 $html .= "#-#".$display_data."###\n";
568 # remove extra spaces
569 $swish_data =~ s/ +/ /g;
570 $swish_data =~ s/ +$//g;
572 $xml .= xmlify($field."_swish", unac_string($codepage,$swish_data));
575 if ($swish_exact_data) {
576 $swish_exact_data =~ s/ +/ /g;
577 $swish_exact_data =~ s/ +$//g;
579 # add delimiters before and after word.
580 # That is required to produce exact match
581 $xml .= xmlify($field."_swish_exact", unac_string($codepage,$swish_exact_data));
586 # dump formatted output in <html>
588 #$xml .= xmlify("html",$html);
589 $xml .= "<html><![CDATA[ $html ]]></html>";
593 $xml .= $add_xml if ($add_xml);
594 return "<xml>\n$xml</xml>\n";
600 ##########################################################################
602 # read configuration for this script
603 my $cfg = new Config::IniFiles( -file => $config_file );
605 # read global.conf configuration
606 my $cfg_global = new Config::IniFiles( -file => 'global.conf' );
609 $index = new index_DBI(
610 $cfg_global->val('global', 'dbi_dbd'),
611 $cfg_global->val('global', 'dbi_dsn'),
612 $cfg_global->val('global', 'dbi_user'),
613 $cfg_global->val('global', 'dbi_passwd') || '',
616 my $show_progress = $cfg_global->val('global', 'show_progress');
618 my $unac_filter = $cfg_global->val('global', 'unac_filter');
620 require $unac_filter;
623 foreach my $database ($cfg->Sections) {
625 my $type = lc($cfg -> val($database, 'type')) || die "$database doesn't have 'type' defined";
626 my $add_xml = $cfg -> val($database, 'xml'); # optional
628 # create new lookup file
629 my $lookup_file = $cfg -> val($database, 'lookup_newfile'); # optional
631 #tie %lhash, 'GDBM_File', $lookup_file, &GDBM_NEWDB, 0644;
632 tie %lhash, 'TDB_File', $lookup_file, TDB_CLEAR_IF_FIRST, O_RDWR, 0644;
633 print STDERR "creating lookup file '$lookup_file'\n";
634 # delete memory cache for lookup file
635 delete $cache->{lhash};
638 # open existing lookup file
639 $lookup_file = $cfg -> val($database, 'lookup_open'); # optional
641 #tie %lhash, 'GDBM_File', $lookup_file, &GDBM_READER, 0644;
642 tie %lhash, 'TDB_File', $lookup_file, TDB_DEFAULT, O_RDWR, 0644;
643 print STDERR "opening lookup file '$lookup_file'\n";
646 print STDERR "reading ./import_xml/$type.xml\n";
648 # extract just type basic
649 my $type_base = $type;
650 $type_base =~ s/_.+$//g;
652 $config=XMLin("./import_xml/$type.xml", ForceArray => [ $type2tag{$type_base}, 'config', 'format' ], ForceContent => 1 );
654 # output current progress indicator
657 return if (! $show_progress);
659 my $total = shift || 1;
660 my $p = int($current * 100 / $total);
662 printf STDERR ("%5d / %5d [%-51s] %-2d %% \r",$current,$total,"=" x ($p/2).">", $p );
669 return if (! $show_progress);
670 my $current = shift @_;
672 my @ind = ('-','\\','|','/','-','\\','|','/', '-');
674 $last_p += $fake_dir;
675 $fake_dir = -$fake_dir if ($last_p > 1000 || $last_p < 0);
676 if ($last_p % 10 == 0) {
677 printf STDERR ("%5d / %5s [%-51s]\r",$current,"?"," " x ($last_p/20).$ind[($last_p/20) % $#ind]);
682 print STDERR "using: $type...\n";
684 # erase cache for tags by order in this database
685 delete $cache->{tags_by_order};
687 if ($type_base eq "isis") {
689 my $isis_db = $cfg -> val($database, 'isis_db') || die "$database doesn't have 'isis_db' defined!";
691 $import2cp = Text::Iconv->new($config->{isis_codepage},$codepage);
692 my $db = OpenIsis::open( $isis_db );
694 # check if .txt database for OpenIsis is zero length,
695 # if so, erase it and re-open database
697 my $isis_db = shift || die "need isis database name";
700 if (-e $isis_db.".TXT") {
701 print STDERR "WARNING: removing $isis_db.TXT OpenIsis database...\n";
702 unlink $isis_db.".TXT" || warn "FATAL: unlink error on '$isis_db.TXT': $!";
705 if (-e $isis_db.".PTR") {
706 print STDERR "WARNING: removing $isis_db.PTR OpenIsis database...\n";
707 unlink $isis_db.".PTR" || warn "FATAL: unlink error on '$isis_db.PTR': $!";
710 return OpenIsis::open( $isis_db ) if ($reopen);
715 $db = check_txt_db($isis_db);
717 print STDERR "FATAL: OpenIsis can't open zero size file $isis_db\n";
724 print STDERR "FATAL: OpenIsis can't find file $isis_db\n";
727 } elsif ($db == -5) {
728 print STDERR "FATAL: OpenIsis can't access file $isis_db\n";
731 print STDERR "FATAL: OpenIsis unknown error $db with file $isis_db\n";
735 my $max_rowid = OpenIsis::maxRowid( $db );
737 # if 0 records, try to rease isis .txt database
738 if ($max_rowid == 0) {
739 # force removal of database
740 $db = check_txt_db($isis_db);
741 $max_rowid = OpenIsis::maxRowid( $db );
744 print STDERR "Reading database: $isis_db [$max_rowid rows]\n";
746 my $path = $database;
748 for (my $row_id = 1; $row_id <= $max_rowid; $row_id++ ) {
749 my $row = OpenIsis::read( $db, $row_id );
750 if ($row && $row->{mfn}) {
752 progress($row->{mfn}, $max_rowid);
754 my $swishpath = $path."#".int($row->{mfn});
756 if (my $xml = data2xml($type_base,$row,$add_xml,$cfg,$database)) {
757 $xml = $cp2utf->convert($xml);
758 use bytes; # as opposed to chars
759 print "Path-Name: $swishpath\n";
760 print "Content-Length: ".(length($xml)+1)."\n";
761 print "Document-Type: XML\n\n$xml\n";
765 # for this to work with current version of OpenIsis (0.9.0)
766 # you might need my patch from
767 # http://www.rot13.org/~dpavlin/projects/openisis-0.9.0-perl_close.diff
768 OpenIsis::close($db);
771 } elsif ($type_base eq "excel") {
772 require Spreadsheet::ParseExcel;
773 require Spreadsheet::ParseExcel::Utility;
774 import Spreadsheet::ParseExcel::Utility qw(int2col);
776 $import2cp = Text::Iconv->new($config->{excel_codepage},$codepage);
777 my $excel_file = $cfg -> val($database, 'excel_file') || die "$database doesn't have 'excel_file' defined!";
779 my $sheet = x($config->{sheet}) || die "no sheet in $type.xml";
780 my $start_row = x($config->{start_row}) - 1 || die "no start_row in $type.xml";
782 my $oBook = Spreadsheet::ParseExcel::Workbook->Parse($excel_file) || die "can't open Excel file '$excel_file'";
785 foreach my $oWks (@{$oBook->{Worksheet}}) {
786 #print STDERR "-- SHEET $sheet_nr:", $oWks->{Name}, "\n";
787 last if ($oWks->{Name} eq $sheet);
791 my $oWorksheet = $oBook->{Worksheet}[$sheet_nr];
793 print STDERR "using sheet: ",$oWorksheet->{Name},"\n";
794 defined ($oWorksheet) || die "can't find sheet '$sheet' in $excel_file";
795 my $end_row = x($config->{end_row}) || $oWorksheet->{MaxRow};
797 for(my $iR = $start_row ; defined $end_row && $iR <= $end_row ; $iR++) {
799 for(my $iC = $oWorksheet->{MinCol} ; defined $oWorksheet->{MaxCol} && $iC <= $oWorksheet->{MaxCol} ; $iC++) {
800 my $cell = $oWorksheet->{Cells}[$iR][$iC];
802 $row->{int2col($iC)} = $cell->Value;
806 progress($iR, $end_row);
808 # print "row[$iR/$end_row] ";
809 # foreach (keys %{$row}) {
810 # print "$_: ",$row->{$_},"\t";
814 my $swishpath = $database."#".$iR;
818 if (my $xml = data2xml($type_base,$row,$add_xml,$cfg,$database)) {
819 $xml = $cp2utf->convert($xml);
820 use bytes; # as opposed to chars
821 print "Path-Name: $swishpath\n";
822 print "Content-Length: ".(length($xml)+1)."\n";
823 print "Document-Type: XML\n\n$xml\n";
826 } elsif ($type_base eq "marc") {
830 $import2cp = Text::Iconv->new($config->{marc_codepage},$codepage);
831 my $marc_file = $cfg -> val($database, 'marc_file') || die "$database doesn't have 'marc_file' defined!";
833 # optional argument is format
834 my $format = x($config->{marc_format}) || 'usmarc';
836 print STDERR "Reading MARC file '$marc_file'\n";
839 my $nr = $marc->openmarc({
840 file=>$marc_file, format=>$format
841 }) || die "Can't open MARC file '$marc_file' with format '$format'";
843 # read MARC file in memory
846 my $max_rec = $marc->marc_count();
848 for(my $i=1; $i<=$max_rec; $i++) {
850 progress($i,$max_rec);
852 # store value for marc_sf.pm
853 $main::cache->{marc_record} = $i;
855 my $swishpath = $database."#".$i;
857 if (my $xml = data2xml($type_base,$marc,$add_xml,$cfg,$database)) {
858 $xml = $cp2utf->convert($xml);
859 use bytes; # as opposed to chars
860 print "Path-Name: $swishpath\n";
861 print "Content-Length: ".(length($xml)+1)."\n";
862 print "Document-Type: XML\n\n$xml\n";
868 } elsif ($type_base eq "feed") {
870 $import2cp = Text::Iconv->new($config->{feed_codepage},$codepage);
871 my $prog = x($config->{prog}) || die "$database doesn't have 'prog' defined!";
873 print STDERR "Reading feed from program '$prog'\n";
875 open(FEED,"feeds/$prog |") || die "can't start $prog: $!";
877 my $i=1; # record nr.
886 my $swishpath = $database."#".$i++;
888 if (my $xml = data2xml($type_base,$data,$add_xml,$cfg,$database)) {
889 $xml = $cp2utf->convert($xml);
890 use bytes; # as opposed to chars
891 print "Path-Name: $swishpath\n";
892 print "Content-Length: ".(length($xml)+1)."\n";
893 print "Document-Type: XML\n\n$xml\n";
900 $line = $1 if (s/^(\d+):\s*//);
901 $data->{$line++} = $_;
907 untie %lhash if (%lhash);
911 # call this to commit index
916 ##########################################################################
920 all2xml.pl - read various file formats and dump XML for SWISH-E
924 $ all2xml.pl [test.conf]
928 This command will read ISIS data file using OpenIsis perl module, MARC
929 records using MARC module and optionally Micro$oft Excel files to
930 create one XML file for usage with I<SWISH-E> indexer. Dispite it's name,
931 this script B<isn't general xml generator> from isis files (isis allready
932 has something like that). Output of this script is tailor-made for SWISH-E.
934 If no configuration file is specified, it will use default one called
939 Documentation is really lacking. However, in true Open Source spirit, source
940 is best documentation. I even made considerable effort to comment parts
941 which are not intuitively clear, so...
945 Dobrica Pavlinusic <dpavlin@rot13.org>
949 GNU Public License (GPL) v2 or later
953 SWISH-E web site at http://www.swish-e.org