6 use File::Temp qw/tempdir/;
11 use WebPAC::Input::ISIS;
13 use WebPAC::Normalize::XML;
14 use WebPAC::Output::TT;
15 use WebPAC::Output::Estraier;
16 use YAML qw/LoadFile/;
18 my $limit = shift @ARGV;
20 my $config = LoadFile('conf/config.yml');
22 print "config = ",Dumper($config);
24 my $type = lc($config->{input}->{type});
26 die "I know only how to handle input type isis, not '$type'!\n" unless ($type eq 'isis');
28 my $abs_path = abs_path($0);
29 $abs_path =~ s#/[^/]*$#/#;
31 my $lookup = new WebPAC::Lookup(
32 lookup_file => $config->{input}->{lookup},
37 my $isis = new WebPAC::Input::ISIS(
38 code_page => $config->{webpac}->{webpac_encoding},
39 limit_mfn => $config->{input}->{limit},
42 my $maxmfn = $isis->open(
43 filename => $config->{input}->{path},
44 code_page => $config->{input}->{encoding}, # database encoding
49 my $db = new WebPAC::DB(
50 path => $config->{webpac}->{db_path},
53 my $n = new WebPAC::Normalize::XML(
54 # filter => { 'foo' => sub { shift } },
56 lookup_regex => $lookup->regex,
61 tag => $config->{normalize}->{tag},
62 xml_file => $config->{normalize}->{path},
65 my $out = new WebPAC::Output::TT(
66 include_path => $config->{webpac}->{template_path},
67 filters => { foo => sub { shift } },
70 my $est = new WebPAC::Output::Estraier(
71 %{ $config->{hyperestraier} }
76 for ( 0 ... $isis->size ) {
78 my $row = $isis->fetch || next;
80 my $mfn = $row->{'000'}->[0] || die "can't find MFN";
82 my $ds = $n->data_structure($row);
84 # print STDERR Dumper($row, $ds);
86 # my $html = $out->apply(
87 # template => 'html_ffzg.tt',
91 # # create test output
93 # my $file = sprintf('out/%02d.html', $mfn );
94 # open(my $fh, '>', $file) or die "can't open $file: $!";
98 # $html =~ s#\s*[\n\r]+\s*##gs;
100 # print STDERR $html;
105 type => $config->{hyperestraier}->{type},
112 my $log = $lookup->_get_logger;
114 $log->info("$total_rows records indexed");