RPC::ExtDirect::Client - Ext.Direct client in Perl
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' }, );
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.
Creates a new client instance. Constructor accepts the following arguments:
URI for Ext.Direct API published by server. Default: '/api'.
URI for Ext.Direct remoting requests. Default: '/router'.
URI for Ext.Direct events. Default: '/events'.
JavaScript variable name used to assign Ext.Direct remoting API object to. Default: 'Ext.app.REMOTING_API'.
JavaScript variable name used to assign Ext.Direct polling API object to. Default: 'Ext.app.POLLING_API'.
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.
All other arguments are passed to HTTP::Tiny constructor. See HTTP::Tiny for more detail.
Returns RPC::ExtDirect::Client::API object with Ext.Direct API declaration published by the server.
Calls Ext.Direct remoting method. Arguments are:
Ext.Direct Action (class) name
Ext.Direct Method name to call
Ext.Direct Method arguments; use arrayref for methods that accept ordered parameters or hashref for named parameters.
Same as with constructor, but sets cookies for this particular call only.
Returns either call Result or Exception.
Submits a form request to formHandler method. Arguments should be:
Ext.Direct Method name
Method arguments; for formHandlers it should always be a hashref.
Arrayref of file names to upload.
Same as submit.
submit
Polls server side for events, returns event data.
RPC::ExtDirect::Client depends on the following modules: HTTP::Tiny, JSON, and RPC::ExtDirect::Server for testing.
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.
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.
Alexander Tokarev <tokarev@cpan.org>
I would like to thank IntelliSurvey, Inc for sponsoring my work on this module.
Copyright (c) 2012-2013 Alexander Tokarev.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
To install RPC::ExtDirect::Client, copy and paste the appropriate command in to your terminal.
cpanm
cpanm RPC::ExtDirect::Client
CPAN shell
perl -MCPAN -e shell install RPC::ExtDirect::Client
For more information on module installation, please visit the detailed CPAN module installation guide.