Permalink
Browse files

0 is a valid sec name

  • Loading branch information...
1 parent b0efa4d commit ff8e2e8d4b8582e0549cc730c505ff7fc4bad29f @rjbs committed Nov 22, 2007
Showing with 20 additions and 8 deletions.
  1. +3 −0 Changes
  2. +2 −2 lib/Config/INI.pm
  3. +3 −3 lib/Config/INI/Reader.pm
  4. +2 −2 lib/Config/INI/Writer.pm
  5. +10 −1 t/reader.t
View
@@ -1,5 +1,8 @@
Changelog for Config-INI-Reader
+0.011 2007-11-19
+ BUG FIX: "0" was not a valid section name
+
0.010 2007-11-04
BUG FIX: detect when we're dumping something we won't be able to read
BUG FIX: fix tests when filetest.pm is not available (pre-5.6)
View
@@ -9,11 +9,11 @@ Config::INI - simple .ini-file format
=head1 VERSION
-version 0.010
+version 0.011
=cut
-$Config::INI::VERSION = '0.010';
+$Config::INI::VERSION = '0.011';
=head1 GRAMMAR
@@ -9,11 +9,11 @@ Config::INI::Reader - a subclassable .ini-file parser
=head1 VERSION
-version 0.010
+version 0.011
=cut
-$Config::INI::Reader::VERSION = '0.010';
+$Config::INI::Reader::VERSION = '0.011';
=head1 SYNOPSIS
@@ -140,7 +140,7 @@ sub read_handle {
$self->preprocess_line(\$line);
# Handle section headers
- if (my $name = $self->parse_section_header($line)) {
+ if (defined (my $name = $self->parse_section_header($line))) {
# Create the sub-hash if it doesn't exist.
# Without this sections without keys will not
# appear at all in the completed struct.
@@ -9,11 +9,11 @@ Config::INI::Writer - a subclassable .ini-file emitter
=head1 VERSION
-version 0.010
+version 0.011
=cut
-$Config::INI::Writer::VERSION = '0.010';
+$Config::INI::Writer::VERSION = '0.011';
=head1 SYNOPSIS
View
@@ -4,7 +4,7 @@ use strict;
use IO::File;
use IO::String;
-use Test::More tests => 7;
+use Test::More tests => 8;
# Check their perl version
use_ok('Config::INI::Reader');
@@ -85,3 +85,12 @@ END
is_deeply($empty, {}, "an empty string gets an empty hashref");
}
+{
+ # "0" is a valid section name
+ my $config = Config::INI::Reader->read_string("[0]\nfoo = 1\n");
+ is_deeply(
+ $config,
+ { 0 => { foo => 1 } },
+ "we can use 0 as a section name",
+ );
+}

0 comments on commit ff8e2e8

Please sign in to comment.