Dancer::RPCPlugin::CallbackResult - Factory for generating Callback-results.
use Dancer::Plugin::RPC::JSONRPC;
use Dancer::RPCPlugin::CallbackResult;
jsonrpc '/admin' => {
publish => 'config',
callback => sub {
my ($request, $rpc_method) = @_;
if ($rpc_method =~ qr/^admin\.\w+$/) {
return callback_success();
}
else {
return callback_fail(
error_code => -32768,
error_message => "only admin methods allowed: $rpc_method",
);
}
},
};
Allows no arguments.
Returns an instantiated Dancer::RPCPlugin::CallbackResult::Success
object.
Allows these named arguments:
- error_code => $code
- error_message => $message
Returns an instantiated Dancer::RPCPlugin::CallbackResult::Fail
object.
Dancer::RPCPlugin::CallbackResult::Success - Class for success
Constructor, does not allow any arguments.
Dancer::RPCPlugin::CallbackResult::Fail - Class for failure
Constructor, allows named arguments:
- error_code => $code
- error_message => $message
(c) MMXVI - Abe Timmerman <abeltje@cpan.org>