Neo4j-Driver
view release on metacpan or search on metacpan
"List::Util" : "1.33",
"Neo4j::Error" : "0",
"Neo4j::Types" : "2.00",
"URI" : "1.31",
"URI::Escape" : "3.26",
"perl" : "v5.14.0"
},
"suggests" : {
"Cpanel::JSON::XS" : "4.38",
"IO::Socket::IP" : "0.32",
"IO::Socket::SSL" : "1.56",
"JSON::PP" : "4.11",
"Neo4j::Bolt" : "0.5000",
"Net::SSLeay" : "1.49"
}
},
"test" : {
"requires" : {
"Neo4j::Types" : "2.00",
"Test2::V0" : "0",
"Test::Exception" : "0",
requires "HTTP::Tiny" => "0.034";
requires "JSON::MaybeXS" => "1.003003";
requires "List::Util" => "1.33";
requires "Neo4j::Error" => "0";
requires "Neo4j::Types" => "2.00";
requires "URI" => "1.31";
requires "URI::Escape" => "3.26";
requires "perl" => "v5.14.0";
suggests "Cpanel::JSON::XS" => "4.38";
suggests "IO::Socket::IP" => "0.32";
suggests "IO::Socket::SSL" => "1.56";
suggests "JSON::PP" => "4.11";
suggests "Neo4j::Bolt" => "0.5000";
suggests "Net::SSLeay" => "1.49";
on 'test' => sub {
requires "Neo4j::Types" => "2.00";
requires "Test2::V0" => "0";
requires "Test::Exception" => "0";
requires "Test::More" => "0.94";
requires "Test::Neo4j::Types" => "0.03";
lib/Neo4j/Driver.pm view on Meta::CPAN
available. HTTP is still fast enough for many use cases and
works even in a "Pure Perl" environment. It may also be
quicker than Bolt to add support for future changes in Neo4j.
HTTP connections will use B<Jolt> (JSON Bolt) when offered by the server.
For older Neo4j servers (before S<version 4.2>), the driver
will automatically fall back to slower REST-style JSON.
The driver also supports encrypted communication using HTTPS,
but doesn't bundle the necessary packages. You will need to
install L<IO::Socket::SSL> separately to enable HTTPS.
=back
The protocol is automatically chosen based on the URI scheme.
See L<Neo4j::Driver::Config/"uri"> for details.
Version 1 of Neo4j::Driver is targeting Perl v5.20 and later.
Patches will be accepted to address issues with Perl versions
as old as v5.16.3 for as long as practical.
lib/Neo4j/Driver/Config.pod view on Meta::CPAN
interpolations in Perl, which decreases database performance because
Neo4j can re-use query plans less often. It is also a potential
security risk (Cypher injection attacks). Using this config option
enables your code to use the safer C<{}> parameter syntax instead.
=head2 encrypted
$driver->config(encrypted => 1);
Specifies whether to use secure communication using TLS. This
L<implies|IO::Socket::SSL/"Essential Information About SSL/TLS">
not just encryption, but also verification of the server's identity.
By default, a trust store on the local system will be used to verify
the server's identity. This will fail unless your Neo4j installation
uses a key pair that is trusted and verifiable through the global
CA infrastructure. If that's not the case, you may need to
additionally use the C<trust_ca> option.
This option defaults to C<0> (no encryption). This is generally what
you want if you connect to a server on C<localhost>.
lib/Neo4j/Driver/Config.pod view on Meta::CPAN
since been deprecated, as it didn't match Neo4j terminology.
=head2 uri
$driver->config(uri => 'http://localhost:7474');
Specifies the Neo4j server connection URI. The URI scheme determines
the type of driver created. Supported schemes are C<bolt>, C<http>,
C<https>, and C<neo4j>.
Use of C<bolt> URIs requires L<Neo4j::Bolt> to be installed; use
of C<https> URIs requires L<IO::Socket::SSL> to be installed.
All URIs using the C<neo4j> scheme are interpreted either as C<bolt>
or as C<http>/C<https> URIs. The conditions that influence this
behaviour are unspecified for this driver and are subject to change.
Instead of relying on the C<neo4j> URI scheme, you should explicitly
select C<bolt> or C<http>/C<https>, as appropriate for your database
setup. No first-party implementation of client-side routing is
planned (but plug-ins might get a hook for it in a future version).
If a part of the URI or even the entire URI is missing, suitable
t/net-tiny.t view on Meta::CPAN
$m = Neo4j::Driver::Net::HTTP::Tiny->new( new_driver_config $config );
is $m->uri(), 'http://net.test/', 'uri no auth';
$config = { uri => $base, auth => { scheme => 'blackmagic' } };
like dies {
Neo4j::Driver::Net::HTTP::Tiny->new( new_driver_config $config );
}, qr/\bBasic Auth/i, 'new custom auth croaks';
};
subtest 'tls' => sub {
skip_all "(IO::Socket::SSL unavailable)" unless eval 'require IO::Socket::SSL; 1';
skip_all "(Net::SSLeay unavailable)" unless eval 'require Net::SSLeay; 1';
plan 8;
my $config;
try_ok {
$config = { uri => URI->new('https://e.net.test/'), encrypted => 1 };
$m = Neo4j::Driver::Net::HTTP::Tiny->new( new_driver_config $config );
} 'encrypted https';
like $m->uri(), qr|^https://e|i, 'encrypted https uri';
try_ok {
$config = { uri => URI->new('https://d.net.test/'), encrypted => undef };
$m = Neo4j::Driver::Net::HTTP::Tiny->new( new_driver_config $config );
} 'https';
like $m->uri(), qr|^https://d|i, 'https uri';
my $ca_file = eval { ({ IO::Socket::SSL::default_ca() })->{SSL_ca_file} };
SKIP: {
skip "(default CA file unavailable)", 4 unless $ca_file;
try_ok {
$config = { uri => URI->new('https://c.net.test/'), trust_ca => $ca_file };
$m = Neo4j::Driver::Net::HTTP::Tiny->new( new_driver_config $config );
} 'https trust_ca lives';
like $m->uri(), qr|^https://c|i, 'https trust_ca uri';
is $m->{http}->SSL_options->{SSL_ca_file}, $ca_file, 'https trust_ca';
ok $m->{http}->verify_SSL, 'https verify_SSL';
}
t/net-tiny.t view on Meta::CPAN
subtest 'tls config errors' => sub {
plan 2;
my $config;
like dies {
$config = { uri => $base, encrypted => 1 };
Neo4j::Driver::Net::HTTP::Tiny->new( new_driver_config $config );
}, qr/\bHTTP does not support encrypted communication\b/i, 'no encrypted http';
SKIP: {
skip "(IO::Socket::SSL unavailable)", 1 unless eval 'require IO::Socket::SSL; 1';
skip "(Net::SSLeay unavailable)", 1 unless eval 'require Net::SSLeay; 1';
like dies {
$config = { uri => URI->new('https://net.test/'), encrypted => 0 };
Neo4j::Driver::Net::HTTP::Tiny->new( new_driver_config $config );
}, qr/\bHTTPS does not support unencrypted communication\b/i, 'no unencrypted https';
}
};
done_testing;
( run in 0.524 second using v1.01-cache-2.11-cpan-4d50c553e7e )