OFun/Hailo.pm untested

filter: Statementstmt 0.0% 0 / 24 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 35 CC 1 SCAR 6.9
CC
1
Cov
0%
_build_hailo
2.0
learn_and_reply
2.0
learn
2.0
CRAP 2.0
1 package Bot::Backbone::Service::OFun::Hailo;
2 $Bot::Backbone::Service::OFun::Hailo::VERSION = '0.142230';
3 use Bot::Backbone::Service;
4  
5 with qw(
6 Bot::Backbone::Service::Role::Service
7 Bot::Backbone::Service::Role::Responder
8 );
9  
10 use MooseX::Types::Path::Class;
11 use Hailo;
12  
13 # ABSTRACT: Talk to your bot and it talks back
14  
15  
16 service_dispatcher as {
17 to_me spoken respond_by_method 'learn_and_reply';
18 also not_command spoken not_to_me run_this_method 'learn';
19 };
20  
21  
22 has brain_file => (
23 is => 'ro',
24 isa => 'Path::Class::File',
25 required => 1,
26 coerce => 1,
27 );
28  
29  
30 has hailo => (
31 is => 'ro',
32 isa => 'Hailo',
33 lazy_build => 1,
34 );
35  
36 sub _build_hailo {
37 my $self = shift;
38  
39 my $brain_file = $self->brain_file;
40 return Hailo->new(
41 brain => "$brain_file",
42 );
43 }
44  
45  
46 sub learn_and_reply {
47 my ($self, $message) = @_;
48 return $self->hailo->learn_reply($message->text);
49 }
50  
51  
52 sub learn {
53 my ($self, $message) = @_;
54 return $self->hailo->learn($message->text);
55 }
56  
57  
58 sub initialize { }
59  
60 __PACKAGE__->meta->make_immutable;
61  
62 __END__