| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Neo4j::Bolt::NeoValue; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
BEGIN { |
|
4
|
3
|
|
|
3
|
|
205704
|
our $VERSION = "0.4201"; |
|
5
|
3
|
|
|
|
|
962
|
require Neo4j::Bolt::CTypeHandlers; |
|
6
|
3
|
|
|
|
|
834
|
require Neo4j::Bolt::CResultStream; |
|
7
|
3
|
|
|
|
|
18
|
require XSLoader; |
|
8
|
3
|
|
|
|
|
2008
|
XSLoader::load(); |
|
9
|
|
|
|
|
|
|
} |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub of { |
|
12
|
0
|
|
|
0
|
1
|
|
my ($class, @args) = @_; |
|
13
|
0
|
|
|
|
|
|
my @ret; |
|
14
|
0
|
|
|
|
|
|
for (@args) { |
|
15
|
0
|
|
|
|
|
|
push @ret, $class->_new_from_perl($_); |
|
16
|
|
|
|
|
|
|
} |
|
17
|
0
|
|
|
|
|
|
return @ret; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub is { |
|
21
|
0
|
|
|
0
|
1
|
|
my ($class, @args) = @_; |
|
22
|
0
|
|
|
|
|
|
my @ret; |
|
23
|
0
|
|
|
|
|
|
for (@args) { |
|
24
|
0
|
|
|
|
|
|
push @ret, $_->_as_perl; |
|
25
|
|
|
|
|
|
|
} |
|
26
|
0
|
|
|
|
|
|
return @ret; |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
0
|
|
|
0
|
1
|
|
sub new {shift->of(@_)} |
|
30
|
0
|
|
|
0
|
1
|
|
sub are {shift->is(@_)} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 NAME |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Neo4j::Bolt::NeoValue - Container to hold Bolt-encoded values |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
use Neo4j::Bolt::NeoValue; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
$neo_int = Neo4j::Bolt::NeoValue->of( 42 ); |
|
41
|
|
|
|
|
|
|
$i = $neo_int->_as_perl; |
|
42
|
|
|
|
|
|
|
$neo_node = Neo4j::Bolt::NeoValue->of( |
|
43
|
|
|
|
|
|
|
bless { id => 1, |
|
44
|
|
|
|
|
|
|
labels => ['thing','chose'], |
|
45
|
|
|
|
|
|
|
properties => { |
|
46
|
|
|
|
|
|
|
texture => 'crunchy', |
|
47
|
|
|
|
|
|
|
consistency => 'gooey', |
|
48
|
|
|
|
|
|
|
}, |
|
49
|
|
|
|
|
|
|
}, 'Neo4j::Bolt::Node' ); |
|
50
|
|
|
|
|
|
|
if ($neo_node->_neotype eq 'Node') { |
|
51
|
|
|
|
|
|
|
print "Yep, that's a node all right." |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
%node = %{ Neo4j::Bolt::NeoValue->is($neo_node)->as_simple }; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
($h,$j) = Neo4j::Bolt::NeoValue->are($neo_node, $neo_int); |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
L is an interface to convert Perl values to |
|
61
|
|
|
|
|
|
|
Bolt protocol byte structures via |
|
62
|
|
|
|
|
|
|
L. It's |
|
63
|
|
|
|
|
|
|
useful for testing the package, but you may find it useful in other |
|
64
|
|
|
|
|
|
|
ways. |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 METHODS |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=over |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item of($thing), new($thing) |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Class method. Creates a NeoValue from a Perl scalar, arrayref, or |
|
73
|
|
|
|
|
|
|
hashref. |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item _as_perl() |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Returns a Perl scalar, arrayref, or hashref representing the underlying |
|
78
|
|
|
|
|
|
|
Bolt data stored in the object. |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item _neotype() |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Returns a string indicating the type of object that |
|
83
|
|
|
|
|
|
|
L thinks |
|
84
|
|
|
|
|
|
|
the Bolt data represents. |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item is($neovalue), are(@neovalues) |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Class method. Syntactic sugar; runs L"_as_perl()"> on the arguments. |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=back |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 AUTHOR |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Mark A. Jensen |
|
95
|
|
|
|
|
|
|
CPAN: MAJENSEN |
|
96
|
|
|
|
|
|
|
majensen -at- cpan -dot- org |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 LICENSE |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
This software is Copyright (c) 2019-2021 by Mark A. Jensen. |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
This is free software, licensed under: |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
The Apache License, Version 2.0, January 2004 |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
1; |
|
112
|
|
|
|
|
|
|
|