Skip to content

Commit

Permalink
fix use of deprecated Perl 5.23.6 feature in Mojo::JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jan 24, 2016
1 parent 300f140 commit d76e408
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions Changes
@@ -1,5 +1,6 @@

6.42 2016-01-24
- Fixed use of deprecated Perl 5.23.6 feature in Mojo::JSON.
- Fixed validation filter bugs in Mojolicious::Validator::Validation.

6.41 2016-01-20
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojo/JSON.pm
@@ -1,6 +1,7 @@
package Mojo::JSON;
use Mojo::Base -strict;

use B;
use Carp 'croak';
use Exporter 'import';
use JSON::PP ();
Expand Down Expand Up @@ -248,10 +249,9 @@ sub _encode_value {
# Null
return 'null' unless defined $value;

# Number (bitwise operators change behavior based on the internal value type)
my $check = (my $dummy = "0") & $value;
# Number
return $value
if (!($check ^ $check) && length $check)
if B::svref_2object(\$value)->FLAGS & (B::SVp_IOK | B::SVp_NOK)
&& 0 + $value eq $value
&& $value * 0 == 0;

Expand Down

0 comments on commit d76e408

Please sign in to comment.