Group
Extension

Matches 35359

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/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-Client ( T/TO/TOKAREV/RPC-ExtDirect-Client-1.25.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect-Client/lib/RPC/ExtDirect/Client.pm ( view source; MetaCPAN )
e RPC::ExtDirect::Client;

use strict;
use warnings;
no  warnings 'uninitialized';

use Carp;
use JSON;

use File::Spec;

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

,
    # so that die() wouldn't munge it. Easier to do and beats stripping
    # that \n any time. JSON or other packages could throw a plain string
    # though, so we need to guard against that.
    
approved format, so no outer eval
    my $meta_json = $self->_formalize_metadata($method, $trans);
    
    $fields->{metadata} = $meta_json if $meta_json;

    return $fields;
}

### PRIVATE INSTANCE
RPC-ExtDirect-Client ( T/TO/TOKAREV/RPC-ExtDirect-Client-1.25.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect-Client/lib/RPC/ExtDirect/Client/API.pm ( view source; MetaCPAN )
Direct::Client::API;

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

use JSON;

use RPC::ExtDirect::Util::Accessor;
use RPC::ExtDirect::Config;
use RPC::ExtDirect::API;

use b
ts
#

sub _decode_api {
    my ($js) = @_;

    $js =~ s/^[^{]+//;
    
    my ($api_js) = eval { JSON->new->utf8(1)->decode_prefix($js) };

    die "Can't decode API declaration: $@\n" if $@;

    di
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/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/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/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;
}

#
Acme-IsItJSON ( B/BK/BKB/Acme-IsItJSON-0.02.tar.gz, BKB, 2016; MetaCPAN )
Acme-IsItJSON/lib/Acme/IsItJSON.pod ( view source; MetaCPAN )
d1 NAME

Acme::IsItJSON - Is my variable JSON or a Perl data structure?

=head1 SYNOPSIS

    use Acme::IsItJSON 'is_it_json';
    my $json = '{"zilog":"z80"}';
    is_it_json ($json);
    my $perl = 
80'};
    is_it_json ($json);

=head1 DESCRIPTION

Not sure if your variable is a Perl data structure or a JSON string?

This Perl module can help.

=head1 FUNCTIONS

=head2 is_it_json

Given a variab
ot be JSON or a Perl data structure, feed it to
this routine. This module uses support vector machines running on an
OCAML cluster backed up by a Node pipeline in an S3 cloud to
distinguish JSON from 
Acme-IsItJSON ( B/BK/BKB/Acme-IsItJSON-0.02.tar.gz, BKB, 2016; MetaCPAN )
Acme-IsItJSON/lib/Acme/IsItJSON.pm ( view source; MetaCPAN )
sItJSON;
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw/is_it_json/;
%EXPORT_TAGS = (
    all => \@EXPORT_OK,
);
use warnings;
use strict;
use Carp;
use JSON::Parse qw/parse_json valid_json/;
use JSON::Create 'create_json';
our $VERSION = '0.02';

my @responses = (
    "That seems to be {X}.",
    "That might be {X}.",
    "I'm not sure whether that is {X}.",
    "It could be {X}.",
    "O
 (2) > 1) {
	$response = create_json ($response);
    }
    print "$response\n";
}

sub is_it_json
{
    my ($input) = @_;
    if (valid_json ($input)) {
	babble ('JSON');
    }
    else {
	babble ('a
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-Server ( T/TO/TOKAREV/RPC-ExtDirect-Server-1.24.tar.gz, TOKAREV, 2016; MetaCPAN )
RPC-ExtDirect-Server/lib/RPC/ExtDirect/Server.pod ( view source; MetaCPAN )
> '/var/run',
    );
    
    $server->run();

Another easy speed gain can be had by installing L<JSON::XS> module;
it will be used automatically when detected.

=head2 Troubleshooting server issues

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/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.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
AnyEvent-InfluxDB ( A/AJ/AJGB/AnyEvent-InfluxDB-1.0.2.0.tar.gz, AJGB, 2016; MetaCPAN )
AnyEvent-InfluxDB/lib/AnyEvent/InfluxDB.pm ( view source; MetaCPAN )
::VERSION = '1.0.2.0';
use AnyEvent;
use AnyEvent::HTTP;
use URI;
use URI::QueryParam;
use JSON qw(decode_json);
use List::MoreUtils qw(zip);
use URI::Encode::XS qw( uri_encode );
use Moo;

has [qw( s
eaders) = @_;

            if ( $headers->{Status} eq '200' ) {
                my $data = decode_json($body);
                my $series = [
                    map {
                        my $res 
eaders) = @_;

            if ( $headers->{Status} eq '200' ) {
                my $data = decode_json($body);
                my $shards = {};
                for my $res ( @{ $data->{results}->[0]->
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/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
CGI-ExtDirect ( T/TO/TOKAREV/CGI-ExtDirect-3.24.tar.gz, TOKAREV, 2016; MetaCPAN )
CGI-ExtDirect/lib/CGI/ExtDirect.pm ( view source; MetaCPAN )
->poll($self->cgi);

    # Gather variables for HTTP response
    my $content_type = 'application/json';
    my $http_status  = '200 OK';

    # And we need content length, too (in octets)
    my $con
oads, @field_uploads;
            delete $keyword{ $param };
        };
    };

    # Metadata is JSON encoded; decode_metadata lives by side effects!
    if ( exists $keyword{metadata} ) {
        RP
CGI-ExtDirect ( T/TO/TOKAREV/CGI-ExtDirect-3.24.tar.gz, TOKAREV, 2016; MetaCPAN )
CGI-ExtDirect/lib/CGI/ExtDirect.pod ( view source; MetaCPAN )
as the content type that will
override the default C<application/json> type.

Example:

    print $cgi->route('text/javascript'); # JSONP

=item method('content/type', 'HTTP status')

Two header value
erpreted as the content type and
HTTP status, respectively.

Example:

    print $cgi->poll('text/json', '401 Unauthorized'); # Auth request

=item method(-header => 'value')

Any custom header can be
dispatches the quests, collects results and
returns an HTTP response with results as a serialized JSON stream.

Accepts custom headers as described in L</"HTTP response headers">.

=item C<poll>

Inst

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