| line | stmt | bran | cond | sub | pod | time | code | 
| 1 | 17 |  |  | 17 |  | 312 | use 5.010; | 
|  | 17 |  |  |  |  | 55 |  | 
| 2 | 17 |  |  | 17 |  | 95 | use strict; | 
|  | 17 |  |  |  |  | 36 |  | 
|  | 17 |  |  |  |  | 388 |  | 
| 3 | 17 |  |  | 17 |  | 75 | use warnings; | 
|  | 17 |  |  |  |  | 29 |  | 
|  | 17 |  |  |  |  | 408 |  | 
| 4 | 17 |  |  | 17 |  | 103 | use utf8; | 
|  | 17 |  |  |  |  | 54 |  | 
|  | 17 |  |  |  |  | 97 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | package Neo4j::Driver::ResultColumns; | 
| 7 |  |  |  |  |  |  | # ABSTRACT: Structure definition of Cypher result values | 
| 8 |  |  |  |  |  |  | $Neo4j::Driver::ResultColumns::VERSION = '0.39'; | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | # This package is not part of the public Neo4j::Driver API. | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  |  | 
| 13 | 17 |  |  | 17 |  | 1159 | use Carp qw(croak); | 
|  | 17 |  |  |  |  | 37 |  | 
|  | 17 |  |  |  |  | 5920 |  | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | sub new { | 
| 17 | 225 |  |  | 225 | 0 | 530 | my ($class, $result) = @_; | 
| 18 |  |  |  |  |  |  |  | 
| 19 | 225 | 100 | 66 |  |  | 1066 | croak 'Result missing columns' unless $result && $result->{columns}; | 
| 20 | 224 |  |  |  |  | 349 | my $columns = $result->{columns}; | 
| 21 | 224 |  |  |  |  | 379 | my $column_keys = {}; | 
| 22 | 224 |  |  |  |  | 666 | for (my $f = scalar(@$columns) - 1; $f >= 0; $f--) { | 
| 23 | 474 |  |  |  |  | 1334 | $column_keys->{$columns->[$f]} = $f; | 
| 24 |  |  |  |  |  |  | } | 
| 25 |  |  |  |  |  |  |  | 
| 26 | 224 |  |  |  |  | 674 | return bless $column_keys, $class; | 
| 27 |  |  |  |  |  |  | } | 
| 28 |  |  |  |  |  |  |  | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | sub key { | 
| 31 | 112 |  |  | 112 | 0 | 227 | my ($self, $key) = @_; | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | # returns the index [!] of the field specified by the given key | 
| 34 | 112 |  |  |  |  | 332 | return $self->{$key}; | 
| 35 |  |  |  |  |  |  | } | 
| 36 |  |  |  |  |  |  |  | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | sub list { | 
| 39 | 3 |  |  | 3 | 0 | 6 | my ($self) = @_; | 
| 40 | 3 |  |  |  |  | 44 | warnings::warnif deprecated => "Neo4j::Driver::Record->{column_keys} is deprecated"; | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | # returns the unordered list of keys | 
| 43 |  |  |  |  |  |  | # (prior to version 0.1701, the list was returned in the original order) | 
| 44 | 3 |  |  |  |  | 1117 | return keys %$self; | 
| 45 |  |  |  |  |  |  | } | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | sub add { | 
| 49 | 1 |  |  | 1 | 0 | 714 | my ($self, $column) = @_; | 
| 50 |  |  |  |  |  |  |  | 
| 51 | 1 |  |  |  |  | 3 | my $index = $self->count; | 
| 52 | 1 |  |  |  |  | 7 | $self->{$column} = $index; | 
| 53 | 1 |  |  |  |  | 4 | return $index; | 
| 54 |  |  |  |  |  |  | } | 
| 55 |  |  |  |  |  |  |  | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | sub count { | 
| 58 | 3 |  |  | 3 | 0 | 756 | my ($self) = @_; | 
| 59 |  |  |  |  |  |  |  | 
| 60 | 3 |  |  |  |  | 7 | return scalar $self->list; | 
| 61 |  |  |  |  |  |  | } | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | 1; |