JSON::Long::JSONOutput;
use Moose::Role;
use namespace::autoclean;
use JSON;
with 'HPC::Runner::Command::stats::Logger::JSON::Summary';
with 'HPC::Runner::Command::stats::Logger::JSON::Summary::JSON
$submission_id, $jobname );
$submission_obj->{$submission_id}->{jobs}->{$jobname}->{tasks_running}
= $running;
push( @{ $self->json_data }, $submission_obj );
}
}
1;
Perl itself)
#
# (C) Paul Evans, 2017 -- leonerd@leonerd.org.uk
package Net::Async::WebSocket::JSON::Server;
use strict;
use warnings;
use base qw( Net::Async::WebSocket::Server );
Net::Async::Web
::JSON::Protocol;
=head1 NAME
C<Net::Async::WebSocket::JSON::Server> - server WebSocket clients using JSON and C<IO::Async>
=head1 SYNOPSIS
use IO::Async::Loop;
use Net::Async::WebSocket::JSON::
my $server = Net::Async::WebSocket::JSON::Server->new(
on_client => sub {
my ( undef, $client ) = @_;
$client->configure(
on_json => sub {
my ( $self, $fra
Perl itself)
#
# (C) Paul Evans, 2017 -- leonerd@leonerd.org.uk
package Net::Async::WebSocket::JSON::Protocol;
use strict;
use warnings;
use base qw( Net::Async::WebSocket::Protocol );
Net::Async:
send and receive JSON-encoded data over WebSockets
=head1 DESCRIPTION
This subclass of L<Net::Async::WebSocket::Protocol> provides some conveniences
for sending and receiving JSON-encoded data over
iply, it
provides one new method, L<send_json>, for encoding Perl values into JSON and
sending them, and one new method, L<on_json>, for decoding received JSON
content into Perl values when received.
nerd.org.uk
package Net::Async::WebSocket::JSON;
use strict;
use warnings;
our $VERSION = '0.01';
=head1 NAME
C<Net::Async::WebSocket::JSON> - use JSON-encoded data over WebSockets with C<IO::Asy
t add convenient wrappers for encoding or decoding JSON data in text frames
over websockets.
To implement a server, use L<Net::Async::WebSocket::JSON::Server> as if it was
L<Net::Async::WebSocket::Se
::JSON::Client> as if it was
L<Net::Async::WebSocket::Client>.
In either cases, connected client instances will be instances of
L<Net::Async::WebSocket::JSON::Protocol>, and have the new C<send_json>
rg.uk
package Net::Async::WebSocket::JSON::Client;
use strict;
use warnings;
use mro 'c3';
use base qw( Net::Async::WebSocket::Client Net::Async::WebSocket::JSON::Protocol );
our $VERSION = '0.01';
C<Net::Async::WebSocket::JSON::Client> - connect to a WebSocket server using JSON and C<IO::Async>
=head1 SYNOPSIS
use IO::Async::Loop;
use Net::Async::WebSocket::JSON::Client;
use Data::Dump;
my $client = Net::Async::WebSocket::JSON::Client->new(
on_json => sub {
my ( $self, $data ) = @_;
print Data::Dump::pp( $data );
},
);
my $loop = IO::Async::Loop->new;
$loo
package JSON::Tiny;
# Minimalistic JSON. Adapted from Mojo::JSON. (c)2012-2015 David Oswald
# License: Artistic 2.0 license.
# http://www.perlfoundation.org/artistic_license_2_0
use strict;
use warn
decode_json encode_json false from_json j to_json true);
# Literal names
# Users may override Booleans with literal 0 or 1 if desired.
our($FALSE, $TRUE) = map { bless \(my $dummy = $_), 'JSON::Tiny:
ess defined $REVERSE{$packed};
}
sub decode_json {
my $err = _decode(\my $value, shift);
return defined $err ? croak $err : $value;
}
sub encode_json { Encode::encode 'UTF-8', _encode_value(shif
package JSON::SL::EscapeTH;
use strict;
use warnings;
sub TIEHASH {
my ($cls,$o) = @_;
my $self = bless { pjsn => $o }, $cls;
return $self;
}
sub STORE {
my $self = $_[0];
$s
scape_settings($character, $boolean)
Inspects and modifies the preferences for unescaping JSON strings. JSON allows
several forms of escape sequences, either via the C<\uXXXX> form, or via a two-
cha
esultant string, thus:
\u0041 becomes A
For JSON structural tokens, the backslash is swallowed and the character following
it is left as-is. JSON I<requires> that these characters be escaped.
package JSON::SL::Tuba;
use strict;
use warnings;
use JSON::SL;
use base qw(Exporter);
our @EXPORT;
my (%ActionMap,%TypeMap);
my $_cg_typehash;
my $_cg_modehash;
BEGIN {
%ActionMap = (
'+' =
n'
);
%TypeMap = (
'{' => 'object',
'[' => 'list',
'c' => 'data',
'D' => 'json',
'#' => 'key',
'"' => 'string',
'^' => 'special',
'?' => 'boolean',
'=' => '
1;
__END__
=head1 NAME
JSON::SL::Tuba - High performance SAX-like interface for JSON
=head1 SYNOPSIS
Create a very naive JSON encoder using JSON::SL::Tuba
my $JSON ||= <<'EOJ';
{
"a
kage JSON::SL::Boolean;
use overload
"0+" => sub { ${$_[0]} },
"++" => sub { $_[0] = ${$_[0]} + 1 },
"--" => sub { $_[0] = ${$_[0]} - 1 },
fallback => 1;
1;
package JSON::SL
use warnings;
use strict;
our $VERSION;
use base qw(Exporter);
our @EXPORT_OK = qw(decode_json unescape_json_string);
BEGIN {
$VERSION = '1.0.7';
require XSLoader;
XSLoader::load(__PACKA
s {
my ($self,$c) = @_;
if (!defined $c) {
require JSON::SL::EscapeTH;
my $ret = {};
tie(%$ret, 'JSON::SL::EscapeTH', $self);
return $ret;
} else {
package Bio::Phylo::Unparsers::Json;
use strict;
use warnings;
use base 'Bio::Phylo::Unparsers::Abstract';
use Bio::Phylo::Util::CONSTANT qw'/looks_like/';
use Bio::Phylo::Util::Exceptions 'throw';
us
ML::XML2JSON';
=head1 NAME
Bio::Phylo::Unparsers::Json - Serializer used by Bio::Phylo::IO, no serviceable
parts inside
=head1 DESCRIPTION
This module turns the supplied object into a JSON string.
Type : Wrapper
Title : _to_string
Usage : my $json_string = $obj->_to_string;
Function: Stringifies a Bio::Phylo object into a JSON string
Alias :
Returns : SCALAR
Args : Bio::Phyl
package Bio::Phylo::Parsers::Json;
use strict;
use warnings;
use base 'Bio::Phylo::Parsers::Abstract';
use Bio::Phylo::IO 'parse';
use Bio::Phylo::Util::Exceptions 'throw';
use Bio::Phylo::Util::Depen
2JSON';
=head1 NAME
Bio::Phylo::Parsers::Json - Parser used by Bio::Phylo::IO, no serviceable parts inside
=head1 DESCRIPTION
This module is used to import NeXML data that was re-formatted as JSON
, using
the mapping implemented by L<XML::XML2JSON>. This module is experimental in that
complex NeXML-to-JSON mapped strings may fail to yield valid NeXML (and,
consequently, valid Bio::Phylo objects
ge Bio::Phylo::NeXML::XML2JSON;
use XML::XML2JSON;
use base 'XML::XML2JSON';
use strict;
use warnings;
=head1 NAME
Bio::Phylo::NeXML::XML2JSON - Helps convert NeXML to JSON, no serviceable parts ins
ide
=cut
# As of 2017, the most recent version of XML::XML2JSON seems to have been
# abandoned with a bug in it. It assumes that hash keys are ordered, whereas
# more recent Perl versions randomize
{ $Self->{attribute_prefix} . 'encoding' } || $Obj->{'encoding'} || 'UTF-8';
my $Dom = $XML::XML2JSON::XMLPARSER->createDocument( $Version, $Encoding );
my $GotRoot = 0;
# patch: first filter out
package Flexconf::Json;
use JSON::MaybeXS;
sub parse {
return decode_json shift;
}
sub stringify {
return encode_json shift;
}
sub load {
my ( $filepath ) = @_;
local $/;
open FH, "<"
$conf = decode_json $conf;
close FH;
$conf;
}
sub save {
my ( $filepath, $conf ) = @_;
open FH, ">", $filepath or die("Could not open file. $!");
print FH encode_json $conf;
close
ad::From::PNG::View::JSON;
use strict;
use warnings;
BEGIN {
$FuseBead::From::PNG::VERSION = '0.02';
}
use parent qw(FuseBead::From::PNG::View);
use Data::Debug;
use JSON;
sub print {
my
= ref $_[0] eq 'HASH' ? %{$_[0]} : @_;
return JSON->new->utf8->pretty->encode( \%args );
}
=pod
=head1 NAME
FuseBead::From::PNG::View::JSON - Format data returned from FuseBead::From::PNG
=h
me => 'my_png.png' });
$object->process(view => 'JSON'); # Data is returned as JSON
=head1 DESCRIPTION
Class to returned processed data in JSON format
=head1 USAGE
=head2 new
Usage : ->ne
for comments in JSON content.
#
# Functions: import
# comment_style
# get_comment_style
# decode
#
# Libraries: JSON
#
# Global Co
#####################################################
package JSON::WithComments;
use 5.008;
use strict;
use warnings;
use base qw(JSON);
use Carp ();
our $VERSION = '0.003'; # VERSION
# These re
at will be used by decode_json.
my $default_comment_style = 'javascript';
# This table is used in lieu of per-object hashkeys, as the object is not a
# hashref when the JSON::XS backend is in use.
my
e strict;
use warnings;
package Devel::JSON;
our $VERSION = '1.001';
# Just to allow to be loaded with -d:JSON
sub DB::DB {}
use JSON::MaybeXS ();
our @JSON_options;
# 2.05: _get_locale_encoding
_enc =~ /UTF/i) { # Native JSON encoding
binmode(STDOUT, ":encoding($locale_enc)")
} else {
@JSON_options = (ascii => 1)
}
sub import
{
shift;
unshift @JSON_options, map { s/^-// ? (
int JSON::MaybeXS->new(pretty => 1, canonical => 1, allow_nonref => 1, @Devel::JSON::JSON_options)->encode(scalar do {use utf8;'. $_ . '})'
};
1;
__END__
=encoding UTF-8
=head1 NAME
Devel::JSON -
package MozRepl::Plugin::JSON2;
use strict;
use parent 'MozRepl::Plugin::Base';
use vars '$VERSION';
=head1 NAME
MozRepl::Plugin::JSON2 - use a 7bit safe json2.js for MozRepl/JS serialization
=head
1 SYNOPSIS
This module only exists to serve as a container for
the MozRepl::RemoteObject JSON encoding/decoding.
=cut
$VERSION = '0.40';
sub setup {
my ($self, $ctx, $args) = @_;
$ctx->ex
json2.js
This distribution contains a hacked, UTF-8 safe version of the json2.js
encoder. This is for channels that don't transfer data in an UTF-8 safe
manner. It is slower than using a native JSON
package JSON::PP::Monkey;
$JSON::PP::Monkey::VERSION = '0.1.0';
# ABSTRACT: JSON::PP with encoding fallbacks
use 5.10.1;
use strict;
use warnings;
use JSON::PP 2.94;
use parent qw(JSON::PP);
use Ca
efaddr reftype);
BEGIN { *P_ALLOW_UNKNOWN = *JSON::PP::P_ALLOW_UNKNOWN }
BEGIN { *_is_bignum = *JSON::PP::_is_bignum }
BEGIN { *_looks_like_number = *JSON::PP::_looks_like_number }
sub add_fallback
ks}{$case} unless @{$self->{fallbacks}{$case}};
}
return $self;
}
sub _emit_fallback_to_json {
my ($self, $case, $value) = @_;
if (my $s = $self->{fallbacks}{$case}) {
for m
---------------------
package Test::JSON::Assert;
use 5.006000;
use strict;
use warnings;
use Test::Builder::Module;
our @ISA = qw(Test::Builder::Module);
use JSON::Assert;
our @EXPORT = qw(
is_
unt, $name) = @_;
# create the $json_assert object
my $json_assert = JSON::Assert->new();
# do the test and remember the result
my $is_ok = $json_assert->is_jpath_count($doc, $jpath,
my ($doc, $jpath, $match, $name) = @_;
my $json_assert = JSON::Assert->new();
# do the test and remember the result
my $is_ok = $json_assert->does_jpath_value_match($doc, $jpath, $mat
---
package JSON::Assert;
use Moo;
use MooX::Types::MooseLike::Base 'Str';
use JSON::Path;
use Test::Deep::NoTest;
$JSON::Path::Safe = 0;
our $VERSION = '0.08';
our $VERBOSE = $ENV{JSON_ASSERT_VERB
h) };
if ( $@ ) {
$self->error($@);
return;
}
return 1;
}
sub assert_json_contains {
my $self = _self(\@_);
my ($doc, $jpath_str, $match) = @_;
my $jpath = _p
@_);
my ($doc, $jpath_str, $match) = @_;
$self->_clear_error();
eval { $self->assert_json_contains($doc, $jpath_str, $match) };
if ( $@ ) {
$self->error($@);
return;