package PubNub::PubSub::Message;
use Carp;
use Mojo::JSON qw(encode_json decode_json);
use strict;
use warnings;
our $VERSION = '1.0.1'; ## VERSION
=head1 NAME
PubNub::PubSub::Message - Messag
atastructure;
my $message = PubNub::PubSub::Message->new(payload=> $datastructure);
my $json = $message->json;
my $payload = $message->payload;
my $queryhash = $message->query_params;
=head1 METH
ortt, meta, ear,
and seqn, supported per the PubNub API. These other arguments are converted
to JSON in the query_params method below.
If a simple scalar is passed (not a reference), it is assumed
L::Tiny;
use JSON::XS;
use XML::Simple;
use HTML::Tiny;
use vars qw[$VERSION];
$VERSION = '0.40';
my %types = (
'yaml', 'application/x-yaml; charset=utf-8',
'json', 'application/json; charset=ut
return $string;
},
'json', sub {
my $ref = shift;
my $string;
eval { $string = JSON::XS->new->utf8(1)->pretty(1)->encode( $ref
ameters, an arrayref of
data to be rendered, which is required, and the format, either C<yaml>, C<json>, C<xml>
or C<html>, to render to, which defaults to C<yaml>.
=back
=head1 CLASS METHODS
=over
->()';
shift @$request;
}
$self->_install_timeout_timer;
$self->{worker}->push_write( json => [ 'do', {}, @$request, ], );
my $timer;
if ($self->{log_defer_object}) {
$timer = $s
lete $self->{cmd_handler};
$self->_try_to_fill_requests;
};
$self->{worker}->push_read( json => $self->{cmd_handler} );
}
sub DESTROY {
my ($self) = @_;
$self->{client}->remove_pending
$self->{client}->populate_workers if $self->{client};
} else {
$worker->push_write( json => [ 'dn', {} ] );
$self->{client}->make_worker_available($worker) if $self->{client};
package MojoX::Session::Store::Redis;
use utf8;
use warnings;
use strict;
use Redis;
use JSON;
use base 'MojoX::Session::Store';
use namespace::clean;
__PACKAGE__->attr('redis');
__PACKAGE__->attr
te {
my ($self, $sid, $expires, $data) = @_;
my $prefix = $self->redis_prefix;
$data = encode_json($data) if $data;
$self->redis->hmset("$prefix:$sid", 'sid' => $sid, 'data' => $data, 'expires' =
y %session = $self->redis->hgetall("$prefix:$sid");
$session{'data'} = $session{'data'} ? decode_json($session{'data'}) : undef ;
return ($session{'expires'}, $session{'data'});
}
sub delete {
t( $url, json => $payload );
my $response = $tx->success();
unless( $response ) {
my $error = $tx->error();
die( sprintf( 'Error: %s', $error->{message} ) )
}
return $response->json();
}
su
$error = $tx->error();
die( sprintf( 'Error: %s', $error->{message} ) )
}
return $response->json();
}
__PACKAGE__->meta()->make_immutable();
1;
__END__
=pod
=head1 NAME
Facebook::Messenger
package Net::Hadoop::WebHDFS;
use strict;
use warnings;
use Carp;
use JSON::XS qw//;
use Furl;
use File::Spec;
use URI;
use Try::Tiny;
use constant GENERIC_FS_ACTION_WITH_NO_PATH => '';
our $VERS
my $res = $self->operate_requests('PUT', $path, 'MKDIRS', \%options);
$self->check_success_json($res, 'boolean');
}
$OPT_TABLE{MKDIRS} = ['permission'];
sub mkdirs { (shift)->mkdir(@_); }
# cu
rate_requests('PUT', $path, 'RENAME', {%options, destination => $dest});
$self->check_success_json($res, 'boolean');
}
# curl -i -X DELETE "http://<host>:<port>/webhdfs/v1/<path>?op=DELETE
#
rd as stored in the resolver), created, updated and deleted
from Catmandu.
Data is returned as JSON.
{
"data": {
"documents": [],
"domain": "",
"id"
package Catmandu::CA::API;
use strict;
use warnings;
use Catmandu::Sane;
use Moo;
use JSON;
use Catmandu::CA::API::QueryBuilder;
use Catmandu::CA::API::Request;
has username => (is => 'ro', requ
password => $self->password,
lang => $self->lang
);
return $r->put(encode_json($data));
}
sub update {
my ($self, $id, $data) = @_;
my $r = Catmandu::CA::API::Request-
password => $self->password,
lang => $self->lang
);
return $r->put(encode_json($data));
}
sub delete {
my ($self, $id) = @_;
my $r = Catmandu::CA::API::Request->new(
package Catmandu::Store::Resolver::API;
use Moo;
use JSON;
use LWP::UserAgent;
use Catmandu::Sane;
has url => (is => 'ro', required => 1);
has username => (is => 'ro', required => 1);
has pass
elf->ua->get($req_url);
if ($response->is_success) {
# New API
return decode_json($response->decoded_content);
} else {
# If it is 404, it could be that the "new" api
I returns the application/json content-type
# while the old doesn't.
if ($response->code == 404) {
if ($response->content_type eq 'application/json') {
retu
Catmandu::Sane;
use Data::Dumper qw(Dumper);
use LWP::UserAgent;
use HTTP::Request::Common;
use JSON;
has username => (is => 'ro', required => 1);
has password => (is => 'ro', required => 1);
has u
nse = $self->ua->request($request);
if ($response->is_success) {
my $content = decode_json($response->decoded_content);
return $content->{'authToken'};
} else {
Catmand
F (esteban[at]sasco.cl)
# @version 2017-02-20
#
use strict;
use warnings;
use LibreDTE::SDK;
use JSON;
# datos a utilizar en el cliente
my $url = 'https://libredte.cl';
my $hash = '';
# documento q
: '.$generar->{body}) if $generar->{code} != 200;
# obtener el PDF del DTE
my $dte_real = decode_json($generar->{body});
my $generar_pdf = $LibreDTE->get('/dte/dte_emitidos/pdf/'.$dte_real->{dte}.'/'
;
use Graph::Directed;
use List::AllUtils qw/ uniq first_value /;
use JSON;
my %tasks = map { $_->{uuid} => $_ } @{ from_json `task +PENDING export` };
my $graph = Graph::Directed->new;
$graph->a
e JSON;
has field_list => (is => 'ro', required => 1);
has query => (is => 'lazy');
sub _build_query {
my $self = shift;
if (scalar @{$self->field_list} == 0) {
return encode_json(
printf('%s', $field);
$query->{'bundles'}->{$def} = {
'returnAsArray' => JSON::true,
'locale' => 'nl_BE'
};
}
return encode_json($query);
}
1;
__END__
6
# Original Author: BlueT<BlueT@BlueT.org>
# CC-BY
# Dependency - Needs
# Net/Jaiku.pm (base on JSON/Any.pm)
# LWP/UserAgent.pm
# Params/Validate.pm
#use utf8;
#~ use Data::Dumper;
use Ne
package Catmandu::Store::Resolver::API;
use Moo;
use JSON;
use LWP::UserAgent;
use Catmandu::Sane;
has url => (is => 'ro', required => 1);
has username => (is => 'ro', required => 1);
has pass
elf->ua->get($req_url);
if ($response->is_success) {
# New API
return decode_json($response->decoded_content);
} else {
# If it is 404, it could be that the "new" api
I returns the application/json content-type
# while the old doesn't.
if ($response->code == 404) {
if ($response->content_type eq 'application/json') {
retu
package Catmandu::Store::Resolver::Bag;
use Moo;
use JSON;
use Catmandu::Sane;
use Catmandu::Store::Resolver::API;
with 'Catmandu::Bag';
has api => (is => 'lazy');
has pid => (is => 'rw');
sub _
17-02-20
#
package LibreDTE::SDK;
use 5.024001;
use strict;
use warnings;
use REST::Client;
use JSON;
use MIME::Base64;
require Exporter;
our @ISA = qw(Exporter);
# Items to export into callers n
$data_json;
if (ref($data) eq 'HASH') {
$data_json = encode_json($data);
} else {
$data_json = $data;
}
$self->{rest}->POST($self->{host}.'/api'.$api, $data_json);
operly decoded (we recommend UTF-8 of course). For output, the default is C<application/json> encoded with L<JSON::XS>. Both the input and output types can be modified, although this is only partially
the following methods on the context object:
=over
=item C<respond>
The respond method sends a JSON response, the contents of which are encoded from the first argument:
$c->respond({ a => 1, b
ault message ("Forbidden" in this case) and the JSON body will be C<{"error":"access denied"}>.
This works too, except the value of C<error> in the JSON body of the response will just be "HTTP code 4
0.002
=head1 SYNOPSIS
# in 'foo.t', assume we want to hide Cpanel::JSON::XS
# hide Cpanel::JSON::XS -> Cpanel/JSON/XS.pm
use lib map {
my $m = $_;
sub { return unless $
_[1] eq $m; die "Can't locate $_[1] in \@INC (hidden)\n"; }
} qw{Cpanel/JSON/XS.pm};
=head1 DESCRIPTION
The L<Devel::Hide> and L<Test::Without::Module> modules are very helpful
development tools
}
# input to map is a list module names, converted to paths;
qw{Cpanel/JSON/XS.pm JSON/XS.pm}
; # end of 'use lib' statement
When perl sees a coderef in C<@INC>, it gives t
file created by our parent before the fork
use IO::Select;
use JSON::XS;
use Scalar::Util qw/blessed/;
my $setup_has_been_run;
my $json;
my $sel;
sub handle_worker {
eval {
handle_worker_wr
AnyEvent::Util::fh_nonblocking $fh, 0;
AnyEvent::Util::fh_nonblocking $monitor_fh, 0;
$json = JSON::XS->new->utf8;
$sel = IO::Select->new;
$sel->add($fh, $monitor_fh);
while(1) {
m
TR};
POSIX::_exit(1);
} elsif ($read_rv == 0) {
POSIX::_exit(1);
}
for my $input ($json->incr_parse($buf)) {
my $output;
my $output_meta = {};
my $cmd = shift @$input;