This is an automated email from the git hooks/post-receive script. dmn pushed a commit to branch master in repository libconfig-tiny-perl.
commit d49effdb66feeb93e66610f73d60b1cf6633ffdb Author: Dominic Hargreaves <d...@earth.li> Date: Sat Mar 26 12:42:42 2011 +0000 new upstream release --- Changes | 4 +++ META.yml | 2 +- Makefile.PL | 2 +- README | 2 +- debian/changelog | 6 ++++ debian/copyright | 2 +- lib/Config/Tiny.pm | 15 ++++----- t/01_compile.t | 7 ++--- t/02_main.t | 92 +++++++++++++++++++++++++++++++++--------------------- xt/pmv.t | 2 +- 10 files changed, 81 insertions(+), 53 deletions(-) diff --git a/Changes b/Changes index 8b7b91e..01db17e 100755 --- a/Changes +++ b/Changes @@ -1,5 +1,9 @@ Revision history for Perl extension Config-Tiny +2.14 Thu 24 Mar 2011 + - Resolved #63080: module can write multiline values but not read them + - Removed -w from tests to allow tests with tainting on + 2.13 Fri 3 Sep 2010 - Resolved #60703: Display glitch in Config::Tiny 2.12 POD - Resolved #40585: member 'set;' doesn't exist diff --git a/META.yml b/META.yml index 9fc5284..9a2f540 100644 --- a/META.yml +++ b/META.yml @@ -1,6 +1,6 @@ --- #YAML:1.0 name: Config-Tiny -version: 2.13 +version: 2.14 abstract: Read/Write .ini style files with as little code as possible author: - Adam Kennedy <ad...@cpan.org> diff --git a/Makefile.PL b/Makefile.PL index 5206d5c..ecb6c53 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -2,7 +2,7 @@ use strict; use vars qw{$VERSION}; BEGIN { require 5.003_96; - $VERSION = '2.13'; + $VERSION = '2.14'; } use ExtUtils::MakeMaker; diff --git a/README b/README index ba7a89c..40e0fd0 100644 --- a/README +++ b/README @@ -128,7 +128,7 @@ SEE ALSO Config::Simple, Config::General, ali.as COPYRIGHT - Copyright 2002 - 2010 Adam Kennedy. + Copyright 2002 - 2011 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/debian/changelog b/debian/changelog index 450c399..823efef 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +libconfig-tiny-perl (2.14-1) UNRELEASED; urgency=low + + * New upstream release + + -- Dominic Hargreaves <d...@earth.li> Sat, 26 Mar 2011 12:36:53 +0000 + libconfig-tiny-perl (2.13-1) unstable; urgency=low * New upstream release diff --git a/debian/copyright b/debian/copyright index ed99480..072e942 100644 --- a/debian/copyright +++ b/debian/copyright @@ -9,7 +9,7 @@ Adam Kennedy ( maintainer ) c...@ali.as http://ali.as/ -Copyright 2002 - 2007 Adam Kennedy. +Copyright 2002 - 2011 Adam Kennedy. Thanks to Sherzod Ruzmetov <sherz...@cpan.org> for Config::Simple, which inspired this module by being not quite "simple" enough for me :). diff --git a/lib/Config/Tiny.pm b/lib/Config/Tiny.pm index 607412a..2496129 100755 --- a/lib/Config/Tiny.pm +++ b/lib/Config/Tiny.pm @@ -5,7 +5,7 @@ package Config::Tiny; use strict; BEGIN { require 5.004; - $Config::Tiny::VERSION = '2.13'; + $Config::Tiny::VERSION = '2.14'; $Config::Tiny::errstr = ''; } @@ -97,15 +97,16 @@ sub write_string { # 1. Leading whitespace # 2. Trailing whitespace # 3. Newlines in section name - if ( $section =~ /(?:^\s|\n|\s$)/s ) { - return $self->_error( - "Illegal whitespace in section name '$section'" - ); - } + return $self->_error( + "Illegal whitespace in section name '$section'" + ) if $section =~ /(?:^\s|\n|\s$)/s; my $block = $self->{$section}; $contents .= "\n" if length $contents; $contents .= "[$section]\n" unless $section eq '_'; foreach my $property ( sort keys %$block ) { + return $self->_error( + "Illegal newlines in property '$section.$property'" + ) if $block->{$property} =~ /(?:\012|\015)/s; $contents .= "$property=$block->{$property}\n"; } } @@ -268,7 +269,7 @@ L<Config::Simple>, L<Config::General>, L<ali.as> =head1 COPYRIGHT -Copyright 2002 - 2010 Adam Kennedy. +Copyright 2002 - 2011 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff --git a/t/01_compile.t b/t/01_compile.t index 15802e6..ff72fcc 100644 --- a/t/01_compile.t +++ b/t/01_compile.t @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl # Compile testing for Config::Tiny @@ -8,9 +8,6 @@ BEGIN { $^W = 1; } -use Test::More tests => 2; +use Test::More tests => 1; -ok( $] >= 5.004, "Your perl is new enough" ); use_ok('Config::Tiny'); - -exit(0); diff --git a/t/02_main.t b/t/02_main.t index 5fab94a..8401d22 100644 --- a/t/02_main.t +++ b/t/02_main.t @@ -1,4 +1,4 @@ -#!/usr/bin/perl -w +#!/usr/bin/perl # Main testing script for Config::Tiny @@ -8,25 +8,22 @@ BEGIN { $^W = 1; } -use UNIVERSAL; use Test::More tests => 33; +use Config::Tiny (); +use UNIVERSAL (); use vars qw{$VERSION}; BEGIN { - $VERSION = '2.13'; + $VERSION = '2.14'; } # Check their perl version -BEGIN { - ok( $] >= 5.004, "Your perl is new enough" ); - use_ok('Config::Tiny'); -} is( $Config::Tiny::VERSION, $VERSION, 'Loaded correct version of Config::Tiny' ); # Test trivial creation -my $Trivial = Config::Tiny->new(); +my $Trivial = Config::Tiny->new; ok( $Trivial, '->new returns true' ); ok( ref $Trivial, '->new returns a reference' ); # Legitimate use of UNIVERSAL::isa @@ -46,31 +43,33 @@ isa_ok( $Config, 'Config::Tiny' ); my $expected = { '_' => { root => 'something', - }, + }, section => { one => 'two', Foo => 'Bar', this => 'Your Mother!', blank => '', - }, + }, 'Section Two' => { 'something else' => 'blah', 'remove' => 'whitespace', - }, - }; + }, +}; bless $expected, 'Config::Tiny'; is_deeply( $Config, $expected, 'Config structure matches expected' ); # Add some stuff to the trivial config and check write_string() for it -$Trivial->{_} = { root1 => 'root2' }; +$Trivial->{_} = { + root1 => 'root2', +}; $Trivial->{section} = { foo => 'bar', this => 'that', blank => '', - }; +}; $Trivial->{section2} = { 'this little piggy' => 'went to market' - }; +}; my $string = <<END; root1=root2 @@ -120,20 +119,18 @@ END { ##################################################################### # Bugs that happened we don't want to happen again -{ -# Reading in an empty file, or a defined but zero length string, should yield -# a valid, but empty, object. -my $Empty = Config::Tiny->read_string(''); -isa_ok( $Empty, 'Config::Tiny' ); -is( scalar(keys %$Empty), 0, 'Config::Tiny object from empty string, is empty' ); +SCOPE: { + # Reading in an empty file, or a defined but zero length string, should yield + # a valid, but empty, object. + my $Empty = Config::Tiny->read_string(''); + isa_ok( $Empty, 'Config::Tiny' ); + is( scalar(keys %$Empty), 0, 'Config::Tiny object from empty string, is empty' ); } - - -{ -# A Section header like [ section ] doesn't end up at ->{' section '}. -# Trim off whitespace from the section header. -my $string = <<'END'; +SCOPE: { + # A Section header like [ section ] doesn't end up at ->{' section '}. + # Trim off whitespace from the section header. + my $string = <<'END_CONFIG'; # The need to trim off whitespace makes a lot more sense # when you are trying to maximise readability. [ /path/to/file.txt ] @@ -145,14 +142,37 @@ this=that [section3 ] this=that -END +END_CONFIG -my $Trim = Config::Tiny->read_string($string); -isa_ok( $Trim, 'Config::Tiny' ); -ok( exists $Trim->{'/path/to/file.txt'}, 'First section created' ); -is( $Trim->{'/path/to/file.txt'}->{this}, 'that', 'First section created properly' ); -ok( exists $Trim->{section2}, 'Second section created' ); -is( $Trim->{section2}->{this}, 'that', 'Second section created properly' ); -ok( exists $Trim->{section3}, 'Third section created' ); -is( $Trim->{section3}->{this}, 'that', 'Third section created properly' ); + my $Trim = Config::Tiny->read_string($string); + isa_ok( $Trim, 'Config::Tiny' ); + ok( exists $Trim->{'/path/to/file.txt'}, 'First section created' ); + is( $Trim->{'/path/to/file.txt'}->{this}, 'that', 'First section created properly' ); + ok( exists $Trim->{section2}, 'Second section created' ); + is( $Trim->{section2}->{this}, 'that', 'Second section created properly' ); + ok( exists $Trim->{section3}, 'Third section created' ); + is( $Trim->{section3}->{this}, 'that', 'Third section created properly' ); +} + + + + + +###################################################################### +# Refuse to write config files with newlines in them + +SCOPE: { + my $newline = Config::Tiny->new; + $newline->{_}->{string} = "foo\nbar"; + local $@; + my $output = undef; + eval { + $output = $newline->write_string; + }; + is( $output, undef, '->write_string returns undef on newlines' ); + is( + Config::Tiny->errstr, + "Illegal newlines in property '_.string'", + '->errstr returns expected error', + ); } diff --git a/xt/pmv.t b/xt/pmv.t index 84d6f6f..f285be3 100644 --- a/xt/pmv.t +++ b/xt/pmv.t @@ -9,7 +9,7 @@ BEGIN { } my @MODULES = ( - 'Perl::MinimumVersion 1.25', + 'Perl::MinimumVersion 1.27', 'Test::MinimumVersion 0.101080', ); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libconfig-tiny-perl.git _______________________________________________ Pkg-perl-cvs-commits mailing list Pkg-perl-cvs-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits