-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
depending on the input of a "value eq ..." query I get a string or a HASH ref.
code
#!/usr/bin/env perl
use 5.018;
use warnings;
use Data::DPath::Path;
sub _match {
my ($path, $input) = @_;
my $dpath = Data::DPath::Path->new( path => $path );
my @result = $dpath->match($input);
use Data::Dumper;
say "###\n$path";
say Dumper(\@result);
}
my $input = { 'details' => 'foo bar baz' };
my $path1 = <<"HERE";
/details[ value eq 'foo bar baz' ]
HERE
my $path2 = <<"HERE";
/details[ value eq 'foo bar
baz' ]
HERE
_match($path1, $input);
_match($path2, $input);output
###
/details[ value eq 'foo bar baz' ]
$VAR1 = [
'foo bar baz'
];
###
/details[ value eq 'foo bar
baz' ]
$VAR1 = [
{
'details' => 'foo bar baz'
}
];
Metadata
Metadata
Assignees
Labels
No labels