Makamaka Hannyaharamitu > JSON-RPC-0.96 > MyApp

Download:
JSON-RPC-0.96.tar.gz

Annotate this POD

CPAN RT

New  14
Open  2
View/Report Bugs
Source  

NAME ^

MyApp - sample JSON-RPC server class

DESCRIPTION ^

This module is a smple code (for Perl 5.6 or later). Please check the source.

PROCEDURES

echo

Takes a scalar and returns it as is.

now

Returns the current time.

sum

Takes two numbers and returns the total.

  sum : Number(a:num, b:num)

The two numbers are automatically set into 'a' and 'b'.

sum2

Takes two numbers and returns the total.

  sum2 : Public

This routine is a sample for both JSONRPC 1.1 and 1.0

sum3

Same as sum3 but its format is difference.

  sum3 : String(a, b)
sum4

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.

_allowable_procedure

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,
      };
  }

AUTHOR ^

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

COPYRIGHT AND LICENSE ^

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.

syntax highlighting: