NAME

Dancer2::RPCPlugin::CallbackResult - Factory for generating Callback-results.

SYNOPSIS

    use Dancer2::Plugin::RPC::JSON;
    use Dancer2::RPCPlugin::CallbackResult;
    jsonrpc '/admin' => {
        publish => 'config',
        callback => sub {
            my ($request, $rpc_method) = @_;
            if ($rpc_method =~ qr/^admin\.\w+$/) {
                return callback_success();
            }
            return callback_fail(
                error_code => -32768,
                error_message => "only admin methods allowed: $rpc_method",
            );
        },
    };

DESCRIPTION

callback_success()

Allows no arguments.

Returns an instantiated Dancer::RPCPlugin::CallbackResult::Success object.

callback_fail(%arguments)

Allows these named arguments:

error_code => $code
error_message => $message

Returns an instantiated Dancer::RPCPlugin::CallbackResult::Fail object.

NAME

Dancer2::RPCPlugin::CallbackResult - Base class for callback-result.

NAME

Dancer2::RPCPlugin::CallbackResult::Success - Class for success

DESCRIPTION

new()

Constructor, does not allow any arguments.

success()

Returns 1;

NAME

Dancer2::RPCPlugin::CallbackResult::Fail - Class for failure

new()

Constructor, allows named arguments:

error_code => $code
error_message => $message

COPYRIGHT

(c) MMXVI - Abe Timmerman <abeltje@cpan.org>