From 8eea66d9d76ead66ba7bdeb08e8490b0870169b8 Mon Sep 17 00:00:00 2001
From: Magnolia K <magnolia.k@icloud.com>
Date: Sat, 21 Jan 2017 13:33:56 +0900
Subject: [PATCH] Fixed deprecated warning

Incorporate the fixes made in Mojo::JSON below.

https://github.com/kraih/mojo/commit/d76e408bc98bda105466b208e71224d99cb88243
---
 lib/JSON/Tiny.pm | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/lib/JSON/Tiny.pm b/lib/JSON/Tiny.pm
index fcf7470..af0451c 100644
--- a/lib/JSON/Tiny.pm
+++ b/lib/JSON/Tiny.pm
@@ -10,6 +10,7 @@ use Carp 'croak';
 use Exporter 'import';
 use Scalar::Util 'blessed';
 use Encode ();
+use B;
 
 our $VERSION = '0.56';
 our @EXPORT_OK = qw(decode_json encode_json false from_json j to_json true);
@@ -265,16 +266,8 @@ sub _encode_value {
 
   # Number (bitwise operators change behavior based on the internal value type)
 
-  # "0" & $x will modify the flags on the "0" on perl < 5.14, so use a copy
-  my $zero = "0";
-  # "0" & $num -> 0. "0" & "" -> "". "0" & $string -> a character.
-  # this maintains the internal type but speeds up the xor below.
-  my $check = $zero & $value;
   return $value
-    if length $check
-    # 0 ^ itself          -> 0    (false)
-    # $character ^ itself -> "\0" (true)
-    && !($check ^ $check)
+    if B::svref_2object(\$value)->FLAGS & (B::SVp_IOK | B::SVp_NOK)
     # filter out "upgraded" strings whose numeric form doesn't strictly match
     && 0 + $value eq $value
     # filter out inf and nan
-- 
2.1.2