r11779@llin: dpavlin | 2005-12-19 04:07:22 +0100
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 18 Dec 2005 21:06:51 +0000 (21:06 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 18 Dec 2005 21:06:51 +0000 (21:06 +0000)
 and fixes to make it work

git-svn-id: svn+ssh://mjesec/home/dpavlin/svn/webpac2/trunk@287 07558da8-63fa-0310-ba24-9fe276d99e06

lib/WebPAC/Input.pm
run.pl

index a962e1a..2f42943 100644 (file)
@@ -217,7 +217,7 @@ sub open {
        $log->info("processing $self->{size} records in $code_page, convert to $self->{code_page}");
 
        # read database
-       for (my $pos = $offset; $pos <= $limit; $mfn++) {
+       for (my $pos = $offset; $pos <= $limit; $pos++) {
 
                $log->debug("position: $pos\n");
 
diff --git a/run.pl b/run.pl
index 8be3dac..6306997 100755 (executable)
--- a/run.pl
+++ b/run.pl
@@ -9,7 +9,7 @@ use lib './lib';
 
 use WebPAC::Common 0.02;
 use WebPAC::Lookup;
-use WebPAC::Input::ISIS 0.02;
+use WebPAC::Input 0.03;
 use WebPAC::Store 0.03;
 use WebPAC::Normalize::XML;
 use WebPAC::Output::TT;
@@ -90,20 +90,15 @@ while (my ($database, $db_config) = each %{ $config->{databases} }) {
 
                $log->info("working on input $input->{path} [$input->{type}] using $input_module");
 
-               sub new_input {
-                       my $name = shift;
-                       my $args = shift;
-                       new $name->($args);
-               }
-
-               my $input = new_input($input_module,{
+               my $input_db = new WebPAC::Input(
+                       module => $input_module,
                        code_page => $config->{webpac}->{webpac_encoding},
                        limit_mfn => $input->{limit},
                        lookup => $lookup,
-               });
+               );
                $log->logdie("can't create input using $input_module") unless ($input);
 
-               my $maxmfn = $input->open(
+               my $maxmfn = $input_db->open(
                        path => $input->{path},
                        code_page => $input->{encoding},        # database encoding
                );
@@ -130,9 +125,9 @@ while (my ($database, $db_config) = each %{ $config->{databases} }) {
                        );
                }
 
-               for ( 0 ... $input->size ) {
+               for ( 0 ... $input_db->size ) {
 
-                       my $row = $input->fetch || next;
+                       my $row = $input_db->fetch || next;
 
                        my $mfn = $row->{'000'}->[0] || die "can't find MFN";