
MyApp - sample JSON-RPC server class

This module is a smple code (for Perl 5.6 or later). Please check the source.
Takes a scalar and returns it as is.
Returns the current time.
Takes two numbers and returns the total.
sum : Number(a:num, b:num)
The two numbers are automatically set into 'a' and 'b'.
Takes two numbers and returns the total.
sum2 : Public
This routine is a sample for both JSONRPC 1.1 and 1.0
Same as sum3 but its format is difference.
sum3 : String(a, b)
This is a private procedure, so client can't call this.
sum4 : Private
This is a reserved procedure returns a Service Description object.
See to http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html#ServiceDescription.
If you change the name into allowable_procedure, clients are able to call echo and sum only.
allowable_procedure is a special name and the method returns a hash reference contains procedure names and its code reference.
sub allowable_procedure {
return {
echo => \&echo,
sum => \&sum,
};
}

Makamaka Hannyaharamitu, <makamaka[at]cpan.org>

Copyright 2008 by Makamaka Hannyaharamitu
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.