BETTER COERCION
# SOLUTION CAN BE FOUND!!!!
if (blessed $value and $value->isa('JSON::Boolean')) {
$args->{$key} = $$value;
}
}
return $self->$orig($args)
oose;
use Net::SSLeay qw/die_now die_if_ssl_error/;
use Socket;
use Encode qw(decode encode);
use JSON::XS;
our $VERSION = '0.0202';
has message => (
is => 'rw',
isa => 'Str',
de
>custom} > 0) {
$data->{custom} = $self->custom;
}
my $jsonxs = JSON::XS->new->utf8(1)->encode($data);
$jsonxs =~ s/("badge":)"([^"]+)"/$1$2/;
return
chr(0)
. pa
ck( 'n', 32 )
. pack( 'H*', $self->devicetoken )
. pack( 'n', length($jsonxs) )
. $jsonxs;
}
sub write {
my ( $self, $args ) = @_;
if ( $args->{devicetoken} ) { $self->de
ublish;
use AnyEvent::ZeroMQ::Subscribe;
use AnyMQ::Topic::Trait::ZeroMQ;
use Carp qw/croak/;
use JSON;
has 'publish_address' => ( is => 'rw', isa => 'Str' );
has 'subscribe_address' => ( is => 'rw
( is => 'rw', lazy_build => 1, isa => 'ZeroMQ::Raw::Context' );
has '_zmq_json' => ( is => 'rw', lazy_build => 1, isa => 'JSON' );
# topic => [ callbacks ]
has 'subscriptions' => (
traits =>
=> {
subscription_topics => 'keys',
},
);
sub _build__zmq_json {
my ($self) = @_;
return JSON->new->utf8;
}
sub _build__zmq_context {
my ($self) = @_;
my $c = Ze
# encode events as JSON and transmit them
foreach my $event (@events) {
my $json = $event;
if (ref $json) {
$json = $self->bus->_zmq_json->encode($event);
}
$self->bus->_zmq_pub->publish($json);
}
};
1;
refs are keyed
# unnecessarily by increment ID.
# This is actually in the raw JSON string...
my $args =
ref($_) eq 'ARRAY'
? $_->[0]
: $
LICENSE-2.0
=cut
package Labkey::Query;
use strict;
use LWP::UserAgent;
use HTTP::Request;
use JSON;
use Data::Dumper;
use FileHandle;
use File::Spec;
use File::HomeDir;
use Carp;
use URI;
use var
k( $response->status_line );
}
my $json_obj = JSON->new->utf8->decode( $response->content )
|| croak("ERROR: Unable to decode JSON.\n$url\n");
return $json_obj;
}
=head1 insertRows()
inser
@_;
my $json_obj = JSON->new->utf8->encode($data);
my $req = new HTTP::Request;
$req->method('POST');
$req->url($url);
$req->content_type('application/json');
$req->content($json_obj);
$req
};
use WebService::MyGengo::Exception;
use URI;
use Digest::HMAC;
use Digest::SHA1;
use JSON qw(encode_json);
=head1 NAME
WebService::MyGengo::RequestFactory - A factory for creating myGengo API
;
$req_params->{data} = encode_json($params);
my $request = HTTP::Request->new( $method => $uri );
$request->push_header( 'Accept' => 'application/json; charset=utf-8' );
$request->p
uest = HTTP::Request->new( $method => $uri );
$request->push_header( 'Accept' => 'application/json; charset=utf-8' );
return $request;
}
#=head2 _get_uri_and_req_params( $method, $endpoint )
e Moose;
use namespace::autoclean;
extends 'WebService::MyGengo::Base';
use HTTP::Response;
use JSON;
=head1 NAME
WebService::MyGengo::Response - An response from the myGengo API
=head1 DESCRIPTI
);
#=head2 _serializer
#
#A JSON object.
#
#B<Note:> The API also supports XML. We do not. :)
#
#=cut
has _serializer => (
is => 'ro'
, isa => 'JSON'
, init_arg => undef
=> 1
, builder => '_build__serializer'
);
sub _build__serializer {
return new JSON;
}
#=head2 _deserialized
#
#The deserialized response body.
#
#Returns undef if the body could n
XMLRPC> is an XML-RPC protocol implementation. Method parameters
types are guessed just like in L<JSON>, but you can pass explicit type if
guessing is wrong for you. Read more about parameter creation
mat = shift;
my %mime_types = ( XML => 'application/xml', JSON => 'application/json', );
return $mime_types{$format} || $mime_types{JSON};
}
=head1 SYNOPSIS
use VendorAPI::2Checkout::Client;
and detail_coupon(), list_payments(),
list_options(), list_products().
Return data is in XML or JSON.
Please refer to L<2Checkout's Back Office Admin API Documentation|http://www.2checkout.com/docu
me && $password) {
return undef;
}
unless ( defined $format && $format =~ qr/^(?:XML|JSON)$/) {
return undef;
}
$class = 'VendorAPI::2Checkout::Client::';
if (defined $use
};
sub _netloc { 'www.2checkout.com:443' };
enum 'Format' => qw( XML JSON );
class_type 'LPW::UserAGent';
has ua => (
is => 'ro',
isa => 'LWP::UserAgent',
lazy
e, $type) = ($type, '') unless defined $value;
return $value if blessed($value);
# From JSON::PP
my $flags = B::svref_2object(\$value)->FLAGS;
my $is_number = $flags & (B::SVp_IOK |
and detail_coupon(), list_payments(),
list_options(), list_products().
Return data is in XML or JSON.
Please refer to L<2Checkout's Back Office Admin API Documentation|http://www.2checkout.com/docu
me && $password) {
return undef;
}
unless ( defined $accept && $accept =~ qr/^(?:XML|JSON)$/) {
$accept = 'XML';
}
my $self = bless {}, $class;
my $ua = LWP::UserAgent->ne
use warnings;
use Digest::SHA qw( hmac_sha1_base64 );
use HTTP::Request::Common qw(POST);
use JSON;
use LWP::UserAgent;
use URI::Escape;
use vars qw/$module $errstr $timeout $VERSION $sendUrl $
seragent} ) {
$args->{useragent} = LWP::UserAgent->new();
}
unless ( $args->{json} ) {
$args->{json} = JSON->new->allow_nonref;
}
# Its important to realize that if your time is not ou
authenticationQuery;
}
sub postAPIRequest {
my ($self, $apiUrl, $websiteString) = @_;
my $json_string;
$module .= ' -> postAPIRequest';
my $http_header = HTTP::Request->new(POST => $apiU
You
may serialize it thusly:
my $json = $results->freeze({ format => 'JSON' });
# ...
my $results = Data::SearchEngine::Results->thaw($json, { format => 'JSON' });
=head1 ATTRIBUTES
=head2 el
# 1. set correct presentation
# 2. remove redirect header
$app->set_presentation ({type => 'json'});
return;
}
sub new {
my $class = shift;
my $self = dclone ($template);
if ($Class::
epoSync::Export;
use 5.10.0;
use warnings;
use strict;
use Cwd qw(realpath getcwd);
use YAML;
use JSON;
use File::Spec;
use File::Find::Rule;
use File::Basename;
use Config::Tiny;
use App::RepoSync::S
# MyApp::Config
MyApp->config_class('Config');
# MyApp::Config::JSON
MyApp->config_class('Config::JSON');
if you want to use fully qualified class name, use plus sign prefix.
content output";
# fix for "Wide characters to print"
binmode STDOUT, ":utf8";
utf8::decode ($content);
$| = 1;
print $content;
}
sub TO_JSON {
my $self = shift;
return {%$self};
}
1;
$pack->root;
my $global_config_patch_json = delete $files->{global_config_patch_json};
my $local_config_patch_json = delete $files->{local_config_patch_json};
debug "storing config files";
hin helper we have json structures
my $serializer = Project::Easy::Config->serializer ('json');
# global config
my $patch = $serializer->parse_string ($global_config_patch_json);
$pack->conf_pat
n
$local_config_patch_json = Project::Easy::Config::string_from_template (
$local_config_patch_json,
$vars
);
$patch = $serializer->parse_string ($local_config_patch_json);
$pack->fixup_path->