Git Product home page Git Product logo

json-rpc-simple's Introduction

NAME
    JSON::RPC::Simple - Simple JSON-RPC client and dispatcher (WD 1.1 subset
    only currently)

SYNOPSIS
    As client

      use JSON::RPC::Simple;
      
  my $client = JSON::RPC::Simple->connect("https://www.example.com/API/", {
        timeout => 600,
      });
      my $r = $client->echo({ param1 => "value" });

    As server:

      package MyApp::API;
      
  use base qw(JSON::RPC::Simple);

      sub new { return bless {}, shift };
      
  sub echo : JSONRpcMethod(Arg1, Arg2, Arg3) {
        my ($self, $request, $args) = @_;
      }
          
  package MyApp::Handler;
      
  my $dispatcher = JSON::RPC::Simple->dispatch_to({
        "/API" => MyApp::API->new(),
        "/OtherAPI" => "MyApp::OtherAPI",
      });
      
  sub handle {
        my $request = shift; # Assume a HTTP::Request
        my $response = $dispatcher->handle($request->uri->path, $request);
        return $response; # Assume a HTTP::Response
      }

DESCRIPTION
    This module is a very simple JSON-RPC 1.1 WD implementation that only
    supports a subset of the specification.

    It supports

    HTTP POST only
    Named and positonal arguments
    Error objects

USAGE
  As a client
    This module provides a class method for creating a client that works as
    a shortcut to "JSON::RPC::Simple::Client->new(...)".

    connect(URL)
    connect(URL, \%OPTIONS)
        Returns a new client for the given *URL* with the optional
        *%OPTIONS*.

        See "options" in JSON::RPC::Simple::Client for what options it
        accepts.

AUTHOR
    Claes Jakobsson, <[email protected]>

THANKS & CONTRIBUTORS
	Scott Baker
	
COPYRIGHT AND LICENSE
    Copyright (C) 2010-2011 by Claes Jakobsson and Glue Finance AB

    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself, either Perl version 5.10.0 or, at
    your option, any later version of Perl 5 you may have available.

json-rpc-simple's People

Contributors

claesjac avatar scottchiefbaker avatar

Stargazers

 avatar  avatar

Watchers

 avatar James Cloos avatar

Forkers

scottchiefbaker

json-rpc-simple's Issues

Need a way to call namespaced methods

I don't see a way to call a namespaced method like cust.GetInfo() or billing.Invoice(). Is it possible to call a method with a period in the name? Or specify the namespace prior to the call?

Client.pm should accept an array, not a single value

In Client.pm line #60 it gets the params from from AUTOLOAD. That only allows you to send a single value (or a reference) to a method call. Thus if I had a method call like:

$obj->echo_data(2,4,6);

Only the 2 will get sent. I believe line #60 should be changed to @params

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.