File Coverage

lib/DR/Tnt.pm
Criterion Covered Total %
statement 18 32 56.2
branch 0 2 0.0
condition 0 2 0.0
subroutine 6 8 75.0
pod 1 1 100.0
total 25 45 55.5


line stmt bran cond sub pod time code
1 3     3   273249 use utf8;
  3         40  
  3         20  
2 3     3   79 use strict;
  3         5  
  3         59  
3 3     3   12 use warnings;
  3         4  
  3         192  
4              
5             package DR::Tnt;
6 3     3   15 use base qw(Exporter);
  3         4  
  3         751  
7             our $VERSION = '0.24';
8             our @EXPORT = qw(tarantool);
9 3     3   1475 use List::MoreUtils 'any';
  3         55370  
  3         17  
10              
11 3     3   2922 use Carp;
  3         5  
  3         720  
12             $Carp::Internal{ (__PACKAGE__) }++;
13              
14             sub tarantool {
15 0     0 1   my (%opts) = @_;
16              
17 0   0       my $driver = delete($opts{driver}) || 'sync';
18            
19 0 0   0     unless (any { $driver eq $_ } 'sync', 'ae', 'async', 'coro') {
  0            
20 0           goto usage;
21             }
22              
23              
24 0           goto $driver;
25 0           sync:
26             require DR::Tnt::Client::Sync;
27 0           return DR::Tnt::Client::Sync->new(%opts);
28              
29 0           ae:
30             async:
31 0           require DR::Tnt::Client::AE;
32 0           return DR::Tnt::Client::AE->new(%opts);
33              
34 0           coro:
35             require DR::Tnt::Client::Coro;
36 0           return DR::Tnt::Client::Coro->new(%opts);
37              
38              
39 0           usage:
40             croak "Too few information about tarantool connection";
41             }
42              
43             1;
44              
45             __END__