diff options
| author | fukachan <fukachan> | 2003-11-27 04:26:09 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2003-11-27 04:26:09 +0000 |
| commit | 6f3531ed20aae6f1717a59ed9082e29248266b04 (patch) | |
| tree | fb120e13e8969e5523f9ab2e135bb619e681494f /fml/lib/IO | |
| parent | 664e98f904a7f18b92af43014a1e3c03367c6a5d (diff) | |
| download | fml8-6f3531ed20aae6f1717a59ed9082e29248266b04.tar.gz fml8-6f3531ed20aae6f1717a59ed9082e29248266b04.tar.bz2 fml8-6f3531ed20aae6f1717a59ed9082e29248266b04.zip | |
bug fix get_key_values_as_array_ref()
Diffstat (limited to 'fml/lib/IO')
| -rw-r--r-- | fml/lib/IO/Adapter/File.pm | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/fml/lib/IO/Adapter/File.pm b/fml/lib/IO/Adapter/File.pm index ed67e2e6..b1980b34 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.48 2003/08/24 14:09:25 fukachan Exp $ +# $FML: File.pm,v 1.49 2003/11/26 11:00:32 fukachan Exp $ # package IO::Adapter::File; @@ -240,6 +240,7 @@ sub _get_next_xxx { my ($self, $mode) = @_; my ($buf) = ''; + my (@buf) = (); my $fh = $self->{_fh}; if (defined $fh) { @@ -264,15 +265,24 @@ sub _get_next_xxx elsif ($mode eq 'value_as_array_ref') { $value =~ s/^\s*//; $value =~ s/\s*$//; - my (@buf) = split(/\s+/, $value); + (@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; + @buf = (); # reset; + + if (defined $key && $key) { + if (defined $value && $value) { + $value =~ s/^\s*//; + $value =~ s/\s*$//; + (@buf) = split(/\s+/, $value); + } + unshift(@buf, $key); + $buf = \@buf; + } + else { + $buf = []; + } } $ec++; } |
