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 11     11   9324 use strict;
  11         96  
  11         719  
4 11     11   183 use warnings;
  11         31  
  11         645  
5              
6 11     11   67 use PLS::JSON;
  11         13  
  11         2394  
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 112 my ($self) = @_;
25              
26             my %content = (
27             jsonrpc => '2.0',
28 38         136 %{$self}
  38         536  
29             );
30              
31 38         709 my $json = encode_json \%content;
32 38         365 return \$json;
33             } ## end sub serialize
34              
35             1;