diff options
| author | fukachan <fukachan> | 2003-11-26 11:00:32 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2003-11-26 11:00:32 +0000 |
| commit | 7ac20a697c3c8929f5cd48e71fe7f11a750b4a11 (patch) | |
| tree | 1bc43a411a0b0573cf958f19c2b824d4b38eeaf1 /fml/lib/IO/Adapter/File.pm | |
| parent | b4b3a44abf1c849838fb9a401297ab467346228a (diff) | |
| download | fml8-7ac20a697c3c8929f5cd48e71fe7f11a750b4a11.tar.gz fml8-7ac20a697c3c8929f5cd48e71fe7f11a750b4a11.tar.bz2 fml8-7ac20a697c3c8929f5cd48e71fe7f11a750b4a11.zip | |
implement get_key_values_as_array_ref() to return key and all values
as ARRAY_REF.
Diffstat (limited to 'fml/lib/IO/Adapter/File.pm')
| -rw-r--r-- | fml/lib/IO/Adapter/File.pm | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/fml/lib/IO/Adapter/File.pm b/fml/lib/IO/Adapter/File.pm index 711ece3d..ed67e2e6 100644 --- a/fml/lib/IO/Adapter/File.pm +++ b/fml/lib/IO/Adapter/File.pm @@ -4,7 +4,7 @@ # All rights reserved. This program is free software; you can # redistribute it and/or modify it under the same terms as Perl itself. # -# $FML: File.pm,v 1.47 2003/08/23 04:35:44 fukachan Exp $ +# $FML: File.pm,v 1.48 2003/08/24 14:09:25 fukachan Exp $ # package IO::Adapter::File; @@ -221,6 +221,17 @@ sub get_next_key } +# Descriptions: return (key, values, ... ) as ARRAY_REF +# Arguments: OBJ($self) +# Side Effects: none +# Return Value: ARRAY_REF +sub get_key_values_as_array_ref +{ + my ($self) = @_; + $self->_get_next_xxx('key,value_as_array_ref'); +} + + # Descriptions: get data and return key or value by $mode. # Arguments: OBJ($self) STR($mode) # Side Effects: none @@ -256,6 +267,13 @@ sub _get_next_xxx my (@buf) = split(/\s+/, $value); $buf = \@buf; } + elsif ($mode eq 'key,value_as_array_ref') { + $value =~ s/^\s*//; + $value =~ s/\s*$//; + my (@buf) = split(/\s+/, $value); + unshift(@buf, $key); + $buf = \@buf; + } $ec++; } return $buf; |
