Skip to content

JSON::Path::Evaluator error in map() when using JSON::true #9

Description

@tobyink

Migrated from rt.cpan.org #123381 (status was 'open')

Requestors:

From victoryshima@gmail.com on 2017-10-25 21:02:08
:

First of all, thanks for the work you have put in this module!

I am experiencing errors when iterating over a hashref that contains the
boolean values provided by JSON::true and JSON::false. According to the
documentation I believe it should ignore the objects, but there might be
some magic behind those Json booleans.

When it iterates over a JSON::true it displays the following error:

Not a HASH reference at

/home/shima/perl5/lib/perl5/JSON/Path/Evaluator.pm line 146.

And when it iterates over a JSON::false it displays the following error:

Can't locate object method "root" via package

"JSON::Path::Evaluator" at
/home/shima/perl5/lib/perl5/JSON/Path/Evaluator.pm line 130.

System Information:

Main Distribution: JSON-Path-0.411

Other Distributions: JSON-2.94

Perl Version: This is perl 5, version 22, subversion 4 (v5.22.4)

built for x86_64-linux-thread-multi (with 61 registered patches, see
perl -V for more detail)

OS Vendor and Versions: Linux hostname 4.11.12-100.fc24.x86_64 #1

SMP Fri Jul 21 17:35:20 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Short Code to Reproduce Error:

use strict;
use warnings;
use JSON;
use JSON::Path;

my $data = { key => JSON::false };
my $method = sub { return $_ };

JSON::Path->new( '$.key' )->map( $data, $method );

1;

Many thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions