Skip to content

Commit

Permalink
import Config::Tiny 1.8 from CPAN
Browse files Browse the repository at this point in the history
git-cpan-module: Config::Tiny
git-cpan-version: 1.8
git-cpan-authorid: ADAMK
  • Loading branch information
adamkennedy authored and schwern committed Dec 6, 2009
1 parent ef89a50 commit 375f872
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 36 deletions.
50 changes: 27 additions & 23 deletions Changes
@@ -1,47 +1,51 @@
Revision history for Perl extension Config::Tiny

1.8 Wed Jun 30 2004
- Fixed a bug whereby trying to load an empty file returned an error,
when it should be valid (if an empty object)

1.7 Tue Jun 22 2004
- Added a little more flexibility in the 'read' and 'read_string' methods
to handle being called in unexpected, but recoverable, ways.
- Added a little more flexibility in the 'read' and 'read_string' methods
to handle being called in unexpected, but recoverable, ways.

1.6 Mon Mar 1 2004
- Bug fix: Sections without keys didn't appear at all in the parsed struct
- Bug fix: Sections without keys didn't appear at all in the parsed struct

1.5 Wed Jan 7 2004
- Updating documentation to provide a correct location to send bug reports
- Updating documentation to provide a correct location to send bug reports

1.4 Web Dec 24 2003
- Caught a warning when trying to parse an undefined string.
Returns undef in that case.
- Merry Christmas and a productive New Year to you all!
- Caught a warning when trying to parse an undefined string.
Returns undef in that case.
- Merry Christmas and a productive New Year to you all!

1.3 Fri Nov 7 2003
- Slightly altered a regex so that trailing whitespace in properties
is dropped.
- Slightly altered a regex so that trailing whitespace in properties
is dropped.

1.2 Wed Aug 12 15:51:12 2003
- Applied a variety of small changed designed to reduce the number of
opcodes generated, without changing the functionality.
This should save a few K in load overhead.
- Applied a variety of small changed designed to reduce the number of
opcodes generated, without changing the functionality.
This should save a few K in load overhead.

1.1 Wed Apr 23 22:56:21 2003
- When reporting a bad line, put single quotes around the
lines contents in the error message.
- Small updates to the pod documentation
- When reporting a bad line, put single quotes around the
lines contents in the error message.
- Small updates to the pod documentation

1.0 Sat Dec 21 11:53:51 2002
- Removed file locking, since we read/write virtually atomically now
- Removed mode support from ->write() it was erroneous
- Removed dependency on Fcntl
- Added the read_string() method
- Other minor tweaks to shrink the code
- Removed file locking, since we read/write virtually atomically now
- Removed mode support from ->write() it was erroneous
- Removed dependency on Fcntl
- Added the read_string() method
- Other minor tweaks to shrink the code

0.3 Mon Dec 09 00:44:21 2002
- Upgraded tests to Test::More, to deep test the structs
- Added Fcntl to the required modules
- Upgraded tests to Test::More, to deep test the structs
- Added Fcntl to the required modules

0.2 Tue Nov 26 21:51:34 2002
- Don't import Fcntl symbols
- Don't import Fcntl symbols

0.1 Wed Nov 13 16:50:23 2002
- original version
2 changes: 1 addition & 1 deletion META.yml
@@ -1,7 +1,7 @@
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: Config-Tiny
version: 1.7
version: 1.8
version_from: lib/Config/Tiny.pm
installdirs: site
requires:
Expand Down
2 changes: 1 addition & 1 deletion README
Expand Up @@ -108,7 +108,7 @@ AUTHOR
http://ali.as/

Thanks to Sherzod Ruzmetov <sherzodr@cpan.org> for Config::Simple, which
inspired this module.
inspired this module by being not quite "simple" enough for me :)

SEE ALSO
Config::Simple, Config::General
Expand Down
6 changes: 3 additions & 3 deletions lib/Config/Tiny.pm
Expand Up @@ -7,7 +7,7 @@ use strict;

use vars qw{$VERSION $errstr};
BEGIN {
$VERSION = '1.7';
$VERSION = '1.8';
$errstr = '';
}

Expand Down Expand Up @@ -37,7 +37,7 @@ sub read {
sub read_string {
my $class = ref $_[0] ? ref shift : shift;
my $self = bless {}, $class;
return undef unless $_[0];
return undef unless defined $_[0];

# Parse the file
my $ns = '_';
Expand Down Expand Up @@ -234,7 +234,7 @@ Implementation is left as an exercise for the reader.
http://ali.as/
Thanks to Sherzod Ruzmetov <sherzodr@cpan.org> for Config::Simple,
which inspired this module.
which inspired this module by being not quite "simple" enough for me :)
=head1 SEE ALSO
Expand Down
39 changes: 31 additions & 8 deletions t/01_main.t
Expand Up @@ -3,16 +3,24 @@
# Formal testing for Config::Tiny

use strict;
use lib '../../modules'; # For development testing
use lib '../lib'; # For installation testing
use lib ();
use UNIVERSAL 'isa';
use Test::More tests => 23;
use File::Spec::Functions ':ALL';
BEGIN {
$| = 1;
unless ( $ENV{HARNESS_ACTIVE} ) {
require FindBin;
chdir ($FindBin::Bin = $FindBin::Bin); # Avoid a warning
lib->import( catdir( updir(), updir(), 'modules') );
}
}

use Test::More tests => 25;

# Set up any needed globals
use vars qw{$loaded};
BEGIN {
$loaded = 0;
$| = 1;
}


Expand Down Expand Up @@ -116,12 +124,27 @@ ok( isa( $Read, 'Config::Tiny' ), '->read of what we wrote returns a Config::Tin
# Check the structure of what we read back in
is_deeply( $Read, $Trivial, 'What we read matches what we wrote out' );





END {
# Clean up
unlink './test2.conf';
}





#####################################################################
# 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' );






1;

0 comments on commit 375f872

Please sign in to comment.