| 1 | # ABSTRACT: ArangoDB Cursor object | ||||||||||||||||||||||||||||
| 2 | package Arango::Tango::Cursor; | ||||||||||||||||||||||||||||
| 3 | 9 | $Arango::Tango::Cursor::VERSION = '0.021'; | |||||||||||||||||||||||||||
| 4 | 9 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 9 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 0 | ▶ | sub _new { | ||||||||||||||||||||||||||
|
Subroutine
_new: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 10 | 0 | my ($class, %opts) = @_; | |||||||||||||||||||||||||||
| 11 | 0 | my $self = { arango => $opts{arango}, database => $opts{database} }; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 0 | my $ans = $self->{arango}->_api('create_cursor', \%opts); | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 0 | return bless { %$ans, %$self, __current => 0 } => $class; | |||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 0 | ▶ | sub next { | ||||||||||||||||||||||||||
|
Subroutine
next: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||
| 19 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 0 | ▶ | if (!$self->{error} && $self->{__current} == 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $self->{"error"} and $self->{"__current"} == 0
MC/DC0%0/2
not $self->{"error"} and $self->{"__current"} == 0
not $self->{"error"}
$self->{"__current"} == 0
Truth table0%0/3
not(A) and B
A= not $self->{"error"}B= $self->{"__current"} == 0
| |||||||||||||||||||||||||||||
| 22 | 0 | $self->{__current}++; | |||||||||||||||||||||||||||
| 23 | 0 | return $self->{result}; | |||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | if ($self->{hasMore}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | 0 | my $ans = $self->{arango}->_api('cursor_next', { database => $self->{database}, id => $self->{id} }); | |||||||||||||||||||||||||||
| 28 | 0 | ▶ | if (!$ans->{error}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | 0 | $self->{hasMore} = $ans->{hasMore}; | |||||||||||||||||||||||||||
| 30 | 0 | return $ans->{result}; | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | return undef; | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 0 | ▶ | sub finish { | ||||||||||||||||||||||||||
|
Subroutine
finish: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 38 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 39 | 0 | ▶ | if (exists($self->{id})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | 0 | $self->{arango}->_api('cursor_delete', { database => $self->{database}, id => $self->{id} }); | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | 0 | delete $self->{$_} for (keys %$self); | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 0 | ▶ | sub has_more { | ||||||||||||||||||||||||||
|
Subroutine
has_more: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 46 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 47 | 0 | return $self->{hasMore}; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 0 | ▶ | sub error { | ||||||||||||||||||||||||||
|
Subroutine
error: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 51 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 52 | 0 | return $self->{arango}->error; | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 9 | 1; | |||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | __END__ | ||||||||||||||||||||||||||||