From bbb7a876fa1f458cb65442f8ae1d4ed7d92ab7e5 Mon Sep 17 00:00:00 2001 From: fukachan Date: Wed, 6 Mar 2002 14:38:02 +0000 Subject: implement get_as_array_ref() --- fml/lib/FML/Config.pm | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/fml/lib/FML/Config.pm b/fml/lib/FML/Config.pm index 5e17c5b2..efb0ea15 100644 --- a/fml/lib/FML/Config.pm +++ b/fml/lib/FML/Config.pm @@ -1,7 +1,7 @@ #-*- perl -*- # Copyright (C) 2000,2001,2002 Ken'ichi Fukamachi # -# $FML: Config.pm,v 1.56 2002/02/24 08:27:01 fukachan Exp $ +# $FML: Config.pm,v 1.57 2002/03/05 13:25:25 fukachan Exp $ # package FML::Config; @@ -144,6 +144,10 @@ sub new get value for key. +=head2 C + +get value for key as an array reference. + =head2 C set value for key. @@ -162,6 +166,27 @@ sub get } +# Descriptions: get vaule for $key +# Arguments: OBJ($self) STR($key) +# Side Effects: update internal area +# Return Value: ARRAY_REF +sub get_as_array_ref +{ + my ($self, $key) = @_; + + if (defined($key) && defined($self->{ $key })) { + my $x = $self->{ $key }; + $x =~ s/^\s*//; + $x =~ s/\s*$//; + my (@x) = split(/\s+/, $x); + return \@x; + } + else { + return []; + } +} + + # Descriptions: set vaule for $key # flag on we need to re-evaludate variable expansion. # Arguments: OBJ($self) STR($key) -- cgit v1.2.1