| 1 | package Algorithm::BestChoice::Ranker; | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use Moose; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use Scalar::Util qw/looks_like_number/; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||
| 7 | 10 | ▶ | sub parse { | ||||||||||||||||||||||||||||||
|
Subroutine
parse: called CC=5 SCAR=19.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 8 | 10 | my $class = shift; | |||||||||||||||||||||||||||||||
| 9 | 10 | my $ranker = shift; | |||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||
| 11 | 10 | ▶ | return Algorithm::BestChoice::Ranker::Value->new( value => 0 ) unless defined $ranker; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||
| 13 | 8 | ▶ | if (ref $ranker eq '' && looks_like_number $ranker) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
ref $ranker eq "" and &looks_like_number($ranker)
MC/DC0%0/2
ref $ranker eq "" and &looks_like_number($ranker)
ref $ranker eq ""
&looks_like_number($ranker)
Truth table33%1/3
A and B
A= ref $ranker eq ""B= &looks_like_number($ranker)
| |||||||||||||||||||||||||||||||||
| 14 | 8 | return Algorithm::BestChoice::Ranker::Value->new( value => $ranker ); | |||||||||||||||||||||||||||||||
| 15 | } | ||||||||||||||||||||||||||||||||
| 16 | elsif (ref $ranker eq 'CODE') { | ||||||||||||||||||||||||||||||||
| 17 | 0 | return Algorithm::BestChoice::Ranker::Code->new( code => $ranker ); | |||||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||
| 20 | 0 | die "Don't understand ranker $ranker"; | |||||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | sub rank { | ||||||||||||||||||||||||||||||
|
Subroutine
rank: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 24 | 0 | die "Unspecific ranker can't rank"; | |||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||
| 27 | package Algorithm::BestChoice::Ranker::Value; | ||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||
| 29 | 3 | ▶ | use Moose; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||
| 31 | 3 | extends qw/Algorithm::BestChoice::Ranker/; | |||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||
| 33 | 3 | has value => qw/is ro required 1 isa Num/; | |||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||
| 35 | 27 | ▶ | sub rank { | ||||||||||||||||||||||||||||||
|
Subroutine
rank: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 36 | 27 | my $self = shift; | |||||||||||||||||||||||||||||||
| 37 | 27 | return $self->value; | |||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||
| 40 | package Algorithm::BestChoice::Ranker::Code; | ||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||
| 42 | 3 | ▶ | use Moose; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||
| 44 | 3 | extends qw/Algorithm::BestChoice::Ranker/; | |||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||
| 46 | 3 | has code => qw/is ro required 1 isa CodeRef/; | |||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | sub rank { | ||||||||||||||||||||||||||||||
|
Subroutine
rank: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 49 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||
| 50 | 0 | my $key = shift; | |||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||
| 52 | 0 | return $self->code( $key ); | |||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||
| 55 | 3 | 1; | |||||||||||||||||||||||||||||||