scroll} ||= '1m';
my $method = $params->{q} ? 'searchqs' : 'search';
my $as_json = delete $params->{as_json};
my $results = $es->$method($params);
my $self = {
_es =
max_score},
_facets => $results->{facets},
_eof => 0,
_as_json => $as_json,
};
return bless( $self, $class );
}
#===================================
sub ne
my @results = splice @{ $self->{_buffer} }, 0, $size;
return
$self->{_as_json} ? $self->{_es}->JSON->encode( \@results )
: $size == 1 ? $results[0]
:
nce::CampBX;
$Finance::CampBX::VERSION = '0.2';
use strict;
use warnings;
use LWP::UserAgent;
use JSON -support_by_pp;
sub ticker(){
return sendrequest("http://campbx.com/api/xticker.php");
}
sub
$url );
}
if ($response->is_success) {
my $content = $response->content;
my $json = new JSON;
return $json->utf8->decode($content);
} else {
return 0;
}
}
sub new {
my $package =
use JSON::RPC::Legacy::Client;
use Scalar::Util qw( blessed );
has endpoint => (is => "rw", default => sub { "http://127.0.0.1:8332/" });
has jsonrpc => (is => "lazy", default => sub { "JSON::RPC
y $self = shift;
my ($method, @params) = @_;
$self->_set_error(undef);
my $return = $self->jsonrpc->call($self->endpoint, {
method => $method,
params => \@params,
});
if (blessed
lf->_set_error(sprintf('HTTP %s', $self->jsonrpc->status_line));
return;
}
}
1;
__END__
=head1 NAME
Finance::Bitcoin::API - wrapper for the Bitcoin JSON-RPC API
=head1 SYNOPSIS
use Finance::
PI::Test;
use strict;
use warnings;
use base 'Exporter';
use Test::More;
use Path::Extended;
use JSON::XS;
use Groonga::API;
use Groonga::API::Constants qw/:all/;
use version;
no bytes;
our @EXPORT
n_test
indexed_table_test
load_into_table
version_ge
/,
@Test::More::EXPORT,
@JSON::XS::EXPORT,
@Groonga::API::Constants::EXPORT_OK,
);
our %TMPDIR;
our $ROOT;
sub version_ge {
table";
my $json = encode_json($data);
my $rc = Groonga::API::load($ctx, GRN_CONTENT_JSON,
$table_name, bytes::length($table_name),
undef, 0,
$json, bytes::length($json),
undef, 0
Plack::Request;
use Protocol::WebSocket::Handshake::Server;
use Protocol::WebSocket::Frame;
use JSON;
use HTML::Selector::XPath ();
use File::Basename qw(dirname);
use File::Spec::Functions qw(cat
buf);
while (my $message = $frame->next) {
my $data = JSON->new->decode($message);
$self->debug('message in:', $data);
(my ($action) = $req->path_info =~ m<^/(confirm|prompt)$>) {
my $args = eval { decode_json($req->parameters->{args}) } || [];
my $response = ( $self->{"on_$action"} || sub { re
=back
=head2 Recommended XS module for better performance
=over 4
=item JSON::XS is recommended
If you are using JSON.
=item HTTP::Parser::XS is recommended
If you are using Plack.
=item Li
head2 Recommended version to enable good feature
=over 4
=item Amon2 E<lt> 3.29 does not have
JSON hijacking detection.
=item Log::Minimal E<lt> 0.10 does not have
LM_COLOR
=item Log::Minimal
ct;
use warnings;
use Carp;
use Groonga::API;
use Groonga::API::Constants qw/GRN_CTX_USE_QL/;
use JSON::XS ();
no bytes;
use constant DEFAULT_PORT => 10041;
our $VERSION = $Groonga::API::VERSION;
s
x, $host, $port, 0);
croak "failed to connect to $host:$port ($rc)" if $rc;
}
$args{_json} = JSON::XS->new->utf8($args{encoding} ? 1 : 0);
bless \%args, $class;
}
sub do {
my ($self, @a
($self->{encoding}) {
$res = Encode::decode($self->{encoding}, $res);
}
eval { $self->{_json}->decode($res) } || $res;
}
sub ctx { shift->{_ctx} }
sub db { shift->{_db} }
sub DESTROY {
t ls-files
exclude_filename = README.pod ; skip this generated file
exclude_filename = META.json ; skip this generated file
[PruneCruft] ; default stuff to skip
[ManifestSkip]
as develop/requires
[MetaYAML] ; generate META.yml (v1.4)
[MetaJSON] ; generate META.json (v2)
[CPANFile] ; generate cpanfile
; build system
[ExecDir
t::GrowthForecast;
use strict;
use warnings;
use Carp;
use List::MoreUtils qw//;
use Furl;
use JSON::XS;
use Try::Tiny;
our $VERSION = '0.02';
#TODO: basic authentication support
sub new {
, $method, $code, $c, $list);
}
sub _check_response {
# check response body with "$c->render_json({ error => 1 , message => '...' })" style error status
my ($self, $url, $method, $code, $cont
;
}
return 1 unless $content;
my $error;
my $obj;
try {
$obj = decode_json($content);
if (defined($obj) and ref($obj) eq 'ARRAY') {
return $obj;
rp);
use attributes qw();
use URI::Escape;
our $VERSION = '0.4';
sub __jsonp_method {
my ($self,$req,$resultset,$rs,$jsonp_method_name,@args) = @_;
my ($primary) = $rs->result_source->prima
ride;
my $jsonp_method_coderef = exists $overrides->{$resultset}{$jsonp_method_name} || $object->can($jsonp_method_name);
if ( !$object->can($jsonp_method_name)
# if jsonp method is d
the overrides, we don't care if it has the 'JSONP' subroutine attribute
|| __method_is_jsonp($jsonp_method_coderef) ) {
# method has a 'JSONP' attribute, and was declared in the result
s::PinPayment;
use strict;
use warnings;
use Net::SSL;
use HTTP::Request;
use LWP::UserAgent;
use JSON;
our $VERSION = '0.04';
# build 4.1
sub new {
my ($class, %args) = (@_);
my $self = bless
rl);
$p->content_type('application/json');
$p->authorization_basic($api_key);
my $json_request = to_json( $self->{config}, {utf8 => 1} );
$p->content($json_request) unless $api eq 'refunds';
my $json_response;
if ($self->{response}->content) {
$json_response = from_json( $self->{response}->content, {utf8 => 1} );
$self->{json_response} = $json_response;
}
if ($json_res
83357'],
['Plack::Middleware::AxsLog' => '== 0.20', 'Missing \n'],
);
our @XS = (
['JSON' => 'JSON::XS'],
# ['PPI' => 'PPI::XS'], # I think PPI::XS is outdated.
['Plack' => 'HTTP::Par
S, ['Filesys::Notify::Simple', 'Linux::Inotify2'];
}
our @FEATURE = (
['Amon2' => '< 3.29', 'JSON hijacking detection.'],
['Log::Minimal' => '< 0.10', 'LM_COLOR'],
['Log::Minimal' => '< 0
use File::Spec;
use File::Copy;
use Term::ReadLine;
use Term::ReadLine::Perl;
use WWW::REST;
use JSON::XS;
use 5.010;
use utf8;
option 'from' => (
doc => 'Source directory to organize',
is
ift;
croak $self->status_line if $self->is_error;
my $ct = decode_json( $self->content );
return ref $ct eq 'ARRAY' ? $ct->[0] : $ct;
}
/*
* JSON Parser
*
* Copyright IBM, Corp. 2009
*
* Authors:
* Anthony Liguori <aliguori@us.ibm.com>
*
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
* See
QEMU_JSON_PARSER_H
#define QEMU_JSON_PARSER_H
#include "qemu-common.h"
#include "qapi/qmp/qlist.h"
#include "qapi/error.h"
QObject *json_parser_parse(QList *tokens, va_list *ap);
QObject *json_pars
use strict;
use warnings;
package Chat::iFly;
use HTTP::Thin;
use HTTP::Request::Common;
use JSON;
use URI;
use Ouch;
use Moo;
my $convert_to_string = sub { "$_[0]" };
=head1 NAME
Chat::iFly - An
"text/javascript">Drupal={};Drupal.settings={};Drupal.settings.drupalchat={};Drupal.settings='.to_json($self->init($user)).';</script>';
$out .= '<script type="text/javascript" src="' . $self->sta
$self, $user) = @_;
ouch(441, 'user is required', 'user') unless defined $user;
return to_json({(%{$user}, %{$self->get_key($user)})});
}
=head2 init( user )
This method is called by C<rende
/*
* QObject JSON integration
*
* Copyright IBM, Corp. 2009
*
* Authors:
* Anthony Liguori <aliguori@us.ibm.com>
*
* This work is licensed under the terms of the GNU LGPL, version 2.1 or la
ry.
*
*/
#ifndef QJSON_H
#define QJSON_H
#include <stdarg.h>
#include "qemu/compiler.h"
#include "qapi/qmp/qobject.h"
#include "qapi/qmp/qstring.h"
QObject *qobject_from_json(const char *string)
QObject *qobject_from_jsonf(const char *string, ...) GCC_FMT_ATTR(1, 2);
QObject *qobject_from_jsonv(const char *string, va_list *ap) GCC_FMT_ATTR(1, 0);
QString *qobject_to_json(const QObject *obj);
package WWW::NHKProgram::API::Provider::List;
use strict;
use warnings;
use utf8;
use JSON ();
use WWW::NHKProgram::API::Area qw/fetch_area_id/;
use WWW::NHKProgram::API::Service qw/fetch_service_i
.json",
{
area => $area,
service => $service,
date => $date,
},
$raw,
);
return $content if $raw;
return JSON::decode_json
/*
* JSON lexer
*
* Copyright IBM, Corp. 2009
*
* Authors:
* Anthony Liguori <aliguori@us.ibm.com>
*
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
* See th
U_JSON_LEXER_H
#define QEMU_JSON_LEXER_H
#include "qapi/qmp/qstring.h"
#include "qapi/qmp/qlist.h"
typedef enum json_token_type {
JSON_OPERATOR = 100,
JSON_INTEGER,
JSON_FLOAT,
JSON_
EYWORD,
JSON_STRING,
JSON_ESCAPE,
JSON_SKIP,
JSON_ERROR,
} JSONTokenType;
typedef struct JSONLexer JSONLexer;
typedef void (JSONLexerEmitter)(JSONLexer *, QString *, JSONTokenType, i
gs FATAL => 'all';
use Date::Calc qw(Add_Delta_YMDHMS Today_and_Now);
use HTTP::Tiny;
use JSON qw(decode_json);
use URI::Escape qw(uri_escape);
=head1 NAME
WWW::SEOGears - Perl Interface for SEOGea
rns undef on failure (sets $self->{error} with the proper error). Returns a hash with the decoded json data from the API server if successful.
=cut
sub _make_request_handler {
my $self = shift;
ror, 1);
}
my $json = eval{ decode_json($output); };
if ($EVAL_ERROR){
$self->_error('Failed to decode JSON - Invalid data returned from server: '.$output, 1);
}
return $json;
}
=head2 _make
ation in consumers
of this library, but may be useful for other purposes. All classes are set
to JSON format and File IO.
=head1 AUTHOR
Cory Watson, C<< <gphat@cpan.org> >>
=head1 ACKNOWLEDGEMENTS