From ed5f5c823cbffa3d2e3d1e730bf32856001dcdb8 Mon Sep 17 00:00:00 2001 From: imiyazaki Date: Thu, 2 Sep 2004 13:48:19 +0000 Subject: [PATCH] store IDS data as text file instead of perl script. use new CHISE DB structure. --- Chise_utils/Chise_utils.pm | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/Chise_utils/Chise_utils.pm b/Chise_utils/Chise_utils.pm index 00d241a..a044631 100644 --- a/Chise_utils/Chise_utils.pm +++ b/Chise_utils/Chise_utils.pm @@ -49,11 +49,30 @@ our $VERSION = '0.02'; # Preloaded methods go here. -$omegadb_path="/usr/local/lib/chise/omega"; +$omegadb_path=""; +unless($omegadb_path){ + if(-w '/usr/local/share/chise/omega'){ + $omegadb_path='/usr/local/share/chise/omega'; + }elsif(-w '/usr/share/chise/omega'){ + $omegadb_path='/usr/share/chise/omega'; + }elsif(-w '/sw/share/chise/omega'){ + $omegadb_path='/sw/share/chise/omega'; + }elsif(-w '/usr/local/lib/chise/omega'){ + $omegadb_path='/usr/local/lib/chise/omega'; + }else{ + $omegadb_path="."; + } +} my $DB_HOME=""; unless($DB_HOME){ - if(-e '/usr/local/lib/chise/chise-db'){ + if(-e '/usr/local/share/chise/0.3/db'){ + $DB_HOME='/usr/local/share/chise/0.3/db'; + }elsif(-e '/usr/share/chise/0.3/db'){ + $DB_HOME='/usr/share/chise/0.3/db'; + }elsif(-e '/sw/share/chise/0.3/db'){ + $DB_HOME='/sw/share/chise/0.3/db'; + }elsif(-e '/usr/local/lib/chise/chise-db'){ $DB_HOME='/usr/local/lib/chise/chise-db'; }elsif(-e '/usr/lib/chise/chise-db'){ $DB_HOME='/usr/lib/chise/chise-db'; @@ -191,6 +210,7 @@ sub get_chars_containing{ unless($db_opened{$atr}){ &get_db($atr) or return (); } + utf8::encode($value); foreach $char (keys %{$chardb{$atr}}){ if($chardb{$atr}->{$char}=~/$value/){ utf8::decode($char); @@ -208,6 +228,7 @@ sub get_chars_matching{ unless($rdb_opened{$atr}){ &get_reverse_db($atr) or return (); } + utf8::encode($value); if($char=$reverse_chardb{$atr}->{$value}){ utf8::decode($char); $char=~s/^\?//; -- 1.7.10.4