Due to the work I'm doing processing returned API data, I need bools decoded using JSON::decode to be numeric, rather than JSON::PP::Boolean.

CPAN docs are great, just use $json->boolean_values(0,1);

Unfortunately that method doesn't seem to be getting exported:

#!perl -l
use 5.012; # strict, // use warnings; use JSON 4.0; use Data::Dumper; print "JSON::VERSION = $JSON::VERSION\n"; my $json = JSON->new; $json->boolean_values(0,1); test@BruceDEV:~$ perl Perl-Testing/JSON-boolean_values.pl JSON::VERSION = 4.02 Can't locate object method "boolean_values" via package "JSON" at Perl +-Testing/JSON-boolean_values.pl line 11.
I'm using Debian packages for the libraries we have infrastructure teams maintaining our systems & having them update via CPAN causes issues However the modules do look correct.
Debian GNU/Linux 10 ii libjson-perl 4.02000-1 + all module for manipulating JSON-formatted d +ata ii libjson-xs-perl 3.040-1+b1 + amd64 module for manipulating JSON-formatted d +ata (C/XS-accelerated)
Looking at the contents of /usr/share/perl5/JSON.pm I see this, so it looks like it's definitely the right module, although I'm a little suspicious as a number of the methods in the docs, including boolean_values don't seem to be exported.
package JSON; use strict; use Carp (); use Exporter; BEGIN { @JSON::ISA = 'Exporter' } @JSON::EXPORT = qw(from_json to_json jsonToObj objToJson encode_json d +ecode_json); BEGIN { $JSON::VERSION = '4.02'; $JSON::DEBUG = 0 unless (defined $JSON::DEBUG); $JSON::DEBUG = $ENV{ PERL_JSON_DEBUG } if exists $ENV{ PERL_JSON +_DEBUG }; } [...] =head2 boolean_values (since version 4.0) $json->boolean_values([$false, $true]) ($false, $true) = $json->get_boolean_values By default, JSON booleans will be decoded as overloaded C<$JSON::false> and C<$JSON::true> objects.
Any pointers ?, I *really* don't want to move to using CPAN directly on these devices, given how they're maintained.

In reply to Issues using boolean_values in JSON v4.02 by bc3-au

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.