Group
Extension

Matches 19

RPC-ExtDirect ( T/TO/TOKAREV/RPC-ExtDirect-3.24.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect/lib/RPC/ExtDirect.pod ( view source; MetaCPAN )
  return {
                success => \1,  # JSON::true
            };
        }
        else {
            return {
                success => \0,  # JSON::false
                error   => "You shall
esides that, Ext.Direct also has several major advantages over similar
protocols like XML-RPC and JSON-RPC:

=over 4

=item *

Built in service discovery mechanism: server side API is published to the
s. For more info,
see L</"FILE UPLOADS">.

Note that any field values in a submitted form will be JSON encoded
by the client side.

=item *

All remoting Methods are called in scalar context. Returnin
RPC-ExtDirect ( T/TO/TOKAREV/RPC-ExtDirect-3.24.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect/lib/RPC/ExtDirect/Test/Data/Env.pm ( view source; MetaCPAN )

    output => {
        status => 200,
        content_type => qr|^application/json\b|,
        comparator => 'cmp_json',
        cgi_content_length => 167,
        cgi_content =>
            q|{"act

    output => {
        status => 200,
        content_type => qr|^application/json\b|,
        comparator => 'cmp_json',
        cgi_content_length => 81,
        cgi_content => 
            q|{"act
nt =>
            q|{"action":"Env","method":"http_header","result":|.
            q|"application/json",|.
            q|"tid":1,"type":"rpc"}|,
    },
}, {
    name => 'param list',
    
    config =
RPC-ExtDirect ( T/TO/TOKAREV/RPC-ExtDirect-3.24.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect/lib/RPC/ExtDirect/Event.pod ( view source; MetaCPAN )
nything that is serializable to JSON. No checks are made
and it is assumed that client side can understand the data format used
with Events.

Note that by default L<JSON> will blow up if you try to fe
 global Config
option L<json_options|RPC::ExtDirect::Config/json_options> to include
C<allow_blessed> flag:

    my $config = RPC::ExtDirect->get_api->config;
    $config->json_options({
        allow
RPC-ExtDirect ( T/TO/TOKAREV/RPC-ExtDirect-3.24.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect/lib/RPC/ExtDirect/Deserialize.pm ( view source; MetaCPAN )
LE ###
#
# JSON decoding options
#
# DEPRECATED. Use `json_options_deserialize` or `json_options`
# Config options instead.
#

our %JSON_OPTIONS;

### PUBLIC CLASS METHOD ###
#
# Turns JSONified POST 
RPC-ExtDirect ( T/TO/TOKAREV/RPC-ExtDirect-3.24.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect/lib/RPC/ExtDirect/Config.pod ( view source; MetaCPAN )
ialization method in
C<RPC::ExtDirect::Serializer> module. This option only affects
"from Perl to JSON" conversion.

Default: C<undef>, chained to: L</debug>.

=item debug_deserialize

Turn debugging 
or deserialization method in
C<RPC::ExtDirect::Serializer> module. This option only affects
"from JSON to Perl" conversion.

Default: C<undef>, chained to: L</debug>.

=item debug_request

Turn debugg
<RPC::ExtDirect::Serializer> when
instantiating new objects to be used to serialize data (Perl to JSON).

Default: C<'RPC::ExtDirect::Serializer'>.

=item serializer_class_api

Class name to be used w
RPC-ExtDirect ( T/TO/TOKAREV/RPC-ExtDirect-3.24.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect/lib/RPC/ExtDirect/Intro.pod ( view source; MetaCPAN )
nses.

Examples of Exceptions are: request JSON is broken and can't be decoded;
called Method dies because of internal error; Result cannot be encoded
in JSON, etc.

=item Event

An asynchronous notif
 object
        
        my $user = $env->cookie('user');
        
        # \0 is a shortcut for JSON::false
        return { success => \0, error => 'Not authenticated' }
            unless $user eq
RPC-ExtDirect ( T/TO/TOKAREV/RPC-ExtDirect-3.24.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect/lib/RPC/ExtDirect/Serializer.pm ( view source; MetaCPAN )
lizer;

use strict;
use warnings;
no  warnings 'uninitialized';       ## no critic

use Carp;
use JSON ();

use RPC::ExtDirect::Config;

use RPC::ExtDirect::Util::Accessor;
use RPC::ExtDirect::Util qw
;
    
    return $self;
}

### PUBLIC INSTANCE METHOD ###
#
# Serialize the data passed to it in JSON
#

sub serialize {
    my ($self, %arg) = @_;
    
    my $data = delete $arg{data} || [];

    #
 @serialized) . ']'
             ;

    return $text;
}

### PUBLIC INSTANCE METHOD ###
#
# Turns JSONified POST request(s) into array of instantiated
# RPC::ExtDirect::Request (Exception) objects. Re
RPC-ExtDirect ( T/TO/TOKAREV/RPC-ExtDirect-3.24.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect/lib/RPC/ExtDirect/API.pm ( view source; MetaCPAN )
config->debug_api;
    
    my $serializer = $s_class->new( config => $config );
    
    my $api_json = $serializer->serialize(
        mute_exceptions => 1,
        debug           => $debug_api,
  
,
    );

    # Compile JavaScript for REMOTING_API
    my $js_chunk = "$remoting_var = " . ($api_json || '{}') . ";\n";

    # If auto_connect is on, add client side initialization code
    $js_chunk
is added only when there's something in it
    if ( $polling_api && !$no_polling ) {
        $api_json = $serializer->serialize(
            mute_exceptions => 1,
            debug           => $debug
RPC-ExtDirect ( T/TO/TOKAREV/RPC-ExtDirect-3.24.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect/lib/RPC/ExtDirect/EventProvider.pm ( view source; MetaCPAN )
return something.
    return $self->_no_events unless @results;

    # Polling results are always JSON; no content type needed
    my $serialized = $self->_serialize_results(@results);

    # And if s
izer = $serializer_class->new(
        config => $config,
        api    => $api,
    );

    my $json = eval {
        $serializer->serialize(
            mute_exceptions => 1,
            debug     
RPC-ExtDirect ( T/TO/TOKAREV/RPC-ExtDirect-3.24.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect/lib/RPC/ExtDirect/Serialize.pm ( view source; MetaCPAN )
instead.
#

our $EXCEPTION_CLASS;

### PUBLIC CLASS METHOD ###
#
# Serialize the passed data into JSON form
#
# DEPRECATED. Use RPC::ExtDirect::Serializer->serializer instance method
# instead.
#

sub
RPC-ExtDirect ( T/TO/TOKAREV/RPC-ExtDirect-3.24.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect/lib/RPC/ExtDirect/Config.pm ( view source; MetaCPAN )
    accessor => 'json_options',
}, {
    setter   => 'json_options_serialize',
    fallback => 'json_options',
}, {
    package  => 'RPC::ExtDirect::Deserialize',
    var      => 'JSON_OPTIONS',
    t
ype     => 'hash',
    setter   => 'json_options_deserialize',
    fallback => 'json_options',
}, {
    accessor => 'router_class',
    default  => 'RPC::ExtDirect::Router',
}, {
    accessor => 'time
RPC-ExtDirect ( T/TO/TOKAREV/RPC-ExtDirect-3.24.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect/lib/RPC/ExtDirect/Test/Data/Poll.pm ( view source; MetaCPAN )
{
        status => 200,
        content_type => qr|^application/json\b|,
        content_length => 109,
        comparator => 'cmp_json',
        content => 
            q|[{"data":["foo"],|.
       
{
        status => 200,
        content_type => qr|^application/json\b|,
        content_length => 65,
        comparator => 'cmp_json',
        content =>
            q|{"data":"Uno cappuccino, pres
{
        status => 200,
        content_type => qr|^application/json\b|,
        content_length => 44,
        comparator => 'cmp_json',
        content => q|{"data":"","name":"__NONE__","type":"even
RPC-ExtDirect ( T/TO/TOKAREV/RPC-ExtDirect-3.24.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect/lib/RPC/ExtDirect/Test/Data/Router.pm ( view source; MetaCPAN )
{
        status => 200,
        content_type => qr|^application/json\b|,
        content_length => 249,
        comparator => 'cmp_json',
        content => 
            q|{"action":null,"message":"E
{
        status => 200,
        content_type => qr|^application/json\b|,
        content_length => 78,
        comparator => 'cmp_json',
        content => 
            q|{"action":"Foo","method":"fo
    },
    },
    
    output => {
        status => 200,
        content_type => qr|^application/json\b|,
        content_length => 304,
        comparator => 'cmp_str',
        content => 
         
RPC-ExtDirect ( T/TO/TOKAREV/RPC-ExtDirect-3.24.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect/lib/RPC/ExtDirect/Demo/Profile.pm ( view source; MetaCPAN )
n@sencha.com' ) {
        return {
                    success => \0,              # Shortcut for JSON::false
                    errors  => { email => 'already taken' },
                    debug_for

    }
    else {
        return {
                    success          => \1,     # Shortcut for JSON::true
                    debug_formPacket => \%fields
               };
    };
}

sub getBasicIn
RPC-ExtDirect ( T/TO/TOKAREV/RPC-ExtDirect-3.24.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect/lib/RPC/ExtDirect/Test/Util.pm ( view source; MetaCPAN )

use base 'Exporter';

use Test::More;
use JSON;

our @EXPORT = qw/
    ref_ok
    is_deep
    cmp_api
    prepare_input
/;

our @EXPORT_OK = qw/
    cmp_json
/;

### EXPORTED PUBLIC PACKAGE SUBROUTIN
wo JSON structures, ignoring the whitespace
#

sub cmp_json {
    # This can be called either as a class method, or a plain sub
    shift if $_[0] eq __PACKAGE__;
    
    my ($have_json, $want_json, 
desc) = @_;
    
    $_ =~ s/\s//g for ($have_json, $want_json);
    
    my $have = JSON::from_json($have_json);
    my $want = JSON::from_json($want_json);
    
    is_deep $have, $want, $desc;
}

#
RPC-ExtDirect ( T/TO/TOKAREV/RPC-ExtDirect-3.24.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect/lib/RPC/ExtDirect/API/Method.pod ( view source; MetaCPAN )
ecode_params>

This optional parameter may contain the list of fields that should be
decoded from JSON for a formHandler Method. Does nothing for Methods
with other calling conventions.

=item C<metad
RPC-ExtDirect ( T/TO/TOKAREV/RPC-ExtDirect-3.24.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect/lib/RPC/ExtDirect/Util.pm ( view source; MetaCPAN )
:Util;

use strict;
use warnings;
no  warnings 'uninitialized';       ## no critic

use Carp;
use JSON;

use base 'Exporter';

our @EXPORT_OK = qw/
    clean_error_message
    get_caller_info
    pars
ed ) {
        # Whoever sends *multiple* metadata fields is going to regret it.
        my $meta_json = 'ARRAY' eq ref $meta_encoded ? pop @$meta_encoded
                      :                      
oded
                      ;

        local $@;
        $keywords->{metadata} = eval { JSON::from_json($meta_json) };

        if ( $@ ) {
            my $error = clean_error_message($@);
            
RPC-ExtDirect ( T/TO/TOKAREV/RPC-ExtDirect-3.24.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect/lib/RPC/ExtDirect/API/Method.pm ( view source; MetaCPAN )
d;

use strict;
use warnings;
no  warnings 'uninitialized';           ## no critic

use Carp;
use JSON;

use RPC::ExtDirect::Config;
use RPC::ExtDirect::Util ();
use RPC::ExtDirect::Util::Accessor;

#


    my $def;
    
    # Form handlers are defined like this
    # (\1 means JSON::true and doesn't force us to `use JSON`)
    if ( $self->formHandler ) {
        $def = { name => $name, formHandler
xtDirect::Client will call this method to prepare
# the arguments that are about to be encoded in JSON and passed
# over to the server side.
#
# The difference is that the server side wants an unfolde
RPC-ExtDirect ( T/TO/TOKAREV/RPC-ExtDirect-3.24.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect/lib/RPC/ExtDirect/Router.pm ( view source; MetaCPAN )
f $has_upload;

    # Form upload responses are JSON wrapped in HTML, not plain JSON
    my $content_type = $has_upload ? 'text/html' : 'application/json';

    # We need content length in octets
    

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.