| 1 | package Gesture::Simple; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use Any::Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.008001; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Gesture::Simple::Gesture; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Gesture::Simple::Template; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | our $VERSION = '0.01'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use constant gesture_class => 'Gesture::Simple::Gesture'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | has templates => ( | ||||||||||||||||||||||||||||
| 13 | is => 'ro', | ||||||||||||||||||||||||||||
| 14 | isa => 'ArrayRef', | ||||||||||||||||||||||||||||
| 15 | 1 | ▶ | default => sub { [] }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 1 | auto_deref => 1, | |||||||||||||||||||||||||||
| 17 | ); | ||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 4 | ▶ | sub has_templates { @{ shift->templates } > 0 } | ||||||||||||||||||||||||||
|
Subroutine
has_templates: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 2 | ▶ | sub add_template { | ||||||||||||||||||||||||||
|
Subroutine
add_template: called CC=4 SCAR=14.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 22 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 2 | for (@_) { | |||||||||||||||||||||||||||
| 25 | 2 | ▶ | blessed($_) && $_->isa('Gesture::Simple::Template') | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
builtin::blessed($_) and $_->isa("Gesture::Simple::Template")
MC/DC0%0/2
builtin::blessed($_) and $_->isa("Gesture::Simple::Template")
builtin::blessed($_)
$_->isa("Gesture::Simple::Template")
Truth table33%1/3
A and B
A= builtin::blessed($_)B= $_->isa("Gesture::Simple::Template")
| |||||||||||||||||||||||||||||
| 26 | or confess "$_ is not a Gesture::Simple::Template."; | ||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 2 | push @{ $self->templates }, @_; | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 4 | ▶ | sub match { | ||||||||||||||||||||||||||
|
Subroutine
match: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 33 | 4 | my $self = shift; | |||||||||||||||||||||||||||
| 34 | 4 | my $gesture = shift; | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 4 | ▶ | confess "You have no templates to match against!" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | unless $self->has_templates; | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 4 | ▶ | $gesture = $self->gesture_class->new(points => $gesture) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | if !blessed($gesture); | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 3 | my @matches = sort { $b->score <=> $a->score } | |||||||||||||||||||||||||||
| 43 | 4 | map { $_->match($gesture) } | |||||||||||||||||||||||||||
| 44 | $self->templates; | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 4 | ▶ | return @matches if wantarray; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | 1 | return $matches[0]; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 51 | 1 | ▶ | no Any::Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 1 | 1; | |||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | __END__ | ||||||||||||||||||||||||||||