blib/lib/DR/Tnt.pm untested

filter: Statementstmt 0.0% 0 / 47 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 62 SCAR 17.9
CC
2
Cov
0%
tarantool
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 6.0
1 use utf8;
2 use strict;
3 use warnings;
4  
5 package DR::Tnt;
6 use base qw(Exporter);
7 our $VERSION = '0.21';
8 our @EXPORT = qw(tarantool);
9 use List::MoreUtils 'any';
10  
11 use Carp;
12 $Carp::Internal{ (__PACKAGE__) }++;
13  
14 sub tarantool {
15 my (%opts) = @_;
16  
17 my $driver = delete($opts{driver}) || 'sync';
18
19 unless (any { $driver eq $_ } 'sync', 'ae', 'async', 'coro') {
20 goto usage;
21 }
22  
23  
24 goto $driver;
25 sync:
26 require DR::Tnt::Client::Sync;
27 return DR::Tnt::Client::Sync->new(%opts);
28  
29 ae:
30 async:
31 require DR::Tnt::Client::AE;
32 return DR::Tnt::Client::AE->new(%opts);
33  
34 coro:
35 require DR::Tnt::Client::Coro;
36 return DR::Tnt::Client::Coro->new(%opts);
37  
38  
39 usage:
40 croak "Too few information about tarantool connection";
41 }
42  
43 1;
44  
45 __END__