r28011 - in /branches/upstream/libconfig-json-perl/current: Changes MANIFEST META.yml Makefile.PL README lib/Config/JSON.pm t/Config.t

bricas-guest at users.alioth.debian.org bricas-guest at users.alioth.debian.org
Wed Dec 10 14:51:13 UTC 2008


Author: bricas-guest
Date: Wed Dec 10 14:51:09 2008
New Revision: 28011

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=28011
Log:
[svn-upgrade] Integrating new upstream version, libconfig-json-perl (1.3.1)

Modified:
    branches/upstream/libconfig-json-perl/current/Changes
    branches/upstream/libconfig-json-perl/current/MANIFEST
    branches/upstream/libconfig-json-perl/current/META.yml
    branches/upstream/libconfig-json-perl/current/Makefile.PL
    branches/upstream/libconfig-json-perl/current/README
    branches/upstream/libconfig-json-perl/current/lib/Config/JSON.pm
    branches/upstream/libconfig-json-perl/current/t/Config.t

Modified: branches/upstream/libconfig-json-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-json-perl/current/Changes?rev=28011&op=diff
==============================================================================
--- branches/upstream/libconfig-json-perl/current/Changes (original)
+++ branches/upstream/libconfig-json-perl/current/Changes Wed Dec 10 14:51:09 2008
@@ -1,4 +1,11 @@
 Revision history for Config-JSON
+
+1.3.1   Mon Dec 8 14:00:00 2008
+    fix: #41525 Cleaning up temporary directory 
+    Throws a better error message when trying to access an element of an array using a multi-level directive.
+    Writes config file directives in alphabetical order for easier human reading.
+    Better handling of UTF-8 data in the config file.
+    Better version numbers on prereqs.
 
 1.3.0   Tue Oct 28 23:00:00 2008
     Rewrote includes to be much cleaner.

Modified: branches/upstream/libconfig-json-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-json-perl/current/MANIFEST?rev=28011&op=diff
==============================================================================
--- branches/upstream/libconfig-json-perl/current/MANIFEST (original)
+++ branches/upstream/libconfig-json-perl/current/MANIFEST Wed Dec 10 14:51:09 2008
@@ -6,6 +6,9 @@
 lib/Config/JSON.pm
 t/00.load.t
 t/Config.t
+t/Duplicate.t
+t/Include.t
+t/Wildcard.t
 authors.t/perlcritic.t
 authors.t/pod-coverage.t
 authors.t/pod.t

Modified: branches/upstream/libconfig-json-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-json-perl/current/META.yml?rev=28011&op=diff
==============================================================================
--- branches/upstream/libconfig-json-perl/current/META.yml (original)
+++ branches/upstream/libconfig-json-perl/current/META.yml Wed Dec 10 14:51:09 2008
@@ -1,16 +1,17 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         Config::JSON
-version:      1.3.0
+version:      1.3.1
 version_from: lib/Config/JSON.pm
 installdirs:  site
 requires:
-    List::Util:             0
-    Class::InsideOut:       0
-    JSON:                   2.0	
-    Test::More:             0
-    Test::Deep:             0
-    File::Temp:             0
+    List::Util:             1.19
+    Class::InsideOut:       1.06
+    JSON:                   2.12
+    Test::More:             0.7
+    Test::Deep:             0.095
+    File::Temp:             0.18
+    version:                0.7203
 
 distribution_type: module
 generated_by: ExtUtils::MakeMaker version 6.17

Modified: branches/upstream/libconfig-json-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-json-perl/current/Makefile.PL?rev=28011&op=diff
==============================================================================
--- branches/upstream/libconfig-json-perl/current/Makefile.PL (original)
+++ branches/upstream/libconfig-json-perl/current/Makefile.PL Wed Dec 10 14:51:09 2008
@@ -9,13 +9,13 @@
     ABSTRACT_FROM       => 'lib/Config/JSON.pm',
     PL_FILES            => {},
     PREREQ_PM => {
-	'List::Util' 		    => 0,
-	'JSON'	     		    => 2.0,
-    'Class::InsideOut'      => 0,
-    'Test::More' 		    => 0,
-    'Test::Deep'            => 0,
-    'File::Temp'            => 0,
-    'version'    		    => 0,
+	'List::Util' 		    => 1.19,
+	'JSON'	     		    => 2.12,
+    'Class::InsideOut'      => 1.06,
+    'Test::More' 		    => 0.7,
+    'Test::Deep'            => 0.095,
+    'File::Temp'            => 0.18,
+    'version'    		    => 0.7203,
     },
     dist                => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
     clean               => { FILES => 'Config-JSON-*' },

Modified: branches/upstream/libconfig-json-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-json-perl/current/README?rev=28011&op=diff
==============================================================================
--- branches/upstream/libconfig-json-perl/current/README (original)
+++ branches/upstream/libconfig-json-perl/current/README Wed Dec 10 14:51:09 2008
@@ -1,4 +1,4 @@
-Config-JSON version 1.3.0
+Config-JSON version 1.3.1
 
 A JSON based config file parser/writer.
 
@@ -18,12 +18,12 @@
 JSON 2.0 or higher
 List::Util
 Class::InsideOut
+File::Temp
 version
 
 The following are only used for tests:
 Test::More
 Test::Deep
-File::Temp
 
 
 COPYRIGHT AND LICENCE

Modified: branches/upstream/libconfig-json-perl/current/lib/Config/JSON.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-json-perl/current/lib/Config/JSON.pm?rev=28011&op=diff
==============================================================================
--- branches/upstream/libconfig-json-perl/current/lib/Config/JSON.pm (original)
+++ branches/upstream/libconfig-json-perl/current/lib/Config/JSON.pm Wed Dec 10 14:51:09 2008
@@ -8,7 +8,7 @@
 use File::Temp qw/ tempfile /;
 use JSON;
 use List::Util;
-use version; our $VERSION = qv('1.3.0');
+use version; our $VERSION = qv('1.3.1');
 
 
 use constant FILE_HEADER    => "# config-file-type: JSON 1\n";
@@ -102,7 +102,10 @@
 		# look in this config
 		my $value = $config{id $self};
 		foreach my $part (split "/", $property) {
-			$value = $value->{$part};
+			$value = eval{$value->{$part}};
+            if ($@) {
+                croak "Can't access $property. $@";
+            }
 		}
 		return $value if (defined $value);
 
@@ -142,7 +145,7 @@
         close($FILE);
         my $conf;
         eval {
-            $conf = JSON->new->relaxed(1)->decode($json);
+            $conf = JSON->new->relaxed->utf8->decode($json);
         };
         croak "Couldn't parse JSON in config file '$pathToFile'\n" unless ref $conf;
         my $self 		= register($class);
@@ -220,22 +223,15 @@
 	my $realfile = $self->getFilePath;
 
 	# convert data to json
-    my $json = JSON->new->pretty->encode($config{id $self});
+    my $json = JSON->new->pretty->utf8->canonical->encode($config{id $self});
 
 	# create a temporary config file
-	my ($fh, $tempfile) = tempfile();
-	close($fh);
-    if (open(my $FILE,">", $tempfile)) {
-        print $FILE FILE_HEADER."\n".$json;
-        close($FILE);
-    } 
-    else {
-        croak "Can't write (".$realfile.") to temporary file (".$tempfile.")";
-    }
+	my ($fh, $tempfile) = tempfile(UNLINK=>1);
+    print {$fh} FILE_HEADER."\n".$json;
+    close($fh);
 	
 	# move the temp file over the top of the existing file
 	copy($tempfile, $realfile) or croak "Can't copy temporary file (".$tempfile.") to config file (".$realfile.")";
-	unlink $tempfile or carp "Can't delete temporary config file (".$tempfile.")";
 }
 
 
@@ -249,7 +245,7 @@
 
 =head1 VERSION
 
-This document describes Config::JSON version 1.3.0
+This document describes Config::JSON version 1.3.1
 
 
 =head1 SYNOPSIS

Modified: branches/upstream/libconfig-json-perl/current/t/Config.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-json-perl/current/t/Config.t?rev=28011&op=diff
==============================================================================
--- branches/upstream/libconfig-json-perl/current/t/Config.t (original)
+++ branches/upstream/libconfig-json-perl/current/t/Config.t Wed Dec 10 14:51:09 2008
@@ -1,4 +1,4 @@
-use Test::More tests => 26;
+use Test::More tests => 28;
 
 use lib '../lib';
 use Test::Deep;
@@ -67,6 +67,8 @@
 is( $config->get("this/that/scalar"), "foo", "get() multilevel");
 is( ref $config->get("this/that/hash"), "HASH", "get() hash multilevel" );
 is( ref $config->get("this/that/array"), "ARRAY", "get() array multilevel" );
+eval{$config->get("this/that/array/non-existant-element")};
+ok($@, "Throw an error when trying to access an element of an array.");
 
 # set
 $config->set('privateArray', ['a', 'b', 'c']);
@@ -75,6 +77,9 @@
 is($config->get('cars/ford'), "mustang", 'set() multilevel non-exisistant');
 $config->set('cars/ford', [qw( mustang pinto maverick )]);
 cmp_bag($config->get('cars/ford'),[qw( mustang pinto maverick )], 'set() multilevel');
+my $reconfig = Config::JSON->new($filename);
+cmp_bag($config->get('cars/ford'),$reconfig->get('cars/ford'), 'set() multilevel after re-reading config file');
+
 
 # delete 
 $config->delete("dsn");




More information about the Pkg-perl-cvs-commits mailing list