Core/Interpreter/Interpreter.pm untested

filter: Statementstmt 0.0% 0 / 41 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 56 CC 2 SCAR 9.8
CC
2
Cov
0%
execute_
6.0
process
2.0
BEGIN
2.0
CRAP 2.7
1 package Javonet::Core::Interpreter::Interpreter;
2 use strict;
3 use warnings;
4 use lib 'lib';
5 use aliased 'Javonet::Core::Handler::PerlHandler' => 'PerlHandler';
6 use aliased 'Javonet::Core::Protocol::CommandSerializer' => 'CommandSerializer';
7 use aliased 'Javonet::Core::Protocol::CommandDeserializer' => 'CommandDeserializer';
8
9 use Exporter qw(import);
10 our @EXPORT = qw(execute_ process);
11
12 sub execute_ {
13 my ($class, $command, $connection_type, $tcp_address) = @_;
14 my @serialized_command = Javonet::Core::Protocol::CommandSerializer->serialize($command, $connection_type, $tcp_address, 0);
15 my $response_byte_array_ref;
16 if ($command->{runtime} eq Javonet::Sdk::Core::RuntimeLib::get_runtime('Perl')) {
17 require Javonet::Core::Receiver::Receiver;
18 $response_byte_array_ref = Javonet::Core::Receiver::Receiver->send_command(\@serialized_command);
19 } else {
20 require Javonet::Core::Transmitter::PerlTransmitter;
21 $response_byte_array_ref = Javonet::Core::Transmitter::PerlTransmitter->t_send_command(\@serialized_command);
22 }
23
24 return CommandDeserializer->deserialize($response_byte_array_ref);
25 }
26
27 sub process {
28 my ($class, $message_byte_array_ref) = @_;
29 my @message_byte_array = @$message_byte_array_ref;
30 my $command = CommandDeserializer->deserialize(\@message_byte_array);
31 my $response = PerlHandler->handle_command($command);
32 my @response_byte_array = CommandSerializer->serialize($response, 0, 0, 0);
33 return @response_byte_array;
34 }
35
36 1;