= '0.10';
use Beekeeper::Worker ':log';
use base 'Beekeeper::Worker';
use Beekeeper::JSONRPC::Error;
use JSON::XS;
sub authorize_request {
my ($self, $req) = @_;
if ($req->{method} eq '_
ub {
my ($payload_ref, $properties) = @_;
$self->on_worker_status( decode_json($$payload_ref)->[1] );
},
on_suback => sub {
my ($success) = @_;
ueue.*" );
}
}
sub reject_request {
my ($self, $params, $req) = @_;
# Just return a JSONRPC error response
if ($req->mqtt_properties->{'auth'}) {
# When client provided some
ly. In order to add a LogTail worker to a
pool it must be declared into config file C<pool.config.json>.
=head1 METHODS
=head3 tail ( %filters )
Returns all buffered entries that match the filter c
s> and C<on_error> must be coderefs and will receive respectively
L<Beekeeper::JSONRPC::Response> and L<Beekeeper::JSONRPC::Error> objects as arguments.
=head1 SEE ALSO
L<bkpr-log>, L<Beekeeper::Se
ds_config) {
die "No bus with role '$frontend_role' was found into config file bus.config.json\n";
}
$self->{wait_frontends_up} = AnyEvent->condvar;
# Create a connection to ever
y. In order to add Router workers to a pool
these must be declared into config file C<pool.config.json>:
[
{
"pool_id" : "myapp",
"bus_id" : "backend",
"workers
package Beekeeper::Config;
use strict;
use warnings;
our $VERSION = '0.10';
use JSON::XS;
use Carp;
my %Cache;
my $Config_dir;
sub set_config_dir {
my ($class, $dir) = @_;
croak "Couldn
s ($bus_id);
my $config = $class->read_config_file( 'bus.config.json' );
croak "Couldn't read config file bus.config.json: file not found\n" unless defined ($config);
my %bus_cfg = map
($pool_id);
my $config = $class->read_config_file( 'pool.config.json' );
croak "Couldn't read config file pool.config.json: file not found\n" unless defined ($config);
my %pool_cfg = ma
per::JSONRPC::Error;
use strict;
use warnings;
our $VERSION = '0.10';
use overload '""' => sub { $_[0]->{error}->{message} };
sub new {
my ($class, %args) = @_;
bless {
jsonrpc =
uccess { 0 }
sub TO_JSON { return { %{$_[0]} } }
sub parse_error {
shift->new(
code => -32700,
message => "Parse error",
data => "Invalid JSON was received by the
ft->new(
code => -32600,
message => "Invalid request",
data => "The JSON sent is not a valid request object.",
@_
);
}
sub request_timeout {
shift->new(
package Beekeeper::JSONRPC::Response;
use strict;
use warnings;
our $VERSION = '0.10';
sub new {
my $class = shift;
bless {
jsonrpc => '2.0',
result => undef,
id
ub success { 1 }
1;
__END__
=pod
=encoding utf8
=head1 NAME
Beekeeper::JSONRPC::Response - Representation of a JSON-RPC response
=head1 VERSION
Version 0.09
=head1 SYNOPSIS
my $client =
bjects of this class represent a JSON-RPC response (see L<http://www.jsonrpc.org/specification>).
When an RPC call is made the worker replies with a L<Beekeeper::JSONRPC::Response> object
if the invo
rvice::Rackspace::CloudFiles::ConnCache;
use LWP::UserAgent::Determined;
use URI::QueryParam;
use JSON::Any;
use Carp qw(confess);
our $VERSION = '2.03';
my $DEBUG = 0;
has 'user' => ( is => 'ro'
f = shift;
my $request = HTTP::Request->new( 'GET',
$self->storage_url . '?format=json',
[ 'X-Auth-Token' => $self->token ] );
my $response = $self->_request($request);
error' if !$response->is_success;
my @containers;
foreach my $container_data ( @{JSON::Any->from_json($response->content)} ) {
push @containers, $self->container(%{$container_data});
her categories easily.
=over 4
=cut
package PApp::Util;
use Carp;
use URI;
use Socket ();
use JSON::XS;
use base 'Exporter';
BEGIN {
$VERSION = 2.3;
@EXPORT = qw(dumpval uniq);
@EXPORT_
}
=item $ref = decode_json $json
Converts a JSON string into the corresponding perl data structure.
=cut
*decode_json = \&JSON::XS::decode_json;
=item $json = encode_json $ref
Converts a perl d
ata structure into its JSON representation.
=cut
*encode_json = \&JSON::XS::encode_json;
=item digest(args...)
Calculate a SHA1 digest and return it base64-encoded. The result will
always be 27 ch
CT: A tiny microservice builder
use 5.008001;
use warnings;
use strict;
use Carp qw(croak);
use JSON::MaybeXS ();
use WWW::Form::UrlEncoded qw(parse_urlencoded);
use Plack::Request;
my %methods_for
hod} = $coderef;
}
my $json = JSON::MaybeXS->new->utf8->allow_nonref;
my $response = sub {
my ($code, $raw) = @_;
my $body = [ eval { $json->encode($raw) } ];
if
$code = 500;
$body = [ $json->encode("couldn't encode response: $@") ];
}
[ $code, [ 'Content-type' => 'application/json' ], $body ]
};
sub {
my (
package Zabbix::Tiny;
use strict;
use warnings;
use Moo;
use Carp;
use LWP;
use JSON;
use version;
our $VERSION = "2.0.1";
has 'server' => (
is => 'rw',
required => 1,
);
has 'user' =>
_response' => ( is => 'ro' );
has 'last_response' => ( is => 'ro' );
has 'json_request' => ( is => 'ro' );
has 'json_response' => ( is => 'ro' );
has 'verify_hostname' => ( is => 'rw', defaul
y' => ( is => 'rw' );
has 'request' => ( is => 'ro' );
has 'json_prepared' => ( is => 'ro' );
has 'json_executed' => ( is => 'ro', default => sub { 0 } );
has 'redo' =
4: .3
> 4: .SHs
> 4: .act
> ...
> 88: .json
> 108: .tml
> 136: .xml
> 224: .yml
> 332: .xs
>
r for testing
use 5.010;
use namespace::autoclean;
use File::Which qw(which);
use JSON::MaybeXS qw(JSON encode_json);
use Path::Tiny;
use POSIX qw(WNOHANG);
use Carp qw(croak);
use HTTP::Tiny v0.014
port = $current_port;
}
# Make sure we return a scalar with just numeric data so it gets
# JSON encoded without quotes.
return $port;
}
sub _generate_name {
my ($wordcount) = @_;
join '-
self->enable_remote_exec) {
$config{disable_remote_exec} = $self->enable_remote_exec ? JSON->false : JSON->true;
}
my $configpath;
if ($self->has_datadir()) {
$config{data_dir} = $self
use 5.012;
use Moo;
use Mojo::UserAgent;
use Encode qw( encode decode );
use Mojo::JSON 'decode_json', 'encode_json';
use Net::Protocol::OBSRemote;
use Future::Mojo;
our $VERSION = '0.03';
use Filt
ub($tx,$msg) {
# At least from Windows, OBS sends Latin-1 in JSON
my $payload = decode_json(encode('UTF-8',decode('Latin-1', $msg)));
if( my $type = $p
message( $id, sub($response) {
$res->done($response);
});
$self->tx->send( encode_json( $msg ));
return $res
};
=head1 METHODS
For the OBS methods, see L<Net::Protocl::OBSRemote>
'hidden' => $JSON::false,
'selected' => $JSON::false,
}
o;
no indirect;
use URI;
use URI::QueryParam;
use Future::AsyncAwait;
use Net::Async::HTTP;
use JSON::MaybeUTF8 qw(:v1);
use Syntax::Keyword::Try;
use Scalar::Util qw(blessed);
use WebService::Asyn
if (blessed($payload) && $payload->can('content')) {
if (my $resp = eval { decode_json_utf8($payload->content) }) {
my $errors = $resp->{errors} // [];
row a generic error
die 'Unable to retrieve response.';
};
my $response = decode_json_utf8($res->decoded_content);
return $response->[0];
}
=head2 configure
Configures the inst
d>
=cut
# See https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/comments.json
# for the non-code version of this
sub GetVersion($self) {
return $self->nextMessage({'reque
w(
{ grammar => $parser->{grammar},
semantics_package => 'MarpaX::JSON::Actions'
}
);
my $length = length $string;
for (
my $pos = $re->read
( my $pos = $re->read( \$string ); $pos < $length...)
my $per_parse_arg = bless {}, 'MarpaX::JSON::Actions';
my $value_ref = $re->value($per_parse_arg);
return ${$value_ref};
=for Marpa:
ew_attrs) {
$self->published_state->%* = ( $self->published_state->%*, @new_attrs );
$_->send({ json => { state => $self->published_state } })
for values $self->viewers->%*;
}
sub startup($self)
state(viewer_count => scalar keys $self->viewers->%*);
}
elsif (defined $key) {
$c->send({ json => { key_incorrect => 1 } });
}
}
$c->stash('roles', join ',', keys %roles);
$self->log->inf
ed as %s", $id, $c->tx->remote_address, $c->stash('roles'));
$c->send({ json => { roles => [ keys %roles ] } });
$c->on(json => sub($c, $msg, @) { $c->app->on_viewer_message($c, $msg) });
$c->on(
B;
use Mojo::Base -base;
use Mojo::URL;
use Mojo::UserAgent;
use Mojo::IOLoop;
use Mojo::JSON qw(encode_json);
use Carp qw(croak carp);
use URI;
use Scalar::Util qw(reftype);
use Storable qw(dc
lt->json;
}
sub all_docs_p {
my $self = shift;
my $query = $self->_to_query(shift);
return $self->_call_p('_all_docs' . $query, 'get_p')
->then(sub { return shift->res->json });
return $self->_find($sc)->_call_p('_find', 'post_p', $sc)
->then(sub { return shift->res->json });
}
sub get {
my $self = shift;
my $id = shift;
$id = $$id while (reftype($id))
#ABSTRACT: Subroutines for FR24-Bot
use v5.12;
use warnings;
package FR24::Utils;
use JSON::PP;
use Exporter qw(import);
use HTTP::Tiny;
use File::Which;
# Export version
our @EXPORT = qw($VERSION);
o
running'} = $1;
}
}
}
sub parse_flights {
my ($json_text, $test) = @_;
if (defined $test and $test > 0) {
$json_text = '{"485789":["485789",51.94,0.9666,64.76496,38275,539,"6
if (length($json_text) == 0) {
return $answer;
}
my $json = JSON::PP->new->utf8->pretty->canonical;
my $json_data;
eval {
$json_data = $json->decode($json_text);