/[webpac2]/trunk/run.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/run.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 76 - (hide annotations)
Sun Nov 20 20:32:46 2005 UTC (18 years, 5 months ago) by dpavlin
File MIME type: text/plain
File size: 1773 byte(s)
 r8992@llin:  dpavlin | 2005-11-20 21:33:56 +0100
 minor tweaks

1 dpavlin 74 #!/usr/bin/perl -w
2    
3     use strict;
4    
5     use Cwd qw/abs_path/;
6     use File::Temp qw/tempdir/;
7     use Data::Dumper;
8     use lib './lib';
9    
10     use WebPAC::Lookup;
11     use WebPAC::Input::ISIS;
12     use WebPAC::DB;
13     use WebPAC::Normalize::XML;
14     use WebPAC::Output::TT;
15     use WebPAC::Output::Estraier;
16    
17 dpavlin 76 my $limit = shift @ARGV;
18    
19 dpavlin 74 my $abs_path = abs_path($0);
20     $abs_path =~ s#/[^/]*$#/#;
21    
22     my $isis_file = '/data/isis_data/ps/LIBRI/LIBRI';
23    
24     my $lookup = new WebPAC::Lookup(
25     lookup_file => "$abs_path/conf/lookup/isis.pm",
26     );
27    
28     my $isis = new WebPAC::Input::ISIS(
29     code_page => 'ISO-8859-2', # application encoding
30 dpavlin 76 limit_mfn => $limit,
31 dpavlin 74 );
32    
33     my $maxmfn = $isis->open(
34     filename => $isis_file,
35     code_page => '852', # database encoding
36     );
37    
38     my $path = './db/';
39    
40     my $db = new WebPAC::DB(
41     path => $path,
42     );
43    
44     my $n = new WebPAC::Normalize::XML(
45     # filter => { 'foo' => sub { shift } },
46     db => $db,
47     lookup_regex => $lookup->regex,
48     lookup => $lookup,
49     );
50    
51     $n->open(
52     tag => 'isis',
53     xml_file => "$abs_path/conf/normalize/isis_ffzg.xml",
54     );
55    
56     my $out = new WebPAC::Output::TT(
57     include_path => "$abs_path/conf/output/tt",
58     filters => { foo => sub { shift } },
59     );
60    
61     my $est = new WebPAC::Output::Estraier(
62     url => 'http://localhost:1978/node/webpac2',
63     user => 'admin',
64     passwd => 'admin',
65     database => 'ps',
66     );
67    
68     while (my $row = $isis->fetch) {
69    
70     my $mfn = $row->{'000'}->[0] || die "can't find MFN";
71    
72     my $ds = $n->data_structure($row);
73    
74     # print STDERR Dumper($row, $ds);
75    
76     my $html = $out->apply(
77     template => 'html_ffzg.tt',
78     data => $ds,
79     );
80    
81     # create test output
82    
83     my $file = sprintf('out/%02d.html', $mfn );
84     open(my $fh, '>', $file) or die "can't open $file: $!";
85     print $fh $html;
86     close($fh);
87    
88     $html =~ s#\s*[\n\r]+\s*##gs;
89    
90     # print STDERR $html;
91    
92     $est->add(
93     id => $mfn,
94     ds => $ds,
95     type => 'search',
96     );
97    
98     };

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26