[Affelio-cvs 607] CVS update: affelio/lib/Affelio/Backplane/FarmConnecter

Back to archive index

Tadashi Okoshi slash****@users*****
2005年 10月 25日 (火) 02:39:17 JST


Index: affelio/lib/Affelio/Backplane/FarmConnecter/SimpleFileConnecter.pm
diff -u /dev/null affelio/lib/Affelio/Backplane/FarmConnecter/SimpleFileConnecter.pm:1.1
--- /dev/null	Tue Oct 25 02:39:17 2005
+++ affelio/lib/Affelio/Backplane/FarmConnecter/SimpleFileConnecter.pm	Tue Oct 25 02:39:17 2005
@@ -0,0 +1,68 @@
+#!/usr/bin/perl
+
+# Copyright (C) 2005 FishGrove Inc.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# 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 $
+
+package Affelio::Backplane::FarmConnecter::SimpleFileConnecter;
+{
+    use strict;
+    use lib("../../../../extlib");
+    use lib("../../../../lib");
+    use Affelio::misc::Debug;
+
+    use vars qw(@ISA);
+    @ISA = qw(Affelio::Backplane::FarmConnecter);
+
+    sub new{
+	debug_print("SimpleFileConn: start.");
+
+	my $class = shift;
+	my %param = @_;
+    
+	my $file_path = $param{path};
+	debug_print("SimpleFileConn: path = [$file_path]");
+	my %config = ();
+
+
+	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]");	    
+	    }
+	}
+	close(IN);
+
+	my $self = {file_path => $file_path,
+		config => %config};
+	bless $self, $class;
+	return($self);
+    }
+
+    sub get_val{
+	my $self =shift;
+	my $arg = shift;
+
+	return($self->{config}->{$arg});
+    }
+
+}
+1;


Affelio-cvs メーリングリストの案内
Back to archive index