Changeset 116

Show
Ignore:
Timestamp:
14.12.2006 00:02:39 (2 years ago)
Author:
decoder
Message:

Remove redundant use() calls, fixing ticket #21
Added O_CREAT to another tie call
Fixed "Prev Match" time output
Added patchset2 to SVN

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/devel/FuzzyOcr/Config.pm

    r112 r116  
    3737use constant HAS_DBI => eval { require DBI; }; 
    3838use constant HAS_DBD_MYSQL => eval { require DBD::mysql; }; 
    39 use constant HAS_MLDBM => eval { require MLDBM; require MLDBM::Sync; }; 
     39use constant HAS_MLDBM => eval { require MLDBM; require MLDBM::Sync;}; 
    4040use constant HAS_DB_FILE => eval { require DB_File; }; 
    4141use constant HAS_STORABLE => eval { require Storable; }; 
     
    162162    return undef unless (HAS_DBI and HAS_DBD_MYSQL); 
    163163 
    164     use DBI; 
    165164    my $conf = get_config(); 
    166165    my %dopts = ( AutoCommit => 1 ); 
     
    652651    unless ($conf->{focr_skip_updates}) { 
    653652        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); 
    656654            my %DB; my $dbm; my $sdbm; my $err = 0; 
    657655            my $now = time - ($conf->{focr_db_max_days}*86400); 
     
    720718        } 
    721719        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); 
    725721            my $db   = $conf->{focr_mysql_db}; 
    726722            my $tab  = $conf->{focr_mysql_hash}; 
  • trunk/devel/FuzzyOcr/Hashing.pm

    r115 r116  
    141141    } 
    142142    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); 
    145144        my %DB = (); my $dbm; my $sdbm; 
    146145        $sdbm = tie %DB, 'MLDBM::Sync', $dbfile, O_CREAT|O_RDWR or $ret++; 
     
    186185                infolog("Found Score <$ret> for $txt Image Hash"); 
    187186            } 
    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})); 
    189188            $dbm->{check} = time; 
    190189            $DB{$key} = $dbm; 
     
    283282    } 
    284283    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); 
    287285        my $dbfile = $_[2] || $conf->{focr_db_hash}; 
    288286        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++; 
    290288        if ($ret>0) { 
    291289            warnlog("Unable to open/create Image Hash database at \"$dbfile\", check permissions.");