NAME
    Perinci::Access::Simple::Client - Riap::Simple client

VERSION
    version 0.10

SYNOPSIS
     use Perinci::Access::Simple::Client;
     my $pa = Perinci::Access::Simple::Client->new;

     my $res;

     # to request server over TCP
     $res = $pa->request(call => 'riap+tcp://localhost:5678/Foo/Bar/func',
                         {args => {a1=>1, a2=>2}});

     # to request server over Unix socket (separate Unix socket path and Riap
     # request key 'uri' with an extra slash /)
     $res = $pa->request(call => 'riap+unix:/var/run/api.sock//Foo/Bar/func',
                         {args => {a1=>1, a2=>2}});

     # to request "server" (program) over pipe (separate program path and first
     # argument with an extra slash /, then separate each program argument with
     # slashes, finally separate last program argument with Riap request key 'uri'
     # with an extra slash /). Arguments are URL-escaped so they can contain slashes
     # if needed (in the encoded form of %2F).
     $res = $pa->request(call => 'riap+pipe:/path/to/prog//arg1/arg2//Foo/Bar/func',
                         {args => {a1=>1, a2=>2}});

     # accessing a remote program via SSH client
     use URI::Escape;
     $res = $pa->request(call => 'riap+pipe:ssh/-T/' .
                                 uri_escape('user@host') .
                                 '/'.uri_escape('/path/to/program') .
                                 '/'.uri_escape('first arg') .
                                 '/'.uri_escape('second arg') .
                                 '//Foo/Bar/func',
                         {args => {a1=>1, a2=>2}});

DESCRIPTION
    This class implements Riap::Simple client. It supports the 'riap+tcp',
    'riap+unix', and 'riap+pipe' schemes for a variety of methods to access
    the server: either via TCP (where the server can be on a remote
    computer), Unix socket, or a program (where the program can also be on a
    remote computer, e.g. accessed via ssh).

    This class uses Log::Any for logging.

METHODS
  PKG->new(%attrs) => OBJ
    Instantiate object. Known attributes:

    *   retries => INT (default 2)

        Number of retries to do on network failure. Setting it to 0 will
        disable retries.

    *   retry_delay => INT (default 3)

        Number of seconds to wait between retries.

  $pa->request($action => $server_url, \%extra) => $res
    Send Riap request to $server_url.

SEE ALSO
    Perinci::Access::Simple::Server

    Riap::Simple, Riap, Rinci

AUTHOR
    Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE
    This software is copyright (c) 2013 by Steven Haryanto.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.

