From: imiyazaki Date: Thu, 27 Nov 2003 13:37:33 +0000 (+0000) Subject: add $omegadb_path. X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=127ccf221a335ca2815c87d79c0844172f085494;p=chise%2Fperl.git add $omegadb_path. open DB as read only. --- diff --git a/Chise_utils/Chise_utils.pm b/Chise_utils/Chise_utils.pm index 961970b..b03cf0b 100644 --- a/Chise_utils/Chise_utils.pm +++ b/Chise_utils/Chise_utils.pm @@ -12,6 +12,7 @@ use vars qw(%db %chardb %reverse_db %reverse_chardb %er_alias $er_prefix_re $atr $idc + $omegadb_path ); our @ISA = qw(Exporter); @@ -28,6 +29,7 @@ our %EXPORT_TAGS = ( 'all' => [ qw( %reverse_db %reverse_chardb $idc %er_alias $er_prefix_re + $omegadb_path &get_db &get_reverse_db &get_char_attribute @@ -47,6 +49,8 @@ our $VERSION = '0.02'; # Preloaded methods go here. +$omegadb_path="/usr/local/lib/chise/omega"; + my $DB_HOME=""; unless($DB_HOME){ if(-e '/usr/local/lib/chise/chise-db'){ @@ -139,7 +143,8 @@ sub get_db{ return 1 if(defined(%{$chardb{$atr}})); if(defined($db{$atr}) and -f $db{$atr}){ tie %{$chardb{$atr}}, "BerkeleyDB::Hash", - -Filename => $db{$atr}; + -Filename => $db{$atr}, + -Flags => DB_RDONLY; }else{ return undef; } @@ -150,7 +155,8 @@ sub get_reverse_db{ return 1 if(defined(%{$reverse_chardb{$atr}})); if(defined($reverse_db{$atr}) and -f $reverse_db{$atr}){ tie %{$reverse_chardb{$atr}}, "BerkeleyDB::Hash", - -Filename => $reverse_db{$atr}; + -Filename => $reverse_db{$atr}, + -Flags => DB_RDONLY; }else{ return undef; }