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' ],
);
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'.
- %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.
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.
Returns either call Result or Exception.
- upload
-
Same as
submit
. - poll
-
Polls server side for events, returns event data.
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.