Neo4j::Bolt::Cxn - Container for a Neo4j Bolt connection
use Neo4j::Bolt; $cxn = Neo4j::Bolt->connect("bolt://localhost:7687"); unless ($cxn->connected) { die "Problem connecting: ".$cxn->errmsg; } $stream = $cxn->run_query( "MATCH (a) RETURN head(labels(a)) as lbl, count(a) as ct", ); if ($stream->failure) { print STDERR "Problem with query run: ". ($stream->client_errmsg || $stream->server_errmsg); }
Neo4j::Bolt::Cxn is a container for a Bolt connection, instantiated by a call to Neo4j::Bolt->connect().
Neo4j::Bolt->connect()
True if server connected successfully. If not, see "errnum()" and "errmsg()".
Returns a string representing the major and minor Bolt protocol version of the server, as "<major>.<minor>", or the empty string if not connected.
Run a Cypher query on the server. Returns a Neo4j::Bolt::ResultStream which can be iterated to retrieve query results as Perl types and structures. [$param_hash] is an optional hashref of the form { param => $value, ... }.
{ param => $value, ... }
Send a Cypher query to the server. All results (except error info) are discarded.
($stream, @rows) = do_query($cypher_query); $stream = do_query($cypher_query, $param_hash);
Run a Cypher query on the server, and iterate the stream to retrieve all result rows. do_query is convenient for running write queries (e.g., CREATE (a:Bloog {prop1:"blarg"}) ), since it returns the $stream with "update_counts" in Neo4j::Bolt::ResultStream ready for reading.
do_query
CREATE (a:Bloog {prop1:"blarg"})
Send a RESET message to the Neo4j server. According to the Bolt protocol, this should force any currently processing query to abort, forget any pending queries, clear any failure state, dispose of outstanding result records, and roll back the current transaction.
Current error state of the connection. If
$cxn->connected == $cxn->errnum == 0
then you have a virgin Cxn object that came from someplace other than Neo4j::Bolt->connect(), which would be weird.
print $cxn->server_id; # "Neo4j/3.3.9"
Get the server ID string, including the version number. undef if connecting wasn't successful or the server didn't identify itself.
undef
Neo4j::Bolt, Neo4j::Bolt::ResultStream.
Mark A. Jensen CPAN: MAJENSEN majensen -at- cpan -dot- org
This software is Copyright (c) 2019-2021 by Mark A. Jensen.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
To install Neo4j::Bolt, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Neo4j::Bolt
CPAN shell
perl -MCPAN -e shell install Neo4j::Bolt
For more information on module installation, please visit the detailed CPAN module installation guide.