Tadashi Okoshi
slash****@users*****
2005年 10月 25日 (火) 03:41:21 JST
Index: affelio/lib/Affelio/Backplane/FarmConnecter/SimpleFileConnecter.pm
diff -u affelio/lib/Affelio/Backplane/FarmConnecter/SimpleFileConnecter.pm:1.1 affelio/lib/Affelio/Backplane/FarmConnecter/SimpleFileConnecter.pm:1.2
--- affelio/lib/Affelio/Backplane/FarmConnecter/SimpleFileConnecter.pm:1.1 Tue Oct 25 02:39:17 2005
+++ affelio/lib/Affelio/Backplane/FarmConnecter/SimpleFileConnecter.pm Tue Oct 25 03:41:21 2005
@@ -16,14 +16,16 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
-# $Id: SimpleFileConnecter.pm,v 1.1 2005/10/24 17:39:17 slash5234 Exp $
+# $Id: SimpleFileConnecter.pm,v 1.2 2005/10/24 18:41:21 slash5234 Exp $
package Affelio::Backplane::FarmConnecter::SimpleFileConnecter;
{
use strict;
use lib("../../../../extlib");
+ use Error qw(:try);
use lib("../../../../lib");
use Affelio::misc::Debug;
+ use Affelio::exception::IOException;
use vars qw(@ISA);
@ISA = qw(Affelio::Backplane::FarmConnecter);
@@ -38,22 +40,26 @@
debug_print("SimpleFileConn: path = [$file_path]");
my %config = ();
+ my $self = {file_path => $file_path,
+ config => \%config};
+ bless $self, $class;
- open(IN, $file_path);
my $line="";
- while($line=<IN>){
- chop($line);
- if($line =~ /AF_CTRL_/){
- $line = ~/([A-Za-z0-9\-\_]*)\s*=\s*(.*)/;
- $config{$1} =$2;
- debug_print("SimpleFileConn: [$1] = [$2]");
+ try{
+ open(IN, $file_path);
+ while($line = <IN>){
+ chop($line);
+ if($line =~ /^AF_CTRL_([A-Za-z0-9\-\_]*)\s*\=\s*(.*)/){
+ $config{$1} =$2;
+ debug_print("SimpleFileConn: [$1] = [$2]");
+ }
}
- }
- close(IN);
+ close(IN);
+ }catch Error with{
+ my $e=shift;
+ debug_print("SimpleFileConn: $e");
+ };
- my $self = {file_path => $file_path,
- config => %config};
- bless $self, $class;
return($self);
}
@@ -61,6 +67,7 @@
my $self =shift;
my $arg = shift;
+ debug_print("SimpleFileConn::get_val $arg = $self->{config}->{$arg}");
return($self->{config}->{$arg});
}