| 1 | package Data::RuledCluster::Strategy::Formatted; | ||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use parent 'Data::RuledCluster::Strategy'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use Data::Util qw(is_number neat); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use Carp (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 8 | ▶ | sub resolve { | ||||||||
|
Subroutine
resolve: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||
| 9 | 8 | my ( $class, $resolver, $node_or_cluster, $args ) = @_; | |||||||||
| 10 | |||||||||||
| 11 | 8 | my @keys = $class->keys_from_args($args); | |||||||||
| 12 | 8 | my $key = shift @keys; | |||||||||
| 13 | |||||||||||
| 14 | 8 | ▶ | unless ( is_number($key) ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | 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 | ▶ | or Carp::croak('node_format settings must be required'); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | |||||||||||
| 23 | 7 | my @nodes = $resolver->clusters($node_or_cluster); | |||||||||
| 24 | 7 | my $expected_node = sprintf($node_format, $key); | |||||||||
| 25 | 7 | ▶ | unless (grep {$_ eq $expected_node} @nodes) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 1 | Carp::croak(sprintf('%s node is not exists', $expected_node)); | |||||||||
| 27 | } | ||||||||||
| 28 | 6 | return ($expected_node, @keys); | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 1 | 1; | |||||||||
| 32 | |||||||||||
| 33 | __END__ | ||||||||||