nt::JSONRPC::Lite;
use strict;
use warnings;
use base 'Exporter';
our $VERSION = '0.15';
our @EXPORT = qw/jsonrpc_client jsonrpc_server/;
use AnyEvent::JSONRPC::Lite::Client;
use AnyEvent::JSONRPC:
:Lite::Server;
sub jsonrpc_client($$) {
my ($host, $port) = @_;
AnyEvent::JSONRPC::Lite::Client->new(
host => $host,
port => $port,
);
}
sub jsonrpc_server($$) {
my
nt::JSONRPC::Lite::Server->new(
address => $address,
port => $port,
);
}
1;
__END__
=encoding utf-8
=for stopwords TCP TCP-based JSONRPC RPC
=head1 NAME
AnyEvent::JSONRPC:
);
use JSON;
my $json = JSON->new;
# describe infalte
__PACKAGE__->schema->inflate_column(
'data',
{
inflate => sub { $json->allow_nonref->enc
ode($_[0]) },
deflate => sub { $json->utf8(1)->decode($_[0]) },
}
);
# =============================================================
# in main code
packag
astFMAPI;
use strict;
use warnings;
use v5.10;
use LWP::UserAgent;
use Digest::MD5 'md5_hex';
use JSON::XS;
use YAML::Syck;
use File::Slurp;
use File::Path 'make_path';
use File::HomeDir 'my_home';
us
y $file = shift;
my $json = encode_json(shift);
write_file($file, $json);
}
sub loadfile {
my $file = shift;
my $json = read_file($file);
decode_json($json);
}
#{{{
our $methods =
}
}
$params{method} = $method;
$params{api_key} = $api_key;
$params{format} = "json" unless $params{format} || $xml;
delete $params{format} if $params{format} && $params{format}
rict;
use warnings;
use v5.10;
use FindBin '$Bin';
use lib "$Bin/../lib";
use Net::LastFMAPI;
use JSON::XS;
use YAML::Syck;
die "usage: $0 user.whatEver something=nothing nothing=Some Things etc=etc\
oogle::Language;
use 5.006;
use strict;
use warnings;
our $VERSION = '0.14';
use Carp ();
use JSON 2.0 ();
use LWP::UserAgent;
use URI;
use constant GOOGLE_DETECT_URL => 'http://ajax.googleapi
$value;
}
}
for (qw'json ua') {
if (defined(my $value = delete $conf{$_})) {
$self->$_($value);
}
}
unless ($self->json) {
$self->json(JSON->new);
}
unless ($self->
sub json {
my $self = shift;
if (@_) {
my $json = shift;
Carp::croak q{'json' requires an object based on 'JSON'}
unless $json && $json->isa('JSON');
$self->{json} = $json;
;
$type = 'json' unless $type;
open my $fh, '<:encoding(utf-8)', $file or die "opening $file - $!";
my $txt = do { local $/; <$fh> };
if($type eq 'json') {
require JSON;
return JSON->new->deco
nce;
use Moose;
use Bio::Chado::Schema;
use File::Spec::Functions;
use App::Mimosa::Database;
use JSON::Any;
use Data::Dumper;
use namespace::autoclean;
BEGIN { extends 'Catalyst::Controller' };
sub
$mimosa_sequence_set_id, $name ) = @_;
my $bcs = $c->model('BCS');
my $return_json = ( $name =~ m/\.json$/ );
$name =~ s/\.txt$//g;
$name =~ s/\.fasta$//g;
# Mimosa resultsets
qIO;
use Moose;
use Bio::Chado::Schema;
use File::Spec::Functions;
use App::Mimosa::Database;
use JSON::Any;
use namespace::autoclean;
BEGIN { extends 'Catalyst::View::Bio::SeqIO' };
__PACKAGE__->c
PI::Result::VERSION = '0.01';
}
# ABSTRACT: RabbitMQ Management API result object
use Moo;
use JSON::Any;
has 'response' => (
handles => {
code => 'code',
raw_content =
zy => 1,
);
has '_json' => (
builder => '_build__json',
is => 'ro',
isa => sub { die 'must be a JSON::Any, but is ' . ref $_[0] unless ref $_[0] eq 'JSON::Any' },
lazy
1,
);
sub _build__json {
my ($self) = @_;
return JSON::Any->new;
}
sub _build_content {
my ($self) = @_;
if ( $self->raw_content ) {
return $self->_json->decode( $self->raw
bbitMQ management plugin
use Moo;
use Carp qw(croak);
use HTTP::Headers;
use HTTP::Request;
use JSON::Any;
use LWP::UserAgent;
use Net::RabbitMQ::Management::API::Result;
use URI;
has 'ua' => (
( $self, $uri ) = @_;
$self->{url} = URI->new("$uri");
},
);
has '_json' => (
builder => '_build__json',
is => 'ro',
lazy => 1,
);
sub request {
my ( $self, %ar
$self->username, $self->password );
if ($data) {
my $json = $self->_json->encode($data);
$request->content($json);
}
$request->header( 'Content-Length' => length $reques
troller::REST'; }
__PACKAGE__->config(
namespace => 'api/1.0',
default => 'application/json',
);
=head1 NAME
CPAN::Mini::Inject::REST::Controller::API::Version1_0
=head1 DESCRIPTION
Cat
odule => $module, version => $version};
# Add all modules listed in META.json / META.yml
if (my $meta = _load_meta($newfile)) {
while (my ($module,
$archive->extract(to => "$vol/$dir");
if (my @meta = File::Find::Rule->file->name('META.json')->in("$vol/$dir")) {
return Parse::CPAN::Meta->load_file(shift @meta);
}
if (my
/;
use Mojo::JSON;
use Carp qw/croak/;
__PACKAGE__->attr(qw/response/);
__PACKAGE__->attr('json' => sub { Mojo::JSON->new });
__PACKAGE__->attr( data => sub { my $self=shift;$self->json->decode($sel
representing the response from put.io
=head2 json
JSON object for deserializing. Defaults to a plain L<Mojo::JSON>.
=head2 data
The deserialized JSON body.
=head1 METHODS
=head2 count
Number
::JSON;
use Mojo::URL;
use WebService::PutIo::Result;
use Carp qw/croak/;
__PACKAGE__->attr([qw/api_key api_secret/]);
__PACKAGE__->attr(ua => sub { Mojo::UserAgent->new; });
__PACKAGE__->attr(json =
> sub { Mojo::JSON->new; });
sub request {
my ($self,$class,$method,%params)=@_;
croak "Must set api_key and api_secret" unless $self->api_key && $self->api_secret;
$params ||= ();
my $data={
a
od")
->query(method=>$method);
my $tx=$self->ua->post_form( $url => { request => $self->json->encode($data) } );
if (my $res=$tx->success) {
return WebService::PutIo::Result->new( respons
'Test::Bot';
with 'Test::Bot::Source';
use AnyEvent;
use Twiggy::Server;
use Plack::Request;
use JSON;
use DateTime::Format::ISO8601;
use Test::Bot::Commit;
use Carp qw/croak/;
has '_http_server' =>
got a set of commits
sub parse_payload {
my ($self, $payload) = @_;
my $parsed = decode_json($payload) or return;
my @commits;
foreach my $commit_info (@{ $parsed->{commits} || []})
is => 'ro',
isa => Serializer,
required => 1,
default => 'JSON',
coerce => 1,
);
has destination => (
is => 'rw',
isa => 'Str
Mini::Inject::REST::Client::API;
use Moose;
use Carp qw/confess/;
use HTTP::Request::Common;
use JSON;
use MIME::Base64;
use REST::Client;
use Try::Tiny;
use URI;
has 'host' => (isa => 'Str', is
----------
sub process {
my ($self, $response) = @_;
my $content = try {
decode_json($response->responseContent);
} catch {
$response->responseContent;
};
ocal $ENV{PERL_ANYEVENT_MODEL} = 'Perl';
require AnyEvent;
require IO::Socket::Multicast;
require JSON;
my $bailout = AnyEvent->condvar;
my $timer = AnyEvent->timer( interval => $freq , cb => \
ined(my $m = $q->dequeue_nb) ) {
print STDERR "Got message '$m'";
my $msg = JSON::encode_json( { type=>'chat' , body=>$m , from=>$0.$$ } );
$c->mcast_send( $msg , '239.255.255.
strict;
use AnyEvent;
use AnyEvent::Socket;
use AnyEvent::Handle;
use IO::Socket::Multicast;
use JSON;
use Carp qw( cluck );
$|++;
#use Padre::Swarm::Transport::Multicast;
#my $mc = Padre::Swarm::T
,
trustme => "relay-$$-".time(),
};
$swarm->push_write( json => $message );
$swarm->push_read( json => \&swarm_ready );
}
sub swarm_ready {
my ($handle ,$messag
$handle->push_write( json => {
type => 'promote',
from => $handle->{token},
service => 'relay',
} );
$handle->push_write( json => {
type => 'disco'
package Padre::Plugin::Swarm::Transport::Local::Multicast::Service;
use strict;
use warnings;
use JSON;
use Padre::Wx ();
use Padre::Task ();
use Padre::Logger;
use Padre::Swarm::Message;
use IO:
::Functions qw( catfile catdir no_upwards );
use File::Copy qw( copy );
use Cwd qw( getcwd );
use JSON::XS;
if ( @ARGV != 2 ) {
die "Usage: perl update_snowstem.pl SNOWBALL_SVN_CO LUCY_SNOWSTEM_D
#define H_LIBSTEMMER
$libstemmer_h_content
#endif /* H_LIBSTEMMER */
END_STUFF
# Write tests.json file. Only include 10 sample tests for each language to
# save space -- we assume that Snowball
;
}
my $json_encoder = JSON::XS->new->pretty(1)->canonical(1);
my $json = $json_encoder->encode( \%tests );
my $tests_json_path = catfile( $dest_dir, 'source', 'test', 'tests.json' );
op