File Coverage

blib/lib/PLS/Server/Message.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 18 19 94.7


line stmt bran cond sub pod time code
1             package PLS::Server::Message;
2              
3 9     9   3013 use strict;
  9         18  
  9         209  
4 9     9   36 use warnings;
  9         9  
  9         164  
5              
6 9     9   36 use PLS::JSON;
  9         17  
  9         847  
7              
8             =head1 NAME
9              
10             PLS::Server::Message
11              
12             =head1 DESCRIPTION
13              
14             This class is the abstract base class for all messages sent between
15             server and client.
16              
17             See L<PLS::Server::Request> and L<PLS::Server::Response>, which
18             inherit from this class.
19              
20             =cut
21              
22             sub serialize
23             {
24 38     38 0 107 my ($self) = @_;
25              
26             my %content = (
27             jsonrpc => '2.0',
28 38         97 %{$self}
  38         324  
29             );
30              
31 38         477 my $json = encode_json \%content;
32 38         152 return \$json;
33             } ## end sub serialize
34              
35             1;