blib/lib/auto/share/dist/Beekeeper/websocket/lib/MyApp/Service/Calculator.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 32 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
client
2.0
eval_expr
2.0
CRAP 2.0
1 package MyApp::Service::Calculator;
2  
3 use strict;
4 use warnings;
5  
6 use Beekeeper::Client;
7 use Beekeeper::Config;
8  
9  
10 sub new {
11 my $class = shift;
12  
13 my $self = {};
14  
15 my $config = Beekeeper::Config->read_config_file('client.config.json');
16  
17 # Connect to bus 'frontend', wich will forward requests to 'backend'
18 $self->{client} = Beekeeper::Client->instance(
19 bus_role => "frontend",
20 forward_to => 'backend',
21 %$config,
22 );
23  
24 bless $self, $class;
25 }
26  
27 sub client {
28 my $self = shift;
29  
30 return $self->{client};
31 }
32  
33 sub eval_expr {
34 my ($self, $str) = @_;
35  
36 my $resp = $self->client->call_remote(
37 method => 'myapp.calculator.eval_expr',
38 params => { expr => $str },
39 );
40  
41 return $resp->result;
42 }
43  
44 1;