line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::RuledCluster::Strategy::Formatted; |
2
|
1
|
|
|
1
|
|
1292
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
59
|
|
3
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
55
|
|
4
|
1
|
|
|
1
|
|
817
|
use parent 'Data::RuledCluster::Strategy'; |
|
1
|
|
|
|
|
292
|
|
|
1
|
|
|
|
|
5
|
|
5
|
1
|
|
|
1
|
|
77
|
use Data::Util qw(is_number neat); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
124
|
|
6
|
1
|
|
|
1
|
|
13
|
use Carp (); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
320
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub resolve { |
9
|
8
|
|
|
8
|
0
|
15
|
my ( $class, $resolver, $node_or_cluster, $args ) = @_; |
10
|
|
|
|
|
|
|
|
11
|
8
|
|
|
|
|
25
|
my @keys = $class->keys_from_args($args); |
12
|
8
|
|
|
|
|
10
|
my $key = shift @keys; |
13
|
|
|
|
|
|
|
|
14
|
8
|
50
|
|
|
|
28
|
unless ( is_number($key) ) { |
15
|
0
|
|
|
|
|
0
|
Carp::croak( |
16
|
|
|
|
|
|
|
sprintf('args has not key field or no number value (key: %s)', neat($key)) |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $node_format = $args->{node_format} |
21
|
8
|
100
|
|
|
|
118
|
or Carp::croak('node_format settings must be required'); |
22
|
|
|
|
|
|
|
|
23
|
7
|
|
|
|
|
19
|
my @nodes = $resolver->clusters($node_or_cluster); |
24
|
7
|
|
|
|
|
32
|
my $expected_node = sprintf($node_format, $key); |
25
|
7
|
100
|
|
|
|
11
|
unless (grep {$_ eq $expected_node} @nodes) { |
|
21
|
|
|
|
|
63
|
|
26
|
1
|
|
|
|
|
245
|
Carp::croak(sprintf('%s node is not exists', $expected_node)); |
27
|
|
|
|
|
|
|
} |
28
|
6
|
|
|
|
|
27
|
return ($expected_node, @keys); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__END__ |