File Coverage

blib/lib/DBIx/DBHResolver/Strategy/Remainder.pm
Criterion Covered Total %
statement 9 14 64.2
branch 0 2 0.0
condition 0 3 0.0
subroutine 3 4 75.0
pod 1 1 100.0
total 13 24 54.1


line stmt bran cond sub pod time code
1             package DBIx::DBHResolver::Strategy::Remainder;
2              
3 1     1   7 use strict;
  1         2  
  1         39  
4 1     1   5 use warnings;
  1         2  
  1         29  
5 1     1   6 use Carp;
  1         1  
  1         227  
6              
7             our $VERSION = '0.10';
8              
9             sub connect_info {
10 0     0 1   my ( $class, $resolver, $node, $args ) = @_;
11 0 0 0       croak q|args has not 'key' field|
12             unless ( defined $args->{key} && $args->{key} =~ m/^\d+$/ );
13 0           my @nodes = $resolver->clusters($node);
14 0           my $resolved_node = $nodes[ $args->{key} % scalar @nodes ];
15 0           return $resolver->connect_info($resolved_node);
16             }
17              
18             1;
19              
20             =head1 NAME
21              
22             DBIx::DBHResolver::Strategy::Remainder - Deprecated
23              
24             =head1 SYNOPSIS
25              
26             =head1 DESCRIPTION
27              
28             DBIx::DBHResolver::Strategy::Remainder is now deprecated. Please use to L instead of this.
29              
30             =head1 METHOD
31              
32             =head2 connect_info( $resolver, $node, $args )
33              
34             =head1 AUTHOR
35              
36             Kosuke Arisawa Earisawa@gmail.comE
37              
38             =head1 SEE ALSO
39              
40             =over
41              
42             =item L
43              
44             =item L
45              
46             =item L
47              
48             =back
49              
50             =head1 LICENSE
51              
52             This library is free software; you can redistribute it and/or modify
53             it under the same terms as Perl itself.
54              
55             =cut