est::SHA qw/sha256_hex/;
use Encode qw/encode_utf8/;
use Google::Directions::Response;
use JSON qw/decode_json/;
use LWP::UserAgent;
use Moose;
use MooseX::Params::Validate;
use MooseX::WithCache;
use
e_url> Default: C<https://maps.googleapis.com>
=item I<api_path> Default: C</maps/api/directions/json>
=item I<limit_path_length> limit is documented at 2048, but errors occur at 2047.. Default: 204
has 'api_path' => ( is => 'ro', isa => 'Str',
default => '/maps/api/directions/json' );
has 'limit_path_length' => ( is => 'ro', isa => 'Int', default => 2046 );
# Create a L
ict;
use warnings;
use Moose;
use Neo4j::REST::Client;
use Neo4j::Node;
use Data::Printer;
use JSON;
has 'id' => (
isa => 'Num',
required => 0,
is => 'rw',
);
has 'client'
for ( $self->client->status ) {
when ('200') {
$self->_endpoints( decode_json( $self->client->content ) );
$self->_self_endpoint( $self->_endpoints->{self} );
;
$self->client->POST($url, encode_json( $payload) );
for ( $self->client->status ) {
when ('201') {
$self->_endpoints( decode_json( $self->client->content ) );
ge Neo4j::Index;
use strict;
use warnings;
use 5.10.0;
use Moose;
use Neo4j::REST::Client;
use JSON;
has 'client' => (
required => 1,
isa => 'Neo4j::REST::Client',
is => 'r
package Bio::PhyloTastic::TNRS;
use strict;
use warnings;
use JSON;
use URI::Escape;
use Data::Dumper;
use LWP::UserAgent;
use Bio::Phylo::IO 'parse';
use Bio::Phylo::Util::CONSTANT ':objecttypes';
us
s is a redirect
my $obj = decode_json($result);
# start polling
while(1) {
sleep $wait;
my $result = _fetch_url($obj->{'uri'},'get');
my $obj = decode_json($result);
if ( $obj->{'names'}
package Log::Message::Structured::Stringify::AsJSON;
use Moose::Role;
use namespace::autoclean;
use JSON::Any;
use utf8 ();
requires 'as_hash';
around 'as_string' => sub {
my $orig = shift;
as_hash;
my $json = JSON::Any->objToJson( $hashref );
utf8::decode($json) if !utf8::is_utf8($json) and utf8::valid($json); # if it's valid utf8 mark it as such
return $json;
};
1;
__END
__
=pod
=head1 NAME
Log::Message::Structured::Stringify::AsJSON - JSON log lines
=head1 SYNOPSIS
package MyLogEvent;
use Moose;
use namespace::autoclean;
with qw/
Log::Me
$self->client->status ) {
when ('200') {
# all good
return decode_json($self->client->content);
}
default {
# throw exception
}
package Neo4j::REST::Client;
use 5.10.0;
use Moose;
use Data::Printer;
use REST::Client;
use JSON;
use Try::Tiny;
has 'root_URL' => (
required => 1,
isa => 'Str',
is => 'rw',
:Client->new;
$client->addHeader( 'Accept', 'application/json' );
$client->addHeader( 'Content-Type', 'application/json' );
return $client;
}
has 'root_endpoints' => (
isa =
);
$self->GET($self->root_URL);
if($self->status eq '200') {
my $root_endpoints = decode_json($self->content);
# FIX for missing relationships endpoint on the API
$root_endpoints->{re
use 5.10.0;
use Moose;
use Neo4j::Relationship;
use Neo4j::REST::Client;
use Data::Printer;
use JSON;
has 'id' => (
isa => 'Num',
required => 0,
is => 'rw',
);
has 'client'
for ( $self->client->status ) {
when ('200') {
$self->_endpoints( decode_json( $self->client->content ) );
$self->_self_endpoint( $self->_endpoints->{self} );
t('node'),
encode_json( $self->data ) );
for ( $self->client->status ) {
when ('201') {
# all good
$self->_endpoints( decode_json( $self->client->content
ent;
use Message::Passing::Output::ZeroMQ;
use Message::Passing::Input::ZeroMQ;
use JSON qw/ encode_json decode_json /;
use Try::Tiny qw/ try catch /;
use Plack::Middleware::BufferedStreaming;
use nam
socket_type => 'PUB',
);
}
sub consume {
my ($self, $msg) = @_;
my $env = decode_json($msg);
my $errors;
open(my $error_fh, '>', \$errors) or die $!;
$env->{'psgi.errors'}
ength($html),
],
[ $html ]
];
};
my $return_data = encode_json({
clientid => $clientid,
response => $res,
errors => $errors,
});
r /;
use Message::Passing::Input::ZeroMQ;
use Message::Passing::Output::ZeroMQ;
use JSON qw/ encode_json decode_json /;
use namespace::autoclean;
with qw/
Message::Passing::Role::Input
Messag
gix.message.passing.returnaddress'} = $self->return_address;
$self->output_to->consume(encode_json $env);
return sub {
my $responder = shift;
$self->in_flight->{refaddr($base_e
andle_request($env);
};
}
sub consume {
my ($self, $message) = @_;
$message = decode_json $message;
my $clientid = $message->{clientid};
my ($env, $responder) = @{ delete($self->i
the message to a string before
sending it. The C<message-pass> utility will do this for you into JSON, or you can
do it manually as shown in the example in L<Message::Passing::ZeroMQ>.
=head1 SEE AL
my $res = LWP::UserAgent->get('http://servers.example.com/api/hosts');
my $hosts = decode_json $res->content;
$hosts;
}, {
deploy_to => "/home/app/www/$application",
bra
my $res = LWP::UserAgent->get('http://servers.example.com/api/hosts');
my $hosts = decode_json $res->content;
$hosts;
};
# or
role production => 'production.example.com', {
rch::Response;
use Any::Moose;
use Google::Search::Carp;
use Google::Search::Error;
use JSON; my $json = JSON->new;
use Try::Tiny;
has http_response => qw/ is ro required 1 isa HTTP::Response /;
h
nt = $json->decode( $content );
} catch {
@error = ( -1, "Unable to JSON parse content: $@" );
};
return $fail->( @error ) if @error;
return $fail->( -1, "Unable to JSON pars
e;
use JSON qw//;
use Log::Any qw//;
use namespace::autoclean;
around BUILDARGS => sub {
my $orig = shift;
my $class = shift;
if (@_ == 1 && !ref $_[0]) {
my $note = JSON->new->
, JSON->backend);
my $json = JSON->new;
$json->allow_blessed;
$json->convert_blessed;
my $serialised_note = $json->utf8->encode($self);
return $serialised_note;
}
method TO_JSON
verters
=head3 L<DataFlow::Proc::MessagePack> 1.112100
No tests yet!!
=head3 L<DataFlow::Proc::JSON> 1.112100
No tests yet!!
=head3 L<DataFlow::Proc::YAML> 1.112100
No tests yet!!
=head3 L<Data
y $length = do { no warnings; use bytes; length $http_body; };
$r->content_type('application/json');
$r->headers_out->{'Content-Length'} = $length;
$r->print($http_body);
return Apa
ON = '0.2.1';
use v5.10;
use open qw(:std :utf8);
use Moose;
use MooseX::Types::Path::Class;
use JSON;
use LWP::UserAgent;
use HTTP::Cookies;
use Log::Any qw//;
use DateTime;
use MIME::Base64 qw//;
u
=> 1,
);
method _build__ua {
my $headers = HTTP::Headers->new(Content_Type => 'application/json',);
# XXX is it worth saving cookie?? How is password more valuable than auth token?
# l
ogger->error('Network: ' . $response->status_line);
return;
}
my $index = decode_json($response->content);
if ($index->{count} > 0) {
$self->logger->debugf('Network: Inde
esult;
use Google::Search::Error;
use LWP::UserAgent;
require HTTP::Request::Common;
use JSON;
my $json = JSON->new;
BEGIN {
use vars qw/ $Base %Service2URI /;
$Base = 'http://ajax.googleapi
"Malformed content: $content" unless $content =~ s/^.*?\(\[(.*)\]\)$/[$1]/g;
my $data = $json->decode( $content );
croak "Malformed content: $content" unless ref $data eq 'ARRAY' && $
CIES
Apache::ExtDirect is dependent on the following modules:
L<mod_perl2>, L<RPC::ExtDirect>, L<JSON>, L<Attribute::Handlers>.
=head1 SEE ALSO
For more information on core functionality see L<RPC:
age::Passing;
use Message::Passing::Output::ZeroMQ;
use Message::Passing::Filter::Encode::JSON;
my $log = Log::Dispatch->new;
$log->add(Log::Dispatch::Message::Passing->new(
regate_log',
min_level => 'debug',
output => Message::Passing::Filter::Encode::JSON->new(
output_to => Message::Passing::Output::ZeroMQ->new(
connect => 'tcp:/