[carton] 78/472: use canonical option to always generate the same JSON

Lucas Kanashiro kanashiro-guest at moszumanska.debian.org
Fri Jul 24 00:38:35 UTC 2015


This is an automated email from the git hooks/post-receive script.

kanashiro-guest pushed a commit to branch master
in repository carton.

commit 66aa10b293280ff11eeb6e9d9cd1ff932c3b3948
Author: Tatsuhiko Miyagawa <miyagawa at bulknews.net>
Date:   Tue Jun 28 18:52:40 2011 -0400

    use canonical option to always generate the same JSON
---
 lib/Carton.pm      | 5 +----
 lib/Carton/Util.pm | 2 +-
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/lib/Carton.pm b/lib/Carton.pm
index 28e32a5..dcaf9e1 100644
--- a/lib/Carton.pm
+++ b/lib/Carton.pm
@@ -272,10 +272,7 @@ sub update_lock_file {
     my($self, $file) = @_;
 
     my $lock = $self->build_lock;
-
-    require JSON;
-    open my $fh, ">", "carton.lock" or die $!;
-    print $fh JSON->new->pretty->encode($lock);
+    Carton::Util::dump_json($lock, $file);
 
     return 1;
 }
diff --git a/lib/Carton/Util.pm b/lib/Carton/Util.pm
index 68353c0..3e54313 100644
--- a/lib/Carton/Util.pm
+++ b/lib/Carton/Util.pm
@@ -24,7 +24,7 @@ sub from_json {
 sub to_json {
     my($data) = @_;
     require JSON;
-    JSON->new->pretty->encode($data);
+    JSON->new->pretty->canonical->encode($data);
 }
 
 1;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/carton.git



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