/[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 74 by dpavlin, Sun Nov 20 20:13:39 2005 UTC revision 127 by dpavlin, Thu Nov 24 11:47:29 2005 UTC
# Line 9  use lib './lib'; Line 9  use lib './lib';
9    
10  use WebPAC::Lookup;  use WebPAC::Lookup;
11  use WebPAC::Input::ISIS;  use WebPAC::Input::ISIS;
12  use WebPAC::DB;  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    
17    my $limit = shift @ARGV;
18    
19  my $abs_path = abs_path($0);  my $abs_path = abs_path($0);
20  $abs_path =~ s#/[^/]*$#/#;  $abs_path =~ s#/[^/]*$#/#;
21    
# Line 25  my $lookup = new WebPAC::Lookup( Line 27  my $lookup = new WebPAC::Lookup(
27    
28  my $isis = new WebPAC::Input::ISIS(  my $isis = new WebPAC::Input::ISIS(
29          code_page => 'ISO-8859-2',      # application encoding          code_page => 'ISO-8859-2',      # application encoding
30          limit_mfn => 50,          limit_mfn => $limit,
31  );  );
32    
33  my $maxmfn = $isis->open(  my $maxmfn = $isis->open(
# Line 63  my $est = new WebPAC::Output::Estraier( Line 65  my $est = new WebPAC::Output::Estraier(
65          database => 'ps',          database => 'ps',
66  );  );
67    
68  while (my $row = $isis->fetch) {  my $total_rows = 0;
69    
70    for ( 0 ... $isis->size ) {
71    
72            my $row = $isis->fetch || next;
73    
74          my $mfn = $row->{'000'}->[0] || die "can't find MFN";          my $mfn = $row->{'000'}->[0] || die "can't find MFN";
75    
# Line 71  while (my $row = $isis->fetch) { Line 77  while (my $row = $isis->fetch) {
77    
78  #       print STDERR Dumper($row, $ds);  #       print STDERR Dumper($row, $ds);
79    
80          my $html = $out->apply(  #       my $html = $out->apply(
81                  template => 'html_ffzg.tt',  #               template => 'html_ffzg.tt',
82                  data => $ds,  #               data => $ds,
83          );  #       );
84    #
85          # create test output  #       # create test output
86    #
87          my $file = sprintf('out/%02d.html', $mfn );  #       my $file = sprintf('out/%02d.html', $mfn );
88          open(my $fh, '>', $file) or die "can't open $file: $!";  #       open(my $fh, '>', $file) or die "can't open $file: $!";
89          print $fh $html;  #       print $fh $html;
90          close($fh);  #       close($fh);
91    #
92          $html =~ s#\s*[\n\r]+\s*##gs;  #       $html =~ s#\s*[\n\r]+\s*##gs;
93    #
94  #       print STDERR $html;  #       print STDERR $html;
95    
96          $est->add(          $est->add(
# Line 93  while (my $row = $isis->fetch) { Line 99  while (my $row = $isis->fetch) {
99                  type => 'search',                  type => 'search',
100          );          );
101    
102            $total_rows++;
103    
104  };  };
105    
106    my $log = $lookup->_get_logger;
107    
108    $log->info("$total_rows records indexed");

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

  ViewVC Help
Powered by ViewVC 1.1.26