From: imiyazaki Date: Mon, 20 Oct 2003 15:40:59 +0000 (+0000) Subject: refine code. X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fperl.git;a=commitdiff_plain;h=a5b67490dec3829a2f7bf6deee47d9a2b8a9020c refine code. --- diff --git a/Chise_utils/Chise_utils.pm b/Chise_utils/Chise_utils.pm index 8414736..1c2aca0 100644 --- a/Chise_utils/Chise_utils.pm +++ b/Chise_utils/Chise_utils.pm @@ -193,8 +193,9 @@ sub get_chars_matching{ } } else{ -# # fall back if DB inconsistency exists. +# never fall back. # unless(@res){ +# # fall back if DB inconsistency exists. if(&get_db($atr)){ foreach $char (keys %{$chardb{$atr}}){ if($chardb{$atr}->{$char} eq $value){ @@ -227,18 +228,14 @@ sub get_chars_for{ } } } - foreach (keys %res){ - if($res{$_}==$i){ - push @res,$_; - } - } - return @res; + return grep {defined($res{$_}) and $res{$_}==$i} (keys %res); } sub de_er{ my($er)=@_; my($output_char,$atr,$value); if($er=~/^\d+$/){ + # only for debug. $output_char=pack("U",$er); }elsif($er=~/^U[\+\-]([a-fA-F\d]+)/){ $output_char=pack("U",hex($1));