/[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

Diff of /trunk/run.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 127 by dpavlin, Thu Nov 24 11:47:29 2005 UTC revision 141 by dpavlin, Fri Nov 25 00:22:58 2005 UTC
# Line 13  use WebPAC::DB 0.02; Line 13  use WebPAC::DB 0.02;
13  use WebPAC::Normalize::XML;  use WebPAC::Normalize::XML;
14  use WebPAC::Output::TT;  use WebPAC::Output::TT;
15  use WebPAC::Output::Estraier;  use WebPAC::Output::Estraier;
16    use YAML qw/LoadFile/;
17    
18  my $limit = shift @ARGV;  my $limit = shift @ARGV;
19    
20    my $config = LoadFile('conf/config.yml');
21    
22    print "config = ",Dumper($config);
23    
24    my $type = lc($config->{input}->{type});
25    
26    die "I know only how to handle input type isis, not '$type'!\n" unless ($type eq 'isis');
27    
28  my $abs_path = abs_path($0);  my $abs_path = abs_path($0);
29  $abs_path =~ s#/[^/]*$#/#;  $abs_path =~ s#/[^/]*$#/#;
30    
 my $isis_file = '/data/isis_data/ps/LIBRI/LIBRI';  
   
31  my $lookup = new WebPAC::Lookup(  my $lookup = new WebPAC::Lookup(
32          lookup_file => "$abs_path/conf/lookup/isis.pm",          lookup_file => $config->{input}->{lookup},
33  );  );
34    
35    
36    
37  my $isis = new WebPAC::Input::ISIS(  my $isis = new WebPAC::Input::ISIS(
38          code_page => 'ISO-8859-2',      # application encoding          code_page => $config->{webpac}->{webpac_encoding},
39          limit_mfn => $limit,          limit_mfn => $config->{input}->{limit},
40  );  );
41    
42  my $maxmfn = $isis->open(  my $maxmfn = $isis->open(
43          filename => $isis_file,          filename => $config->{input}->{path},
44          code_page => '852',             # database encoding          code_page => $config->{input}->{encoding},      # database encoding
45  );  );
46    
47  my $path = './db/';  my $path = './db/';
48    
49  my $db = new WebPAC::DB(  my $db = new WebPAC::DB(
50          path => $path,          path => $config->{webpac}->{db_path},
51  );  );
52    
53  my $n = new WebPAC::Normalize::XML(  my $n = new WebPAC::Normalize::XML(
# Line 49  my $n = new WebPAC::Normalize::XML( Line 58  my $n = new WebPAC::Normalize::XML(
58  );  );
59    
60  $n->open(  $n->open(
61          tag => 'isis',          tag => $config->{normalize}->{tag},
62          xml_file => "$abs_path/conf/normalize/isis_ffzg.xml",          xml_file => $config->{normalize}->{path},
63  );  );
64    
65  my $out = new WebPAC::Output::TT(  my $out = new WebPAC::Output::TT(
66          include_path => "$abs_path/conf/output/tt",          include_path => $config->{webpac}->{template_path},
67          filters => { foo => sub { shift } },          filters => { foo => sub { shift } },
68  );  );
69    
70  my $est = new WebPAC::Output::Estraier(  my $est = new WebPAC::Output::Estraier(
71          url => 'http://localhost:1978/node/webpac2',          %{ $config->{hyperestraier} }
         user => 'admin',  
         passwd => 'admin',  
         database => 'ps',  
72  );  );
73    
74  my $total_rows = 0;  my $total_rows = 0;
# Line 96  for ( 0 ... $isis->size ) { Line 102  for ( 0 ... $isis->size ) {
102          $est->add(          $est->add(
103                  id => $mfn,                  id => $mfn,
104                  ds => $ds,                  ds => $ds,
105                  type => 'search',                  type => $config->{hyperestraier}->{type},
106          );          );
107    
108          $total_rows++;          $total_rows++;

Legend:
Removed from v.127  
changed lines
  Added in v.141

  ViewVC Help
Powered by ViewVC 1.1.26