RuledCluster/Strategy/Formatted.pm

filter: Statementstmt 96.4% 27 / 28 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 92.6% 38 / 41 CC 4 SCAR 8.5
CC
4
Cov
94%
resolve
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.3
« RuledCluster/Strategy.pm ↑ Summary RuledCluster/Strategy/Key.pm »
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
BranchTrueFalseTotal
unless (is_number($key)) 0 8 8
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
BranchTrueFalseTotal
my $node_format = $args->{"node_format"} or Carp::croak("node_format settings must be required") 7 1 8
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
BranchTrueFalseTotal
unless (grep {$_ eq $expected_node;} @nodes) 1 6 7
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__
« RuledCluster/Strategy.pm ↑ Summary RuledCluster/Strategy/Key.pm »