Subject: | Cannot create_unique with value 0 |
Date: | Mon, 30 Dec 2013 23:57:07 +0000 |
To: | bug-REST-Neo4p [...] rt.cpan.org |
From: | Kevin Pluck <kevin.pluck [...] ivendi.com> |
Hello,
I've tracked down a bug where creating a unique node with create_unique and
storing the value 0 or '0' results in the error:
Args required: key => value, hashref_of_properties
Here is some code that replicates the problem:
###
use REST::Neo4p;
use strict;
use warnings;
REST::Neo4p->connect('http://127.0.0.1:7474');
my $index = REST::Neo4p::Index->new('node', 'index');
print "x\n";
my $node1 = $index->create_unique(foo => "x", {foo => "x"}); # Works
print "0\n";
my $node2 = $index->create_unique(bar => "0", {bar => "0"}); # Doesn't work
###
It's likely due to line 211 in Index.pm
unless ($key && $value && $properties && (ref $properties eq 'HASH')) {
Which as $value is 0 it is treated as a boolean false and fails this guard
code.
Version of Neo4p in use:
REST::Neo4p
-------------------------------------------------------------------------
CPAN: Module::CoreList loaded ok (v2.96)
Perl object bindings for a Neo4j database
M/MA/MAJENSEN/REST-Neo4p-0.2230.tar.gz
C:\strawberry\perl\site\lib\REST\Neo4p.pm
Installed: 0.2230
CPAN: 0.2230 up to date
Mark Allen Jensen (MAJENSEN)
jensen@fortinbras.us
I am finding Neo4j absolutely fantastic to use and your perl library very
easy and intuitive.
Regards,
Kevin.
--
*Kevin Pluck*
*i**V**endi Limited*