ct;
use warnings;
use File::Basename qw(basename);
use Getopt::Long qw(GetOptionsFromArray);
use JSON;
use Linux::MemInfo;
use List::MoreUtils qw(part uniq);
use List::Util qw(max);
use Log::Dispatch
prefix znode
Sets prefix_data_watch
=cut
sub load_prefix_data
{
my $self = shift;
my $json_data = $self->zkh->get($self->prefix, watch => $self->prefix_data_watch);
if ($self->zkh->get
".$self->zkh->str_error);
}
my (%data, $prefix_data);
if ($json_data) {
$prefix_data = eval {from_json($json_data)};
if (!$prefix_data || $@) {
$self->_error("
meta_is_normalized => 1,
common_opts => $cli->{common_opts},
per_arg_json => $cli->{per_arg_json},
per_arg_yaml => $cli->{per_arg_yaml},
);
return [500, "Can't genera
> $gengls_res,
meta => $meta,
meta_is_normalized => 1,
per_arg_json => $cli->{per_arg_json},
per_arg_yaml => $cli->{per_arg_yaml},
);
return [500, "Can't genera
'_build_ua',
);
# Undocumented attribute, mostly useful for testing. Use at your own risk!
has _json_flags => (
is => 'ro',
isa => 'HashRef',
required => 1,
defau
(default)
=item * TabSeparatedWithNames
=item * CSV
=item * Pretty
=item * JSON
=item * XML
=item * ...
=back
L<https://clickhouse.yandex/reference_en.html#Formats>
cli
ce::Bonusly::Service;
$WebService::Bonusly::Service::VERSION = '1.001';
use v5.14;
use Moose;
use JSON;
use Try::Tiny;
use URI::Escape;
# ABSTRACT: A utility class for WebService::Bonusly services
Bonusly',
required => 1,
weak_ref => 1,
handles => [ qw( token base_url ua _json_flags print_debug ) ],
);
sub _perform_action {
my ($self, $method, $path_info, $params, $to
my $content = to_json(\%clean, $self->_json_flags);
$self->print_debug("SEND>> $method $path");
$self->print_debug("SEND>> Content-Type: application/json");
$self->prin
package Plift::Context;
use Moo;
use Carp;
use XML::LibXML::jQuery;
use JSON 'to_json';
use Encode 'encode';
use namespace::clean;
use Ref::Util qw/ is_hashref is_blessed_ref /;
has 'helper', is =>
ion);
$target_element->remove unless defined $value;
# to_json
$value = to_json($value, { convert_blessed => 1 }) if ref $value eq 'HASH';
# encode
d' if $feed;
$headers->{Accept}
= sprintf( 'application/vnd.com.runkeeper.%s+json', $accept );
}
# Fix up URLs with a semicolon delimiter.
if ( $url =~ m{;} ) {
{
headers =>
{ Accept => 'application/vnd.com.runkeeper.Records+json' }
);
Returns a L<WebService::HealthGraph::Response> object.
=head1 CAVEATS
Most respo
ww.flickr.com/search/?text=Moscow' } );
# or you can do like this
my $params = $c->req->json;
# Do not forget to validate $params before it:
my $id = $c->insert('models', $para
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
jpg => 'image/jpeg',
jpeg => 'image/jpeg',
js => 'text/javascript',
json => 'application/json',
midi => 'audio/x-midi',
mp3 => 'audio/mpeg',
mpeg => 'video/mpeg',
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
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
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
: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($@);
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
led?
use lib "$FindBin::Bin"; # use that dir for libs, too
use strict;
use warnings;
use JSON;
use FAIR::Accessor::Distribution;
use FAIR::Accessor::Container;
use FAIR::Accessor::MetaReco
instead.
#
our $EXCEPTION_CLASS;
### PUBLIC CLASS METHOD ###
#
# Serialize the passed data into JSON form
#
# DEPRECATED. Use RPC::ExtDirect::Serializer->serializer instance method
# instead.
#
sub
BSTRACT: Representation of a Virtual Machine in JiffyBox
use strict;
use warnings;
use Moo;
use JSON;
has id => (is => 'ro', required => 1);
has hypervisor => (is => 'ro', required => 1);
h
$self->last ( $response->status_line );
return;
}
my $backup_info = from_json($response->decoded_content);
$self->last ($backup_info);
$self->backup_cache ($b
{
$self->last ( $response->status_line );
return;
}
my $details = from_json($response->decoded_content);
$self->last ($details);
$self->details_cache ($det
ackaging
# ABSTRACT: OO-API for JiffyBox Virtual Machine
use strict;
use warnings;
use Moo;
use JSON;
use LWP::UserAgent;
use Scalar::Util qw( reftype );
use VM::JiffyBox::Box;
has domain_name =>
ss) {
$self->last ($response->status_line);
return;
}
my $details = from_json($response->decoded_content);
$self->last ( $details );
$self->details_cache( $de
>base_url . '/jiffyBoxes';
# transform args into JSON and pass them to API server
my $response = $self->ua->post($url, Content => to_json($args));
# POSSIBLE EXIT
unless ($response->
:VERSION = '1.001';
# ABSTRACT: The core Accessor functions
use Moose;
use URI::Escape;
use JSON;
use FAIR::AccessorConfig;
use RDF::Trine::Parser 0.135;
use RDF::Trine::Model 0.135;
use RDF::Tr