Changeset 116
- Timestamp:
- 14.12.2006 00:02:39 (2 years ago)
- Files:
-
- trunk/devel/FuzzyOcr/Config.pm (modified) (4 diffs)
- trunk/devel/FuzzyOcr/Hashing.pm (modified) (3 diffs)
- trunk/devel/patchset2.patch (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/devel/FuzzyOcr/Config.pm
r112 r116 37 37 use constant HAS_DBI => eval { require DBI; }; 38 38 use constant HAS_DBD_MYSQL => eval { require DBD::mysql; }; 39 use constant HAS_MLDBM => eval { require MLDBM; require MLDBM::Sync; };39 use constant HAS_MLDBM => eval { require MLDBM; require MLDBM::Sync;}; 40 40 use constant HAS_DB_FILE => eval { require DB_File; }; 41 41 use constant HAS_STORABLE => eval { require Storable; }; … … 162 162 return undef unless (HAS_DBI and HAS_DBD_MYSQL); 163 163 164 use DBI;165 164 my $conf = get_config(); 166 165 my %dopts = ( AutoCommit => 1 ); … … 652 651 unless ($conf->{focr_skip_updates}) { 653 652 if ($conf->{focr_enable_image_hashing} == 2 and -r $conf->{focr_digest_db}) { 654 use MLDBM qw(DB_File Storable); 655 use MLDBM::Sync; 653 import MLDBM qw(DB_File Storable); 656 654 my %DB; my $dbm; my $sdbm; my $err = 0; 657 655 my $now = time - ($conf->{focr_db_max_days}*86400); … … 720 718 } 721 719 if ($conf->{focr_enable_image_hashing} == 3 and defined (my $ddb = get_mysql_ddb())) { 722 use DBI; 723 use MLDBM qw(DB_File Storable); 724 use MLDBM::Sync; 720 import MLDBM qw(DB_File Storable); 725 721 my $db = $conf->{focr_mysql_db}; 726 722 my $tab = $conf->{focr_mysql_hash}; trunk/devel/FuzzyOcr/Hashing.pm
r115 r116 141 141 } 142 142 elsif ($conf->{focr_enable_image_hashing} == 2) { 143 use MLDBM qw(DB_File Storable); 144 use MLDBM::Sync; 143 import MLDBM qw(DB_File Storable); 145 144 my %DB = (); my $dbm; my $sdbm; 146 145 $sdbm = tie %DB, 'MLDBM::Sync', $dbfile, O_CREAT|O_RDWR or $ret++; … … 186 185 infolog("Found Score <$ret> for $txt Image Hash"); 187 186 } 188 infolog("Matched [$dbm->{match}] time(s). Prev match: ".fmt_time( $dbm->{check}));187 infolog("Matched [$dbm->{match}] time(s). Prev match: ".fmt_time(time - $dbm->{check})); 189 188 $dbm->{check} = time; 190 189 $DB{$key} = $dbm; … … 283 282 } 284 283 elsif ($conf->{focr_enable_image_hashing} == 2) { 285 use MLDBM qw(DB_File Storable); 286 use MLDBM::Sync; 284 import MLDBM qw(DB_File Storable); 287 285 my $dbfile = $_[2] || $conf->{focr_db_hash}; 288 286 my %DB = (); my $sdbm; 289 $sdbm = tie %DB, 'MLDBM::Sync', $dbfile or $ret++;287 $sdbm = tie %DB, 'MLDBM::Sync', $dbfile, O_CREAT|O_RDWR or $ret++; 290 288 if ($ret>0) { 291 289 warnlog("Unable to open/create Image Hash database at \"$dbfile\", check permissions.");
