$syn->on( 'all' => sub { $s->psws_reply( $c, @_ ) } );
$c->on(
json => sub {
$app->log->debug(
sprintf( "RCV from %s: %s"
'SNT to %s: %s', $client, np $res) );
$c->psws_clients->{$client}->{tx}->send( { json => $res } );
}
# now reply to sender
$res = $syn->notified($
}
$c->app->log->debug( sprintf( 'SNT to %s: %s', $id, np $res) );
$c->tx->send( { json => $res } );
}
}
1;
__END__
=pod
=head1 NAME
Mojolicious::Plugin::PubSub::WebSocket - Pl
);
# call ->to_json on the results object to get a data structure of errors
use Data::Dumper;
print Data::Dumper->Dump([$results->to_json], ['results_as_json']);
=head1 DESCRIPTION
ss()> will return false if a
single bit of data in the data structure is invalid. From there C<to_json()> can
be called on the C<$result> to get a data structure that has invalid fields as
keys and th
use Data::Dumper;
print Data::Dumper->Dump([$results->to_json], ['results_as_json']);
outputs:
$results_as_json = {
'meta' => {
See L</serializer>
above for the different ways this can be passed in. The default is to use the
JSON backend in canonical mode (sorted hash keys).
=item label [STRING]
A label for the cache as a w
IsSubcache;
use CHI::Driver::Role::Universal;
use CHI::Serializer::Storable;
use CHI::Serializer::JSON;
use CHI::Util qw(parse_duration);
use CHI::Types qw(:all);
use Digest::MD5;
use Encode;
use Hash
_serializer = CHI::Serializer::Storable->new();
my $default_key_serializer = CHI::Serializer::JSON->new();
my $default_key_digester = Digest::MD5->new();
my @common_params;
{
my %attr = (
lso compatible for POSTed data
(such as JSON POSTed data) although in the case of body data such as JSON we merely whitelist the fields
and structure since JSON can already support nested data structu
/strong_body>.
=head2 strong_data
The same as L</strong_body> except aimed at body data such as JSON post. Basically works
the same except the default for handling array values is to leave them al
lts = $dfv->check( $data );
if ( ! $results->success ) {
$c->stash->{json}{errors} = $results->to_json;
return;
}
# handle valid data
=head1 DESCRIPTION
Results of the
eturn $self->has_objects ? undef : $self->SUPER::success;
}
}
=head2 to_json
If this is an array of results, call to_json on each element and return an array
of the results. Otherwise, return a da
t
sub to_json {
my $self = shift;
my $json = [];
if ( $self->isa('ARRAY') ) {
foreach my $results ( @$self ) {
push @$json => $results->to_json;
}
} else {
$json = $self->
h" => ($code, $reason));
}
);
$s->tx->on(
json => sub {
my ( $tx, $msg ) = @_;
$s->{syn}->parse($msg);
}
)->catch( sub { $ret = 0 } )->wait;
return $ret;
}
sub _send {
shift->tx->send( { json => shift } );
}
sub _send_keepalive {
# send keepalive every inactivity_timeout/2
state
package CHI::Stats;
$CHI::Stats::VERSION = '0.61';
use CHI::Util qw(json_encode json_decode);
use List::Util qw(sum);
use Log::Any qw($log);
use Moo;
use strict;
use warnings;
has 'chi_root_class' =>
$_, int( $data{$_} ) ) : ( $_, $data{$_} ) }
keys(%data);
$log->infof( 'CHI stats: %s', json_encode( \%data ) );
}
sub format_time {
my ($time) = @_;
my ( $sec, $min, $hour, $mday,
{
chomp($line);
if ( my ($json) = ( $line =~ /CHI stats: (\{.*\})$/ ) ) {
my %hash = %{ json_decode($json) };
my $root_class = delete( $ha
atus) {
if ($client->info($self->get_name)) {
my $files = array($client->res->json("/files"));
# Init table
my $tbl = Text::SimpleTable->new(
ame");
return 0;
}
} else {
my $files = array($self->client->res->json("/files"));
my @tmp = sort {$a->{mtime} <=> $b->{mtime}} @$files;
$tarball_name =
ame");
return 0;
}
} else {
my $files = array($self->client->res->json("/files"));
my @tmp = sort {$a->{mtime} <=> $b->{mtime}} @$files;
$tarball_name =
mper;
use Data::UUID;
use Fcntl qw( :DEFAULT );
use File::Spec::Functions qw(catdir catfile);
use JSON::MaybeXS;
use Time::Duration::Parse;
use Try::Tiny;
use strict;
use warnings;
use base qw(Exporte
XPORT_OK = qw(
can_load
dump_one_line
fast_catdir
fast_catfile
has_moose_class
json_decode
json_encode
parse_duration
parse_memory_size
read_file
read_dir
unique_id
write_fil
emory size '$size'";
}
}
my $json = JSON::MaybeXS->new( utf8 => 1, canonical => 1 );
sub json_decode {
$json->decode( $_[0] );
}
sub json_encode {
$json->encode( $_[0] );
}
1;
__END__
5 $ =~ /(\d+)\.(\d+)/);
#
# used modules
#
use Encode qw(encode decode FB_CROAK LEAVE_SRC);
use JSON qw();
use MIME::Base64 qw(encode_base64 decode_base64);
use No::Worries::Die qw(dief);
use No::Wo
wn compression modules
$_CompressionAlgos, # known compression algorithms
$_JSON, # JSON object
);
%_CompressionModule = (
"lz4" => "LZ4",
"snappy" => "Snappy",
"zlib" => "Zlib",
);
$_CompressionAlgos = join("|", sort(keys(%_CompressionModule)));
$_JSON = JSON->new();
#+++############################################################################
#
5.006;
use strict;
use warnings;
use base 'Error::Helper';
use Module::List qw(list_modules);
use JSON;
=head1 NAME
Device::RAID::Poller - Basic RAID status poller, returning RAID disk devices, type
common options for both:
=over
=item * C<subprotocols> - A list of HTTP tokens (e.g., C<wamp.2.json>)
that stand for subprotocols that this endpoint can use via the WebSocket
connection.
=item * C
p_token = I<OBJ>->get_subprotocol()
Returns the negotiated subprotocol’s token (e.g., C<wamp.2.json>).
=cut
sub get_subprotocol {
my $self = shift;
if (!$self->{'_no_use_legacy'}) {
1.8 $ =~ /(\d+)\.(\d+)/);
#
# used modules
#
use Config::General qw(ParseConfig);
use JSON qw(from_json to_json);
use No::Worries::Die qw(dief);
use No::Worries::Export qw(export_control);
use No::W
) x (@_ || 1));
my($json, %cfg, $cfg);
foreach my $path (@paths) {
log_debug("loading file %s...", $path);
$json = $path =~ /\.json$/;
if ($json and substr($path, 0, 1
last;
}
}
if ($json) {
$cfg = from_json(file_read($path), { relaxed => 1 });
dief("unexpected JSON: %s", $path) unless ref($cfg) eq "HASH";
SEMBLING_SUCCESS_STATUS
);
use Smartcat::App::Utils;
use Carp;
use Log::Any qw($log);
use JSON qw/encode_json/;
# How many documents to delete at a time
# (there's a limitation on the number of the
{extract_id_from_name}){
my $file_id = &get_file_id( $path );
$meta_info = encode_json( { file_id => $file_id } );
}
my $documents = $self->app->project_api->upload_file( $pat
use strict;
use warnings;
package JSON::Schema::Draft201909::Error;
# vim: set ts=8 sts=2 sw=2 tw=100 et :
# ABSTRACT: (DEPRECATED) Contains a single error from a JSON Schema evaluation
our $VERSION
::clean;
extends 'JSON::Schema::Modern::Error';
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
JSON::Schema::Draft201909::Error - (DEPRECATED) Contains a single error from a JSON Schema evaluation
This module is deprecated in favour of L<JSON::Schema::Modern::Error>.
=head1 SUPPORT
Bugs may be submitted through L<https://github.com/karenetheridge/JSON-Schema-Draft201909/issues>.
I am also u
py/;
use File::Spec::Functions qw(catfile);
use IO::Uncompress::Unzip qw($UnzipError);
use JSON qw/encode_json/;
use Smartcat::Client::ProjectApi;
use Smartcat::Client::DocumentApi;
use Smartcat::Cli
use strict;
use warnings;
package JSON::Schema::Draft201909::Document;
# vim: set ts=8 sts=2 sw=2 tw=100 et :
# ABSTRACT: (DEPRECATED) One JSON Schema document
our $VERSION = '0.130';
use 5.016;
no
namespace::clean;
extends 'JSON::Schema::Modern::Document';
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
JSON::Schema::Draft201909::Document - (DEPRECATED) One JSON Schema document
=head1 VERS
his module is deprecated in favour of L<JSON::Schema::Modern::Document>.
=head1 SUPPORT
Bugs may be submitted through L<https://github.com/karenetheridge/JSON-Schema-Draft201909/issues>.
I am also
t::MQTT::Constants;
use JSON;
use File::Slurp;
use Test::SharedFork;
sub run {
my ($pkg, $file) = @_;
my $json = JSON->new;
my $data = read_file($file);
$data = $json->decode($data);
my $c
use strict;
use warnings;
package JSON::Schema::Draft201909::Result;
# vim: set ts=8 sts=2 sw=2 tw=100 et :
# ABSTRACT: (DEPRECATED) Contains the result of a JSON Schema evaluation
our $VERSION = '0.
ce::clean;
extends 'JSON::Schema::Modern::Result';
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
JSON::Schema::Draft201909::Result - (DEPRECATED) Contains the result of a JSON Schema evaluation
This module is deprecated in favour of L<JSON::Schema::Modern::Result>.
=head1 SUPPORT
Bugs may be submitted through L<https://github.com/karenetheridge/JSON-Schema-Draft201909/issues>.
I am also u