| 1 | package Gideon::Driver; | ||||||||||||||||||||||||||||
| 2 | { | ||||||||||||||||||||||||||||
| 3 | 1 | $Gideon::Driver::VERSION = '0.0.3'; | |||||||||||||||||||||||||||
| 4 | } | ||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Gideon::Exceptions; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | #ABSTRACT: Gideon Driver Interface | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | requires qw(_find _update _update_object _remove _remove_object _insert_object); | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 0 | ▶ | sub find { | ||||||||||||||||||||||||||
|
Subroutine
find: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 13 | 0 | my ( $driver, $target, %query ) = @_; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 0 | my $order = delete $query{-order}; | |||||||||||||||||||||||||||
| 16 | 0 | $driver->_find( $target, \%query, $order ); | |||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 0 | ▶ | sub find_one { | ||||||||||||||||||||||||||
|
Subroutine
find_one: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 20 | 0 | my ( $driver, $target, %query ) = @_; | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 0 | my $order = delete $query{-order}; | |||||||||||||||||||||||||||
| 23 | 0 | $driver->_find( $target, \%query, $order, 1 )->[0]; | |||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | sub update { | ||||||||||||||||||||||||||
|
Subroutine
update: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 27 | 0 | my ( $driver, $target, %changes ) = @_; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 0 | my $is_object = ref $target; | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 0 | ▶ | Gideon::Exception::ObjectNotInStore->throw | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$is_object and not $target->__is_persisted
MC/DC0%0/2
$is_object and not $target->__is_persisted
$is_object
not $target->__is_persisted
Truth table0%0/3
A and not(B)
A= $is_objectB= not $target->__is_persisted
| |||||||||||||||||||||||||||||
| 32 | if $is_object and not $target->__is_persisted; | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | my $result = | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | $is_object | ||||||||||||||||||||||||||||
| 36 | ? $driver->_update_object( $target, \%changes ) | ||||||||||||||||||||||||||||
| 37 | : $driver->_update( $target, \%changes, {} ); | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | ▶ | return $target if $result; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 0 | ▶ | sub remove { | ||||||||||||||||||||||||||
|
Subroutine
remove: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 43 | 0 | my ( $driver, $target, %query ) = @_; | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 0 | my $is_object = ref $target; | |||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 0 | ▶ | Gideon::Exception::ObjectNotInStore->throw | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$is_object and not $target->__is_persisted
MC/DC0%0/2
$is_object and not $target->__is_persisted
$is_object
not $target->__is_persisted
Truth table0%0/3
A and not(B)
A= $is_objectB= not $target->__is_persisted
| |||||||||||||||||||||||||||||
| 48 | if $is_object and not $target->__is_persisted; | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 0 | ▶ | my $result = | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 51 | $is_object | ||||||||||||||||||||||||||||
| 52 | ? $driver->_remove_object($target) | ||||||||||||||||||||||||||||
| 53 | : $driver->_remove( $target, \%query ); | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 0 | ▶ | return $target if $result; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | ▶ | sub save { | ||||||||||||||||||||||||||
|
Subroutine
save: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 59 | 0 | my ( $class, $target ) = @_; | |||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 0 | my $is_object = ref $target; | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 0 | ▶ | Gideon::Exception::InvalidOperation->throw unless $is_object; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 0 | ▶ | my $result = | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | $target->__is_persisted | ||||||||||||||||||||||||||||
| 67 | ? $class->_update_object($target) | ||||||||||||||||||||||||||||
| 68 | : $class->_insert_object($target); | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 0 | ▶ | return $target if $result; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 1 | 1; | |||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | __END__ | ||||||||||||||||||||||||||||