ponse;
$Etcd::Response::VERSION = '0.004';
use namespace::autoclean;
use Etcd::Node;
use JSON qw(decode_json);
use Moo;
use Type::Utils qw(class_type);
use Types::Standard qw(Str Int);
has action
init_arg => 'prevNode' );
sub new_from_http {
my ($class, $res) = @_;
my $data = decode_json($res->{content});
my %headers;
@headers{qw(etcd_index raft_index raft_term)} = @{$res->{h
package Etcd::Error;
$Etcd::Error::VERSION = '0.004';
use namespace::autoclean;
use JSON qw(decode_json);
use Carp qw(longmess);
use Moo;
use Types::Standard qw(Str Int);
has error_code => ( is =>
a => Str, required => 1 );
sub new_from_http {
my ($class, $res) = @_;
my $data = decode_json($res->{content});
$class->new(%$data, trace => longmess());
}
use overload
q{""} => sub
rch::OpenSearch::Response::Tiny;
use Moose;
use Carp;
extends 'Search::OpenSearch::Response::JSON';
use JSON;
our $VERSION = '0.409';
my %tiny_fields = map { $_ => 1 } qw(
total
facets
r
g
? JSON->new->utf8->pretty(1)->encode($resp)
: encode_json($resp);
}
1;
__END__
=head1 NAME
Search::OpenSearch::Response::Tiny - provide minimal search results in JSON format
=he
# or JSON, XML, ExtJS
x => [qw( foo bar )], # return only a subset of fields
);
print $response;
=head1 DESCRIPTION
Search::OpenSearch::Response::Tiny serializes to a minimal
JSON strin
package Captcha::NocaptchaMailru;
use strict;
use warnings;
use LWP::UserAgent;
use JSON;
use URI::Escape;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(
nocaptcha_generate_captcha
sub _get_json_by_url {
my $agent = LWP::UserAgent->new();
my $resp = $agent->get($_[0]);
return 'request failed' unless $resp->is_success;
my $json = eval {
decode_json($resp->
decoded_content);
};
return 'JSON parsing failed' if $@;
return $json;
}
sub _pack_params {
my ($hash) = @_;
my @pairs;
for my $key (keys %$hash) {
push @pairs, join('
=> 1, # include results
format => 'XML', # or JSON
);
print $response;
=head1 DESCRIPTION
Search::OpenSearch::Response::XML serializes to XML fo
onsoleLogger;
use Mojo::Base 'Mojolicious::Plugin';
use Mojo::ByteStream;
use Mojo::JSON qw(decode_json encode_json);
our $VERSION = 0.06;
has logs => sub {
return {
fatal => [],
info =>
my $self = shift;
# Patched Nov 23, 2014 to work with JSON
return if $self->res->headers->content_type eq 'application/json';
my $logs = $plugin->logs;
# Leave static conte
}
);
}
sub _format_msg {
my $msg = shift;
return ref($msg)
? "console.log(" . encode_json($msg) . "); "
: "console.log(" . Mojo::ByteStream->new($msg)->quote . "); ";
}
1;
=head1 NA
onse::ExtJS;
use Moose;
use Carp;
extends 'Search::OpenSearch::Response::JSON';
use Types::Standard qw( HashRef Bool );
use JSON;
use Sort::SQL;
our $VERSION = '0.409';
has 'metaData' => ( is => 'rw
debug
? JSON->new->utf8->pretty(1)->encode($resp)
: encode_json($resp);
}
1;
__END__
=head1 NAME
Search::OpenSearch::Response::ExtJS - provide search results in JSON format for Ext
de results
t => 'ExtJS', # or JSON, XML
);
print $response;
=head1 DESCRIPTION
Search::OpenSearch::Response::ExtJS serializes to JSON suitable
for the ExtJS Javascript library.
=
use WWW::Challonge;
use WWW::Challonge::Match::Attachment;
use Carp qw/carp croak/;
use JSON qw/to_json from_json/;
sub __args_are_valid;
=head1 NAME
WWW::Challonge::Match - A class representing a
Make the PUT call:
my $response = $client->request(WWW::Challonge::__json_request(
"$HOST/tournaments/$url/matches/$id.json", "PUT", $params));
# Check for any errors:
WWW::Challonge::__han
tches/$id.json?api_key=$key");
# Check for any errors:
WWW::Challonge::__handle_error $response if($response->is_error);
# If not, save it and then return it:
$self->{match} = from_json($respons
s;
use WWW::Challonge;
use HTTP::Request::Common qw/POST/;
use Carp qw/carp croak/;
use JSON qw/to_json from_json/;
sub __args_are_valid;
sub __is_kill;
=head1 NAME
WWW::Challonge::Match::Attachmen
keys %{$args};
my $request = POST(
"$HOST/tournaments/$url/matches/$match_id/attachments/$id.json",
"Content-Type" => 'form-data',
"Content" => [ "api_key" => $key, @params ],
);
$request->
all:
my $response = $client->delete(
"$HOST/tournaments/$url/matches/$match_id/attachments/$id.json?api_key=$key");
# Check for any errors:
WWW::Challonge::__handle_error $response if($response-
use 5.010;
use strict;
use warnings;
use WWW::Challonge;
use Carp qw/carp croak/;
use JSON qw/to_json from_json/;
sub __is_kill;
sub __args_are_valid;
=head1 NAME
WWW::Challonge::Participant - A
e the PUT request:
my $response = $client->request(WWW::Challonge::__json_request(
"$HOST/tournaments/$url/participants/$id.json", "PUT", $params));
# Check for any errors:
WWW::Challonge::__han
he POST call:
my $response = $client->request(WWW::Challonge::__json_request(
"$HOST/tournaments/$url/participants/$id/check_in.json", "POST",
$params));
# Check for any errors:
WWW::Challonge
t;
use LWP::UserAgent;
use Carp qw/carp croak/;
use JSON qw/to_json from_json/;
use 5.010;
use strict;
use warnings;
sub __handle_error;
sub __json_request;
=head1 NAME
WWW::Challonge - Perl wrapp
to get some content and check the response code:
my $response = $client->get("$HOST/tournaments.json?api_key=$key");
# Check for any errors:
WWW::Challonge::__handle_error $response if($response-
->{key};
my $client = $self->{client};
# The intial request URL:
my $req = "$HOST/tournaments.json?api_key=$key";
# Loop through the options (if any) and add them on:
for my $option(keys %{$opt
se WWW::Challonge::Participant;
use WWW::Challonge::Match;
use Carp qw/carp croak/;
use JSON qw/to_json from_json/;
sub __is_kill;
sub __args_are_valid;
=head1 NAME
WWW::Challonge::Tournament - A c
# Make the PUT request:
my $response = $client->request(WWW::Challonge::__json_request(
"$HOST/tournaments/$url.json", "PUT", $params));
# Check for any errors:
WWW::Challonge::__handle_error
hallonge::HOST;
# Make the DELETE call:
my $response = $client->delete("$HOST/tournaments/$url.json?api_key=$key");
# Check for any errors:
WWW::Challonge::__handle_error $response if($response-
package POE::Filter::JSONMaybeXS;
our $AUTHORITY = 'cpan:GETTY';
# ABSTRACT: A POE filter using JSON::MaybeXS
$POE::Filter::JSONMaybeXS::VERSION = '0.002';
use Carp;
use JSON::MaybeXS;
use strict;
us
# BUFFER
JSON::MaybeXS->new( %opts ) # OBJ
], ref $class || $class );
}
sub get {
my ($self, $lines) = @_;
my $ret = [];
foreach my $json (@$lines) {
if ( my $data
= eval { ($self->[ OBJ ]->decode( $json )) } ) {
push( @$ret, $data );
} else {
warn "Couldn't convert json: $@";
}
}
return $ret;
}
sub get_one_start {
my ($self, $lines) =
p::cpanoutdated>
=item L<Dist::Milla>
=back
=head2 DATA SERIALISER
=over
=item L<JSON::MaybeXS>
=item L<JSON>
=item L<XML::Twig>
=item L<XML::LibXML>
=item L<XML::Toolkit>
=item L<YAML>
=it
my $self = shift;
my $config_path = $self->app->config_file;
my $data = {
json => $self->json->encode(YAML::XS::LoadFile($config_path)),
};
my $build = $self->app->build_root;
rint($javascript);
}
sub make_url_map_js {
my $self = shift;
my $data = {
json => $self->json->encode($self->config->url_map),
};
my $build = $self->app->build_root;
my $j
stant coffee_files => [];
use constant js_files => [qw(
jquery.js
jquery-ui.js
jquery-json.js
jquery.cookie.js
jquery.jemplate.js
jemplate.js
cog.js
config.js
url-m
ed on url
# Return results or OK
my $self = shift;
$self->env(shift);
$self->read_json;
my $path = $self->env->{PATH_INFO};
my $post_map = $self->config->post_map;
my ($reg
plication/json' ],
[ $self->json->encode($result) ]
];
}
else {
return [ 200, [ 'Content-Type' => 'text/plain' ], [ $result ] ];
}
}
sub response_json {
my
# System singleton object pointers.
my $app;
my $config;
my $maker;
my $runner;
my $webapp;
my $json;
# The config reference must be initialized at startup.
$Cog::Base::initialize = sub {
$app
a set up JSON object
sub json {
$json ||= do {
require JSON;
my $j = JSON->new;
$j->allow_blessed;
$j->convert_blessed;
$j;
};
return $json;
}
1;
r;
use strict;
use warnings;
our $VERSION = '0.03';
use LWP::UserAgent;
use HTTP::Request;
use JSON;
use Want;
use URI;
use WWW::RabbitMQ::Broker::Shovel;
sub new
{
my $class = shift;
my $self
lication/json; charset=UTF-8');
$req->authorization_basic($self->{username}, $self->{password});
my $parser = JSON->new->utf8(1);
my $json = $parser->encode($args);
$req->content($json);
my $
package Test::JsonAPI::Autodoc::Request;
use strict;
use warnings;
use utf8;
use Carp;
use JSON;
use URL::Encode qw/url_params_flat/;
sub new {
my ($class) = @_;
bless {
}, $class;
}
su
ontent_type;
my $is_json = 0;
if ($content_type =~ m!^application/json!) {
$body = to_json(from_json($req->decoded_content), { pretty => 1 });
$is_json = 1;
}
my $tar
method => $req->method,
parameters => $self->_parse_request_parameters($body, $is_json, $param_description),
path => $req->uri->path,
query => $req->uri-
=item App::cpanoutdated
=item Dist::Milla
=back
=head2 DATA SERIALISER
=over
=item JSON::MaybeXS
=item JSON
=item XML::Twig
=item XML::LibXML
=item XML::Toolkit
=item YAML
=item YAML::Tiny