| 1 | package MR::Tarantool::Box::Singleton; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | MR::Tarantool::Box::Singleton - A singleton wrapper for L<MR::Tarantool::Box>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | Provides connection-persistence and replica fallback. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | Please read L<"MR::Tarantool::Box manual"|MR::Tarantool::Box> first. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | package Some::Tarantool::Box::Singleton; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | use MR::Tarantool::Box::Singleton; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | use base 'MR::Tarantool::Box::Singleton'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | BEGIN { # generates "TUPLE_$field_name" constants, and methods: FIELDS, FIELDS_HASH | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | __PACKAGE__->mkfields(qw/ id f1 f2 f3 field4 f5 f6 f7 misc_string /); # applicable for DEFAULT_SPACE only | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | sub SERVER { Some::Config->GetBoxServer() } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | sub REPLICAS { Some::Config->GetBoxReplicas() } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | sub DEFAULT_SPACE { 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | sub SPACES {[{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | space => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | indexes => [ { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | index_name => 'primary_id', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | keys => [TUPLE_id], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | index_name => 'secondary_f1f2', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | keys => [TUPLE_f1, TUPLE_f2], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | }, ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | format => 'QqLlSsCc&', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | default_index => 'primary_id', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | }, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | space => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | indexes => [ { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | index_name => 'primary_id', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | keys => [0], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | }, ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | format => '&&&&', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | fields => [qw/ string1 str2 s3 s4 /], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | }]} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | =head2 METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 1 | ▶ | use MR::Tarantool::Box; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 1 | ▶ | use Class::Singleton; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 1 | ▶ | use Carp qw/confess cluck/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 1 | ▶ | use List::Util qw/shuffle/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 1 | ▶ | use base qw/Class::Singleton/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | =head3 mkfields | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | $CLASS->mkfields(@names); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | =item * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | Generates constants "TUPLE_$fieldname" => $fieldposition in C<$CLASS>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | Just Like if you say C<< use constant TUPLE_id => 0, TUPLE_f1 => 1, ...; >> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | =item * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | Generates C<$CLASS> variable C<< @fields >> containing field names, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | and a C<$CLASS> method C<FIELDS> returning C<< @fields >>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | =item * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | Generates C<$CLASS> variable C<< %fields >> containing field names mapping to positions, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | and a C<$CLASS> method C<FIELDS_HASH> returning C<< \%fields >>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | =item * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | These C<< @fields >> are applied to the C<< DEFAULT_SPACE >>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | if I<< fields >> were not set explicitly for that space. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | sub _mkfields { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_mkfields: not called CC=3 SCAR=20.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | my($class, $f, $F, @fields) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | confess "$f are already defined for $class" if @{"${class}::${f}"}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | @{"${class}::${f}"} = @fields; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | %{"${class}::${f}"} = map { $fields[$_] => $_ } 0..$#fields; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | eval qq{ sub ${class}::${F}TUPLE_$fields[$_] () { $_ } } for 0..$#fields; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | eval qq{ sub ${class}::${F}FIELDS () { \@${class}::${f} } }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | eval qq{ sub ${class}::${F}FIELDS_HASH () { \\\%${class}::${f} } }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | sub mkfields { $_[0]->_mkfields('fields', '', @_[1..$#_]) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mkfields: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | sub mklongfields { $_[0]->_mkfields('long_fields', 'LONG_', @_[1..$#_]) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mklongfields: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | =head3 declare_stored_procedure | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | $CLASS->declare_stored_procedure(%args); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | $CLASS->declare_stored_procedure( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | name => "box.do.something", # internal procedure name, in da box | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | method_name => "CallMyTestingStoredProcedure", # will generate method named | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | options => { default => options }, # MR::Tarantool::Box->Call \%options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | params => [ qw{ P1 P2 P3 Param4 }], # names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | unpack_format => "&LSC(L$)*", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | params_format => [qw{ C S L a* }], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | params_default => [ 1, 2, undef, 'the_default' ], # undef's are mandatory params | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | my $data = $CLASS->CallMyTestingStoredProcedure( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | P1 => $val1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | P2 => $val2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | P3 => $val3, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | Param4 => $val3, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | { option => $value }, # optional | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | ) or warn $CLASS->ErrorStr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | Declare a stored procedure. This generates C<$CLASS> method C<< $args{method_name} >> which | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | calls Tarantool/Box procedure C<< $args{name} >>, using C<< $args{options} >> as default | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | C<< \%options >> for C<< MR::Tarantool::Box->Call >> call. The generated method has the following | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | prototype: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | $CLASS->CallMyTestingStoredProcedure( %sp_params, \%optional_options ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | Parameters description: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | =item B<%args>: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | =item B<name> => $tarantool_box_sp_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | The name of procedure in Tarantool/Box to call. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | =item B<method_name> => $class_method_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | Class method name to generate. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | =item B<options> => \%options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | Options to pass to L<MR::Taranatool::Box->Call|MR::Taranatool::Box/Call> method. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | =item B<params> => \@names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | Procedure input parameters' names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | =item B<params_default> => \@defaults | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | Procedure input parameters default values. Undefined or absent value makes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | its parameter mandatory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | =item B<params_format> => \@format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | C<< pack() >>-compatible format to pack input parameters. Must match C<params>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | =item B<unpack_format> => $format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | C<< pack() >>-compatible format to unpack procedure output. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | =item B<%sp_params>: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | C<< Name => $value >> pairs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | =item B<%optional_options>: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | Options to pass to L<MR::Taranatool::Box->Call|MR::Taranatool::Box/Call> method. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | This overrides C<< %options >> values key-by-key. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | sub declare_stored_procedure { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
declare_stored_procedure: not called CC=28 SCAR=66.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | my($class, %opts) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | my $name = delete $opts{name} or confess "No `name` given"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | my $options = $opts{options} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$opts{'options'} || {}
MC/DC0%0/1
$opts{'options'} || {}
$opts{'options'}
Truth table0%0/2
A
A= $opts{'options'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | ▶ | confess "no `params` given; it must be an arrayref" if !exists $opts{params} or ref $opts{params} ne 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not exists $opts{"params"} or ref $opts{"params"} ne "ARRAY"
MC/DC0%0/2
not exists $opts{"params"} or ref $opts{"params"} ne "ARRAY"
not exists $opts{"params"}
ref $opts{"params"} ne "ARRAY"
Truth table0%0/3
not(A) or B
A= not exists $opts{"params"}B= ref $opts{"params"} ne "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | my @params = @{$opts{params}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | my $pack; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | if(my $fn = $opts{pack}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | confess "`params_format` and `params_default` are not applicable while `pack` is in use" if exists $opts{params_format} or exists $opts{params_default}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $opts{"params_format"} or exists $opts{"params_default"}
MC/DC0%0/2
exists $opts{"params_format"} or exists $opts{"params_default"}
exists $opts{"params_format"}
exists $opts{"params_default"}
Truth table0%0/3
A or B
A= exists $opts{"params_format"}B= exists $opts{"params_default"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | ▶ | if(ref $fn) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | confess "`pack` can be code ref or a method name, nothing else" unless ref $fn eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | $pack = $fn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | confess "`pack` method $fn is not provided by class ${class}" unless $class->can($fn); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | ▶ | $pack = sub { $class->$fn(@_) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | confess "no `pack` nor `params_format` given; it must be an arrayref with number of elements exactly as in `params`" if !exists $opts{params_format} or ref $opts{params_format} ne 'ARRAY' or @{$opts{params_format}} != @params; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not exists $opts{"params_format"} or ref $opts{"params_format"} ne "ARRAY" or @{$opts{"params_format"};} != @params
not exists $opts{"params_format"} or ref $opts{"params_format"} ne "ARRAY"
MC/DC0%0/3
not exists $opts{"params_format"} or ref $opts{"params_format"} ne "ARRAY" or @{$opts{"params_format"};} != @params
not exists $opts{"params_format"}
ref $opts{"params_format"} ne "ARRAY"
@{$opts{"params_format"};} != @params
Truth table0%0/4
not(A) or B or C
A= not exists $opts{"params_format"}B= ref $opts{"params_format"} ne "ARRAY"C= @{$opts{"params_format"};} != @params
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | confess "`params_default` is given but it must be an arrayref with number of elements no more then in `params`" if exists $opts{params_format} and (ref $opts{params_format} ne 'ARRAY' or @{$opts{params_format}} > @params); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
exists $opts{"params_format"} and ref $opts{"params_format"} ne "ARRAY" || @{$opts{"params_format"};} > @params
ref $opts{"params_format"} ne "ARRAY" or @{$opts{"params_format"};} > @params
MC/DC0%0/3
exists $opts{"params_format"} and ref $opts{"params_format"} ne "ARRAY" || @{$opts{"params_format"};} > @params
exists $opts{"params_format"}
ref $opts{"params_format"} ne "ARRAY"
@{$opts{"params_format"};} > @params
Truth table0%0/4
A and B or C
A= exists $opts{"params_format"}B= ref $opts{"params_format"} ne "ARRAY"C= @{$opts{"params_format"};} > @params
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | my @fmt = @{$opts{params_format}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | my @def = @{$opts{params_default}||[]}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$opts{'params_default'} || []
MC/DC0%0/1
$opts{'params_default'} || []
$opts{'params_default'}
Truth table0%0/2
A
A= $opts{'params_default'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | ▶ | $pack = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | my $p = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | for my $i (0..$#params) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | ▶ | $p->[$i] = $def[$i] if !defined$p->[$i] and $i < @def; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $p->[$i] and $i < @def
MC/DC0%0/2
not defined $p->[$i] and $i < @def
not defined $p->[$i]
$i < @def
Truth table0%0/3
not(A) and B
A= not defined $p->[$i]B= $i < @def
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | ▶ | confess "All params must be defined" unless defined $p->[$i]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | $p->[$i] = pack $fmt[$i], $p->[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | return $p; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | my $unpack; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | if(my $fn = $opts{unpack}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | if(ref $fn) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | confess "`unpack` can be code ref or a method name, nothing else" unless ref $fn eq 'CODE'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | $unpack = $fn; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | confess "`unpack` method $fn is not provided by class ${class}" unless $class->can($fn); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | $unpack = sub { $class->$fn(@_) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | ▶ | if ($opts{unpack_raw}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | $options->{unpack} = $unpack; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | undef $unpack; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | $options->{unpack_format} = '&*'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | confess "no `unpack` nor `unpack_format` given" if !exists $opts{unpack_format}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | my $f = $opts{unpack_format}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | $f = join '', @$f if ref $f; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | $options->{unpack_format} = $f; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | ▶ | my $method = $opts{method_name} or confess "`method_name` not given"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | ▶ | confess "bad `method_name` $method" unless $method =~ m/^[a-zA-Z]\w*$/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 0 | my $fn = "${class}::${method}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | ▶ | confess "Method $method is already defined in class $class" if defined &{$fn}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | do { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | *$fn = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | ▶ | my $p0 = @_ && ref $_[-1] eq 'HASH' ? pop : {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@_ and ref $_[-1] eq "HASH"
MC/DC0%0/2
@_ and ref $_[-1] eq "HASH"
@_
ref $_[-1] eq "HASH"
Truth table0%0/3
A and B
A= @_B= ref $_[-1] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | my $param = { %$options, %$p0 }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | my ($class, %params) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | ▶ | my $res = $class->Call($name, $pack->([@params{@params}]), $param) or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | ▶ | return $res unless $unpack; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | return $unpack->($res); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | return $method; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | ▶ | sub Param { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Param: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | confess "bad Param call" unless $_[2]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | return $_[2] && @{$_[2]} && ref $_[2]->[-1] eq 'HASH' && pop @{$_[2]} || {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/11
$_[2] && @{$_[2];} && ref $_[2][-1] eq 'HASH' && pop @{$_[2];} || {}
$_[2] and @{$_[2];} and ref $_[2][-1] eq "HASH" and pop @{$_[2];}
$_[2] and @{$_[2];} and ref $_[2][-1] eq "HASH"
$_[2] and @{$_[2];}
MC/DC0%0/4
$_[2] && @{$_[2];} && ref $_[2][-1] eq 'HASH' && pop @{$_[2];} || {}
$_[2]
@{$_[2];}
ref $_[2][-1] eq "HASH"
pop @{$_[2];}
Truth table0%0/5
A and B and C and D
A= $_[2]B= @{$_[2];}C= ref $_[2][-1] eq "HASH"D= pop @{$_[2];}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | =head3 Configuration methods | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | =item B<SERVER> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | Must return a string of ip:port of I<master> server. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | =item B<REPLICAS> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | Must return a comma separated string of ip:port pairs of I<replica> servers (see L</is_replica>). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | Server is chosen from the list randomly. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | =item B<MR_TARANTOOL_BOX_CLASS> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | Must return name of the class implementing L<MR::Tarantool::Box> interface, or it's descendant. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | =item B<SPACES>, B<RAISE>, B<TIMEOUT>, B<SELECT_TIMEOUT>, B<RETRY>, B<SELECT_RETRY>, B<SOFT_RETRY>, B<DEBUG> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | See corresponding arguments of L<MR::Tarantool::Box->new|MR::Tarantool::Box/new> method. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | sub DEBUG () { 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | sub IPDEBUG () { 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | sub TIMEOUT () { 23 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | sub SELECT_TIMEOUT () { 2 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | sub RAISE () { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | sub RETRY () { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | sub SELECT_RETRY () { 3 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | sub SOFT_RETRY () { 3 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | sub RETRY_DELAY () { 1 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | ▶ | sub SERVER () { die } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
SERVER: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | ▶ | sub REPLICAS () { [] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
REPLICAS: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | sub MR_TARANTOOL_BOX_CLASS () { 'MR::Tarantool::Box' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | sub SPACES () { die } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
SPACES: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | sub DEFAULT_SPACE () { undef } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | sub _new_instance { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_new_instance: not called CC=22 SCAR=62.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | my ($class) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | ▶ | my ($config) = $class->can('_config') ? $class->_config : {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | ▶ | $config->{param} ||= {}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$config->{"param"} ||= {}
MC/DC0%0/1
$config->{"param"} ||= {}
$config->{"param"}
Truth table0%0/2
A
A= $config->{"param"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | ▶ | $config->{servers} ||= $class->SERVER; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$config->{"servers"} ||= $class->SERVER
MC/DC0%0/2
$config->{"servers"} ||= $class->SERVER
$config->{"servers"}
$class->SERVER
Truth table0%0/3
A ||= B
A= $config->{"servers"}B= $class->SERVER
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 0 | ▶ | $config->{param}->{name} ||= $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$config->{"param"}{"name"} ||= $class
MC/DC0%0/2
$config->{"param"}{"name"} ||= $class
$config->{"param"}{"name"}
$class
Truth table0%0/3
A ||= B
A= $config->{"param"}{"name"}B= $class
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | ▶ | $config->{param}->{spaces} ||= $class->SPACES; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$config->{"param"}{"spaces"} ||= $class->SPACES
MC/DC0%0/2
$config->{"param"}{"spaces"} ||= $class->SPACES
$config->{"param"}{"spaces"}
$class->SPACES
Truth table0%0/3
A ||= B
A= $config->{"param"}{"spaces"}B= $class->SPACES
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | ▶ | $config->{param}->{default_fields} ||= [ $class->FIELDS ] if $class->can('FIELDS'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$config->{"param"}{"default_fields"} ||= [$class->FIELDS]
MC/DC0%0/1
$config->{"param"}{"default_fields"} ||= [$class->FIELDS]
$config->{"param"}{"default_fields"}
Truth table0%0/2
A
A= $config->{"param"}{"default_fields"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | ▶ | $config->{param}->{default_long_fields}||= [ $class->LONG_FIELDS ] if $class->can('LONG_FIELDS'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$config->{"param"}{"default_long_fields"} ||= [$class->LONG_FIELDS]
MC/DC0%0/1
$config->{"param"}{"default_long_fields"} ||= [$class->LONG_FIELDS]
$config->{"param"}{"default_long_fields"}
Truth table0%0/2
A
A= $config->{"param"}{"default_long_fields"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | $config->{param}->{raise} = $class->RAISE unless defined $config->{param}->{raise}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | $config->{param}->{timeout} ||= $class->TIMEOUT; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$config->{"param"}{"timeout"} ||= $class->TIMEOUT
MC/DC0%0/2
$config->{"param"}{"timeout"} ||= $class->TIMEOUT
$config->{"param"}{"timeout"}
$class->TIMEOUT
Truth table0%0/3
A ||= B
A= $config->{"param"}{"timeout"}B= $class->TIMEOUT
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | ▶ | $config->{param}->{select_timeout} ||= $class->SELECT_TIMEOUT; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$config->{"param"}{"select_timeout"} ||= $class->SELECT_TIMEOUT
MC/DC0%0/2
$config->{"param"}{"select_timeout"} ||= $class->SELECT_TIMEOUT
$config->{"param"}{"select_timeout"}
$class->SELECT_TIMEOUT
Truth table0%0/3
A ||= B
A= $config->{"param"}{"select_timeout"}B= $class->SELECT_TIMEOUT
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 0 | ▶ | $config->{param}->{debug} ||= $class->DEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$config->{"param"}{"debug"} ||= $class->DEBUG
MC/DC0%0/2
$config->{"param"}{"debug"} ||= $class->DEBUG
$config->{"param"}{"debug"}
$class->DEBUG
Truth table0%0/3
A ||= B
A= $config->{"param"}{"debug"}B= $class->DEBUG
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | $config->{param}->{ipdebug} ||= $class->IPDEBUG; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$config->{"param"}{"ipdebug"} ||= $class->IPDEBUG
MC/DC0%0/2
$config->{"param"}{"ipdebug"} ||= $class->IPDEBUG
$config->{"param"}{"ipdebug"}
$class->IPDEBUG
Truth table0%0/3
A ||= B
A= $config->{"param"}{"ipdebug"}B= $class->IPDEBUG
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | ▶ | $config->{param}->{retry} ||= $class->RETRY; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$config->{"param"}{"retry"} ||= $class->RETRY
MC/DC0%0/2
$config->{"param"}{"retry"} ||= $class->RETRY
$config->{"param"}{"retry"}
$class->RETRY
Truth table0%0/3
A ||= B
A= $config->{"param"}{"retry"}B= $class->RETRY
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | $config->{param}->{select_retry} ||= $class->SELECT_RETRY; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$config->{"param"}{"select_retry"} ||= $class->SELECT_RETRY
MC/DC0%0/2
$config->{"param"}{"select_retry"} ||= $class->SELECT_RETRY
$config->{"param"}{"select_retry"}
$class->SELECT_RETRY
Truth table0%0/3
A ||= B
A= $config->{"param"}{"select_retry"}B= $class->SELECT_RETRY
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | ▶ | $config->{param}->{softretry} ||= $class->SOFT_RETRY; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$config->{"param"}{"softretry"} ||= $class->SOFT_RETRY
MC/DC0%0/2
$config->{"param"}{"softretry"} ||= $class->SOFT_RETRY
$config->{"param"}{"softretry"}
$class->SOFT_RETRY
Truth table0%0/3
A ||= B
A= $config->{"param"}{"softretry"}B= $class->SOFT_RETRY
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | ▶ | $config->{param}->{retry_delay} ||= $class->RETRY_DELAY; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$config->{"param"}{"retry_delay"} ||= $class->RETRY_DELAY
MC/DC0%0/2
$config->{"param"}{"retry_delay"} ||= $class->RETRY_DELAY
$config->{"param"}{"retry_delay"}
$class->RETRY_DELAY
Truth table0%0/3
A ||= B
A= $config->{"param"}{"retry_delay"}B= $class->RETRY_DELAY
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | ▶ | my $replicas = delete $config->{replicas} || $class->REPLICAS || []; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
delete $config->{'replicas'} || $class->REPLICAS || []
delete $config->{"replicas"} or $class->REPLICAS
MC/DC0%0/2
delete $config->{'replicas'} || $class->REPLICAS || []
delete $config->{"replicas"}
$class->REPLICAS
Truth table0%0/3
A or B
A= delete $config->{"replicas"}B= $class->REPLICAS
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | ▶ | $replicas = [ split /,/, $replicas ] unless ref $replicas eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | $class->CheckConfig($config); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | return bless { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | box => $class->MR_TARANTOOL_BOX_CLASS->new({ servers => $config->{servers}, %{$config->{param}} }), | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | replicas => [ map { $class->MR_TARANTOOL_BOX_CLASS->new({ servers => $_, %{$config->{param}} }) } shuffle @$replicas ], | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | sub CheckConfig {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
CheckConfig: not called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | =head3 Add, Insert, Replace, UpdateMulti, Delete | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | These methods operate on C<< SERVER >> only. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | See corresponding methods of L<MR::Tarantool::Box> class. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | =head3 Select, Call | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | These methods operate on C<< SERVER >> at first, and then B<may> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | try to query C<< REPLICAS >>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | See corresponding methods of L<MR::Tarantool::Box> class. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | These methods have additional C<< %options >> params: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | =item B<is_replica> => \$is_result_from_replica | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | If this option is set, then if the query to C<< SERVER >> fails, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | C<< REPLICAS >> will be queried one-by-one until query succeeds or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | the list ends, and C<< $is_result_from_replica >> will be set to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | C<< true >>, no matter whether any query succeeds or not. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 1 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=3 SCAR=21.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 1 | foreach my $method (qw/Insert UpdateMulti Delete Add Set Replace Bit Num AndXorAdd Update/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | ▶ | *$method = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=2.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | my ($class, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 0 | my $param = $class->Param($method, \@args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | my $self = $class->instance; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 0 | $self->{_last_box} = $self->{box}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | $self->{box}->$method(@args, $param); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 10 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 1 | foreach my $method (qw/Select SelectUnion Call/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 1 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | ▶ | *$method = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=22 SCAR=61.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | my ($class, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | my $param = $class->Param($method, \@args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | ▶ | if ($param->{format}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | my @F; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | my $F = $class->FIELDS_HASH; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | ▶ | my @format = ref $param->{format} eq 'ARRAY' ? @{$param->{format}} : %{$param->{format}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | ▶ | confess "Odd number of elements in format" if @format % 2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | $param->{format} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | ▶ | while( my ($field, $fmt) = splice(@format, 0, 2) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | ▶ | confess "Bad format for field `$field'" unless $fmt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | confess "Unknown field `$field'" unless exists $F->{$field}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | push @F, $field; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | ▶ | push @{$param->{format}}, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/4
$fmt->{"offset"} or 0
$fmt->{"length"} or 0
MC/DC0%0/1
$fmt->{"offset"} or 0
$fmt->{"offset"}
MC/DC0%0/1
$fmt->{"length"} or 0
$fmt->{"length"}
Truth table0%0/2
A
A= $fmt->{"offset"}
Truth table0%0/2
A
A= $fmt->{"length"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | field => $F->{$field}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | $fmt eq 'full' ? ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | full => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | ) : ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | offset => $fmt->{offset} || 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | length => (exists $fmt->{length} ? $fmt->{length}||0 : 'max'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | ▶ | $param->{hashify} = sub { $class->_hashify(\@F, @_) }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | ▶ | die "${class}\->${method}: is_replica must be a SCALARREF" if exists $param->{is_replica} && ref $param->{is_replica} ne 'SCALAR'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
exists $param->{"is_replica"} and ref $param->{"is_replica"} ne "SCALAR"
MC/DC0%0/2
exists $param->{"is_replica"} and ref $param->{"is_replica"} ne "SCALAR"
exists $param->{"is_replica"}
ref $param->{"is_replica"} ne "SCALAR"
Truth table0%0/3
A and B
A= exists $param->{"is_replica"}B= ref $param->{"is_replica"} ne "SCALAR"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | my $is_rep = delete $param->{is_replica}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | ▶ | $$is_rep = 0 if $is_rep; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | my $self = $class->instance; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | ▶ | my @rep = $is_rep ? @{ $self->{replicas} } : (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | my ($ret,@ret); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | ▶ | for(my $box = $self->{box}; $box; $box = shift @rep) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | $self->{_last_box} = $box; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | ▶ | if(wantarray) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | @ret = $box->$method(@args, $param); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | } elsif(defined wantarray) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | $ret = $box->$method(@args, $param); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | $box->$method(@args, $param); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | ▶ | last if !$box->Error or !$is_rep or !@rep; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$box->Error and $is_rep and @rep
$box->Error and $is_rep
MC/DC0%0/3
$box->Error and $is_rep and @rep
$box->Error
$is_rep
@rep
Truth table0%0/4
A and B and C
A= $box->ErrorB= $is_repC= @rep
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | ++$$is_rep; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | ▶ | return wantarray ? @ret : $ret; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 3 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | =head3 B<Error>, B<ErrorStr> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | Return error code or description (see <MR::Tarantool::Box|MR::Tarantool::Box/Error>). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | ▶ | sub Error { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Error: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | my ($class, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | $class->instance->{_last_box}->Error(@args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | ▶ | sub ErrorStr { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ErrorStr: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | my ($class, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | $class->instance->{_last_box}->ErrorStr(@args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | =pod | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | =head1 LICENCE AND COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | L<http://tarantool.org> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | L<MR::Tarantool::Box> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||