line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
17
|
|
|
17
|
|
303
|
use 5.010; |
|
17
|
|
|
|
|
57
|
|
2
|
17
|
|
|
17
|
|
92
|
use strict; |
|
17
|
|
|
|
|
64
|
|
|
17
|
|
|
|
|
405
|
|
3
|
17
|
|
|
17
|
|
77
|
use warnings; |
|
17
|
|
|
|
|
43
|
|
|
17
|
|
|
|
|
577
|
|
4
|
17
|
|
|
17
|
|
95
|
use utf8; |
|
17
|
|
|
|
|
36
|
|
|
17
|
|
|
|
|
120
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Neo4j::Driver::ServerInfo; |
7
|
|
|
|
|
|
|
# ABSTRACT: Provides Neo4j server address and version |
8
|
|
|
|
|
|
|
$Neo4j::Driver::ServerInfo::VERSION = '0.40'; |
9
|
|
|
|
|
|
|
|
10
|
17
|
|
|
17
|
|
1115
|
use Carp qw(croak); |
|
17
|
|
|
|
|
39
|
|
|
17
|
|
|
|
|
1409
|
|
11
|
|
|
|
|
|
|
our @CARP_NOT = qw(Neo4j::Driver::Session); |
12
|
17
|
|
|
17
|
|
125
|
use URI 1.25; |
|
17
|
|
|
|
|
247
|
|
|
17
|
|
|
|
|
7525
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
|
|
|
|
|
|
# uncoverable pod (private method) |
17
|
84
|
|
|
84
|
0
|
20194
|
my ($class, $server_info) = @_; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# don't store the full URI here - it may contain auth credentials |
20
|
84
|
|
|
|
|
334
|
$server_info->{uri} = URI->new( $server_info->{uri} )->host_port; |
21
|
|
|
|
|
|
|
|
22
|
84
|
|
|
|
|
9251
|
return bless $server_info, $class; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
2
|
1
|
857
|
sub address { shift->{uri} } |
27
|
169
|
|
|
169
|
1
|
2419
|
sub agent { shift->{version} } |
28
|
4
|
|
|
4
|
1
|
1418
|
sub version { shift->{version} } |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub protocol_version { |
32
|
|
|
|
|
|
|
shift->{protocol} |
33
|
3
|
|
|
3
|
1
|
2268
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub protocol { |
37
|
|
|
|
|
|
|
# uncoverable pod (see Deprecations.pod) |
38
|
4
|
|
|
4
|
0
|
2312
|
my ($self) = @_; |
39
|
4
|
|
|
|
|
61
|
warnings::warnif deprecated => __PACKAGE__ . "->protocol() is deprecated; use protocol_version() instead"; |
40
|
4
|
|
|
|
|
1020
|
my $bolt_version = $self->{protocol}; |
41
|
4
|
100
|
|
|
|
23
|
return "Bolt/$bolt_version" if $bolt_version; |
42
|
3
|
100
|
|
|
|
25
|
return defined $bolt_version ? "Bolt" : "HTTP"; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# discover default database on Neo4j >= 4 using the given driver config |
47
|
|
|
|
|
|
|
sub _default_database { |
48
|
83
|
|
|
83
|
|
2771
|
my ($self, $driver) = @_; |
49
|
|
|
|
|
|
|
|
50
|
83
|
|
|
|
|
169
|
my $database = $self->{default_database}; |
51
|
83
|
100
|
|
|
|
289
|
return $database if defined $database; |
52
|
|
|
|
|
|
|
|
53
|
51
|
100
|
|
|
|
234
|
return if $self->{version} =~ m{^Neo4j/[123]\.}; |
54
|
47
|
|
|
|
|
99
|
eval { |
55
|
47
|
|
|
|
|
196
|
my $sys = $driver->session(database => 'system'); |
56
|
47
|
|
|
|
|
258
|
$database = $sys->run('SHOW DEFAULT DATABASE')->single->get('name'); |
57
|
|
|
|
|
|
|
}; |
58
|
47
|
100
|
|
|
|
6138
|
croak $@ . "Session creation failed because the default " |
59
|
|
|
|
|
|
|
. "database of $self->{version} at $self->{uri} " |
60
|
|
|
|
|
|
|
. "could not be determined" unless defined $database; |
61
|
44
|
|
|
|
|
165
|
return $self->{default_database} = $database; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |