diff options
| author | fukachan <fukachan> | 2002-03-06 14:38:02 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2002-03-06 14:38:02 +0000 |
| commit | bbb7a876fa1f458cb65442f8ae1d4ed7d92ab7e5 (patch) | |
| tree | 29495c75f3042510f5fc2c5f4064c1d6d9d628d0 | |
| parent | c2243de033ed2bbfa20a88062ebcff77eb2eeff1 (diff) | |
| download | fml8-bbb7a876fa1f458cb65442f8ae1d4ed7d92ab7e5.tar.gz fml8-bbb7a876fa1f458cb65442f8ae1d4ed7d92ab7e5.tar.bz2 fml8-bbb7a876fa1f458cb65442f8ae1d4ed7d92ab7e5.zip | |
implement get_as_array_ref()
| -rw-r--r-- | fml/lib/FML/Config.pm | 27 |
1 files changed, 26 insertions, 1 deletions
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_as_array_ref( key )> + +get value for key as an array reference. + =head2 C<set( key, value )> 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) |
