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
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:/
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,
});
ckage App::AltSQL::Term;
use Moose;
use Term::ReadLine::Zoid;
use Data::Dumper;
use JSON qw(encode_json decode_json);
use Term::ANSIColor;
with 'App::AltSQL::Role';
with 'MooseX::Object::Pluggable';
return;
}
open my $out, '>', $fn or die "Can't open $fn for writing: $!";
print $out encode_json({ history => [ $self->term->GetHistory ] });
close $out;
}
sub read_history {
my ($self, $fn)
";
local $\ = undef;
my $data = <$in>;
close $in;
my @history;
eval {
my $parsed = decode_json($data);
@history = @{ $parsed->{history} };
};
if (my $exception = $@) {
$self->log_error("
ord, which
can be represented in a variety of underlying syntaxes, such as ANVL,
Turtle, XML, and JSON. The ERC elements include Dublin Core Kernel
metadata.
=head1 SEE ALSO
A Metadata Kernel for E
ead3 L<HTML::Builder> 0.006
=head3 L<Text::Haml>
=head3 L<Template>
=head3 L<Template::Plugin::JSON::Escape>
=head1 AUTHOR
Chris Weyl <cweyl@alumni.drew.edu>
=head1 COPYRIGHT AND LICENSE
This s
mber of values for keys (eg,
# for turtle, $$o{subject}). $recnum is useful for
# outputting json separators (eg, no comma if $recnum eq 1)
# or record numbers in comments (eg, if $$o{verbose})
Specific conversions, based on an "output multiplexer"
L<File::OM>, are possible to XML, Turtle, JSON, CSV, and PSV (Pipe
Separated Value), and Plain unlabeled text.
The B<OM> package can also be us
ively. Array
element 1 always contains a string naming the format of the input, such
as, "ANVL", "JSON", "XML", etc.
The remaining triples are free form except that the values will have been
drawn fr
:Dump::Format;
=head1 Name
Dump AltSQL Plugin
=head1 Synopsis
Usage:
.dump <file>.[csv|html|json|pl|pm|sql|xls|xml|yaml|yml] <query>;
=head1 Description
This plugin will allow you to dump out
</td><td>Pie</td></tr><tr><td>3</td><td>Cow</td></tr></table>
=end html
JSON:
.dump out.json select * from users;
out.json:
[{"name":"Moo","id":"1"},{"name":"Pie","id":"2"},{"name":"Cow","id":"
or("Usage: .dump \$filename \$sql");
$self->log_error("Available formats: csv, xls, html, json, [pl|pm], sql, xml, [yml|yaml]");
return 1; # handled, won't run this as a query
}
, where schema data will be cached. Ignored if schema_cache_policy is NONE. The file will be in JSON format. No default provided.
=back
=cut
sub get_global_option {
my $inv = shift;
my $
Cache::File;
use DateTime;
use DateTime::Format::HTTP;
use CPAN::DistnameInfo;
use YAML::XS;
use JSON::XS;
use CPAN::Source::Dist;
use CPAN::Source::Package;
use constant { DEBUG => $ENV{DEBUG} };
return unless $self->mirror;
# get 07mirror.json
my $json = $self->fetch_mirrors;
my $data = decode_json( $json );
return $data;
};
sub debug {
say "[D
ist_txt ) );
}
sub recent {
my ($self,$period) = @_;
my $json = $self->fetch_recent( $period );
return decode_json( $json );
}
sub parse_modlist {
my ($self,$modlist_data) = @_;
" Inserts raw data as the value of the specified key.",
" Note that <data> is usually JSON.",
],
putref => [
"putref <key> <perl data>",
" Inserts a serialized Perl d
{
print $o "Usage: getref <key>\n";
return
}
my $ser = Bot::Cobalt::Serializer->new('JSON');
unless ( $db->dbopen(ro => 1) ) {
print $o "Database open failure\n";
return
}
f;
eval { $ref = $ser->thaw($item) };
if ($@) {
print $o "Could not thaw value; maybe not JSON?\n";
return
}
unless (ref $ref) {
print $o "Thawed value not a reference\n";
r
uth2;
use Moose;
use MooseX::Types::Common::String qw(NonEmptySimpleStr);
use LWP::UserAgent;
use JSON::Any;
use Moose::Util;
# ABSTRACT: Authenticate against OAuth2 servers
has [qw(grant_uri token
nfo->{state} if exists $auth_info->{state};
$uri->query_form($query);
return $uri;
}
my $j = JSON::Any->new;
sub request_access_token {
my ( $self, $callback_uri, $code, $auth_info ) = @_;
m
uery);
my $response = $self->ua->get($uri);
return unless $response->is_success;
return $j->jsonToObj( $response->decoded_content );
}
1;
__END__
=pod
=head1 NAME
Catalyst::Authentication::C
e::Token;
use Moose::Role;
use JSON::Any;
# ABSTRACT: A role for building token-building actions
with 'CatalystX::OAuth2::ActionRole::RequestInjector';
my $json = JSON::Any->new;
after execute =>
sub {
my($self, $controller, $c) = @_;
$c->res->body($json->objToJson($c->req->oauth2->query_parameters));
};
1;
__END__
=pod
=head1 NAME
CatalystX::OAuth2::ActionRole::Token - A role for buil
gin::Server::JSONRPC::Batch;
use strict;
use warnings;
use Class::Load ();
use HTTP::Body ();
our $VERSION = '0.02';
our $Method = 'system.handle_batch';
BEGIN {
my $class = 'JSON::RPC::Common
q 'ARRAY') {
return $class->new_from_data(
jsonrpc => '2.0',
id => scalar(time()),
method => $Catalyst::Plugin::Server::JSONRPC::Batch::Method,
params => $args[0]
);
up_engine {
my $app = shift();
$app->server->jsonrpc->add_private_method(
$Method => sub {
my ($c, @args) = @_;
my $config = $c->server->jsonrpc->config;
my $req = $c->req;
my $re
urity
filename
cpanid
extension
pathname
source_path
_parent
));
use JSON::XS;
use YAML::XS;
use URI;
use overload '""' => \&to_string;
# CPAN::DistnameInfo compatible
su
cpanid,
extension => $self->extension,
pathname => $self->pathname,
source_path => $self->source_path,
};
}
sub to_string {
return encode_json( $_[0]->data );
}
1;
package Google::GeoCoder::Smart;
require Exporter;
use LWP::Simple qw(!head);
use JSON;
our @ISA = qw(Exporter);
our @EXPORT = qw(geocode parse);
our $VERSION = 1.16;
=head1 NAME
Smart - Goo
ing.
This module only depends on LWP::Simple and JSON.
This version removes the depriciated homemade xml parsing and goes completely with the JSON format.
If you need the old xml version, the ol
}{lng};
It is helpful to know the format of the json returns of the api.
A good example can be found at http://www.google.com/maps/apis/geocode/json?address=1600+Amphitheatre+Parkway+Mountain+View,
XPORT_TAGS = ();
use Class::ReluctantORM::Exception;
use Lingua::EN::Inflect;
use Sub::Name;
use JSON;
our $DEBUG = 0;
=head1 SUBROUTINES
=cut
=head2 install_method('Class', 'method_name', $code
=head2 $json_string = json_encode($perl_ref);
Version-blind JSON encoder.
=cut
push @EXPORT_OK, 'json_encode';
sub json_encode {
if ($JSON::VERSION > 2) {
goto &JSON::to_json;
} e
goto &JSON::objToJson;
}
}
=head2 $perl_ref = json_decode($json_string);
Version-blind JSON decoder.
=cut
push @EXPORT_OK, 'json_decode';
sub json_decode {
if ($JSON::VERSION > 2)
se Carp;
use Class::ReluctantORM::Utilities qw(conditional_load_subdir read_file write_file json_encode json_decode);
our @POLICY_CLASSES;
BEGIN {
@POLICY_CLASSES = conditional_load_subdir(__PACK
= json_decode($raw);
}
sub write_cache_file {
my $self = shift;
my $filename = Class::ReluctantORM->get_global_option('schema_cache_file');
return unless $filename;
my $raw = json_e
use warnings;
use Carp;
use WebService::Face::Response;
use WebService::Face::Response::Tag;
use JSON;
use REST::Client;
=head1 NAME
WebService::Face::Client - Client to the Face.com REST API
=hea
et_header(Authorization => "Basic $creds");
# $self->set_header(Accept => "application/json");
return $self;
}
=head2 faces_detect ( \%params )
Returns tags for detected faces in one
.= "&$key=" . $params->{$key};
}
return $self->_process_response( 'GET', "/faces/detect.json?" . $self->_get_credential_parameters() . $parameters );
}
=head2 faces_train ( \%params )
Call