Alex Tokarev > RPC-ExtDirect-Client-0.2 > RPC::ExtDirect::Client

Download:
RPC-ExtDirect-Client-0.2.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.2   Source   Latest Release: RPC-ExtDirect-Client-0.22

NAME ^

RPC::ExtDirect::Client - Ext.Direct client in Perl

SYNOPSIS ^

 use RPC::ExtDirect::Client;
 
 my $client = RPC::ExtDirect::Client->new(host => 'localhost');
 my $result = $client->call(
    action  => 'Action',
    method  => 'Method',
    arg     => [ 'foo', 'bar' ],
    cookies => { foo => 'bar' },
 );

DESCRIPTION ^

This module implements Ext.Direct client in pure Perl. Its main purpose is to be used for testing server side Ext.Direct classes.

RPC::ExtDirect::Client uses HTTP::Tiny as transport.

METHODS ^

new(%params)

Creates a new client instance. Constructor accepts the following arguments:

api_path

URI for Ext.Direct API published by server. Default: '/api'.

router_path

URI for Ext.Direct remoting requests. Default: '/router'.

poll_path

URI for Ext.Direct events. Default: '/events'.

remoting_var

JavaScript variable name used to assign Ext.Direct remoting API object to. Default: 'Ext.app.REMOTING_API'.

polling_var

JavaScript variable name used to assign Ext.Direct polling API object to. Default: 'Ext.app.POLLING_API'.

cookies

Cookies to set when calling server side; can be either HTTP::Cookies object or a hashref containing key-value pairs. Setting this in constructor will pass the same cookies to all subsequent client calls.

%other

All other arguments are passed to HTTP::Tiny constructor. See HTTP::Tiny for more detail.

call(%params)

Calls Ext.Direct remoting method. Arguments are:

action

Ext.Direct Action (class) name

method

Ext.Direct Method name to call

arg

Ext.Direct Method arguments; use arrayref for methods that accept ordered parameters or hashref for named parameters.

cookies

Same as with constructor, but sets cookies for this particular call only.

Returns either call Result or Exception.

submit

Submits a form request to formHandler method. Arguments should be:

action

Ext.Direct Action (class) name

method

Ext.Direct Method name

arg

Method arguments; for formHandlers it should always be a hashref.

upload

Arrayref of file names to upload.

cookies

Same as with constructor, but sets cookies for this particular call only.

Returns either call Result or Exception.

upload

Same as submit.

poll

Polls server side for events, returns event data.

cookies

Same as with constructor, but sets cookies for this particular call only.

DEPENDENCIES ^

RPC::ExtDirect::Client depends on the following modules: HTTP::Tiny, JSON, and RPC::ExtDirect::Server for testing.

SEE ALSO ^

For more information on using Ext.Direct with Perl, see RPC::ExtDirect. RPC::ExtDirect::Server can be used to provide lightweight drop-in for production environment to run Ext.Direct tests.

BUGS AND LIMITATIONS ^

There are no known bugs in this module. Use github tracker to report bugs (the best way) or just drop me an e-mail. Patches are welcome.

AUTHOR ^

Alexander Tokarev <tokarev@cpan.org>

ACKNOWLEDGEMENTS ^

I would like to thank IntelliSurvey, Inc for sponsoring my work on this module.

COPYRIGHT AND LICENSE ^

Copyright (c) 2012 Alexander Tokarev.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

syntax highlighting: