[libnet-duo-perl] 05/12: Use JSON::true and JSON::false when encoding

Russ Allbery eagle at eyrie.org
Mon Jan 8 02:56:07 UTC 2018


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

rra pushed a commit to annotated tag release/1.01
in repository libnet-duo-perl.

commit 4950cd4caa9c7b25882fd02404dc2ca3c8258f65
Author: Russ Allbery <rra at cpan.org>
Date:   Sun Aug 16 17:30:47 2015

    Use JSON::true and JSON::false when encoding
    
    Adjust for an incompatible change in JSON::XS 3.0 that broke magical
    interpretation of the strings "true" and "false" when encoding JSON.
    Use JSON::true and JSON::false instead to ensure that the JSON is
    created properly.
---
 Changes               | 7 +++++++
 lib/Net/Duo/Object.pm | 4 +++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/Changes b/Changes
index fb4d2e5..c429e1d 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,12 @@
                       User-Visible Net::Duo Changes
 
+Net::Duo 1.01 (unreleased)
+
+    Adjust for an incompatible change in JSON::XS 3.0 that broke magical
+    interpretation of the strings "true" and "false" when encoding JSON.
+    Use JSON::true and JSON::false instead to ensure that the JSON is
+    created properly.
+
 Net::Duo 1.00 (2014-07-11)
 
     Initial release with support for generic API calls (both with or
diff --git a/lib/Net/Duo/Object.pm b/lib/Net/Duo/Object.pm
index 8d222ab..5e5ded5 100644
--- a/lib/Net/Duo/Object.pm
+++ b/lib/Net/Duo/Object.pm
@@ -288,7 +288,7 @@ sub json {
         my ($type, $flags) = _field_type($fields->{$field});
         if ($type eq 'simple' || $type eq 'array') {
             if ($flags->{boolean}) {
-                $data{$field} = $self->{$field} ? 'true' : 'false';
+                $data{$field} = $self->{$field} ? JSON::true : JSON::false;
             } elsif ($flags->{zero_or_one}) {
                 $data{$field} = $self->{$field} ? 1 : 0;
             } else {
@@ -480,6 +480,8 @@ Russ Allbery <rra at cpan.org>
 
 =head1 COPYRIGHT AND LICENSE
 
+Copyright 2015 Russ Allbery <rra at cpan.org>
+
 Copyright 2014 The Board of Trustees of the Leland Stanford Junior
 University
 

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



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