package Net::PMP::Profile;
use Moose;
use Data::Dump qw( dump );
use Data::Clean::JSON;
use Net::PMP::Profile::TypeConstraints;
use Net::PMP::CollectionDoc;
use Net::PMP::CollectionDoc::Link;
our $VE
les/base'}
sub get_profile_title { ref(shift) }
# singleton for class
my $cleaner = Data::Clean::JSON->new(
DateTime => [ call_method => 'stringify' ],
'Net::PMP:
package DR::TarantoolQueue;
use utf8;
use strict;
use warnings;
use Mouse;
use Carp;
use JSON::XS;
require DR::TarantoolQueue::Task;
$Carp::Internal{ (__PACKAGE__) }++;
our $VERSION = '0.44';
use fea
Ttl => 'Turtle',
N3 => 'Notation3',
Xml => 'RDFXML',
XML => 'RDFXML',
Json => 'RDFJSON',
);
has type => (
is => 'ro',
coerce => sub { my $t = ucfirst($_[0]); $TYPE_ALIAS
porter::RDF>
Serialize RDF data (as RDF/XML, RDF/JSON, Turtle, NTriples, RDFa...)
=item L<Catmandu::Importer::RDF>
Parse RDF data (RDF/XML, RDF/JSON, Turtle, NTriples...) or import from a SPARQL
en
and convert the result for the "new" method.
It is use by "new_with_options".
=cut
my $decode_json;
sub parse_options {
my ( $class, %params ) = @_;
my %options_data = $class->_options
f ( $data{json} ) {
defined $decode_json
or $decode_json = eval {
use_module("JSON::MaybeXS");
JSON::MaybeXS
->can("decode_json");
};
defined $decode_json
or $decode_json = eval {
use_module("JSON::PP");
e aliases C<ttl> for C<Turtle>, C<n3> for
C<Notation3>, C<xml> and C<XML> for C<RDFXML>, C<json> for C<RDFJSON>.
When the option C<type> is set to 'NTriples' the export can be streamed in all
other
BoosterGetAttrNames( $self->_handle ) } };
}
sub TO_JSON {
my $self = shift;
my $trees = XGBoosterDumpModelEx( $self->_handle, "", 1, "json" );
return "[" . join( ',', @$trees ) . "]";
}
r as a HASHREF
=head2 TO_JSON
Serialize the booster to JSON.
This method is to be used with the option C<convert_blessed> from L<JSON>.
(See L<https://metacpan.org/pod/JSON#OBJECT-SERIALISATION>)
ec;
use File::HomeDir;
use Readonly;
use Carp;
use LWP::UserAgent;
use HTTP::Request::Common;
use JSON;
use URI;
use Data::Printer;
Readonly our %DEFAULTS => (
DRIP_TOKEN => undef,
DRIP_ID
if ( ref($content) ) {
$request->content_type('application/vnd.api+json');
$request->content( encode_json( $content ) );
}
$request->authorization_basic( $self->{DRIP_TOKEN},
return undef;
}
my $decoded = eval {decode_json( $result->content )};
if ( $@ ) {
$self->{debugger}->('Failed to decode JSON:', $@, $result->content);
die $result;
}
ss::Zlib;
use MIME::Base64;
use JSON::XS;
has jsp =>
is => 'ro',
isa => 'Object',
lazy => 1,
builder => sub {
return JSON::XS
-> new
e RDF::Query;
use RDF::LDF;
use RDF::aREF;
use RDF::aREF::Encoder;
use RDF::NS;
use IO::Pipe;
use JSON;
use LWP::UserAgent::CHICaching;
our $VERSION = '0.32';
with 'Catmandu::RDF';
with 'Catmandu::I
de($pipe,':encoding(UTF-8)');
return sub {
state $line = <$pipe>;
return decode_json($line) if defined($line);
waitpid($pid,0);
return undef;
};
}
else {
#
is_literal ? $triple->object->literal_datatype : undef;
# Create the RDF::Trine type RDF/JSON RDF::aREF can parse
my $hashref = {};
$hashref->{$subject}->{$predicate}->[0]->{
IONS_ATTRIBUTES
= qw/format short repeatable negatable autosplit autorange doc long_doc order json hidden spacer_before spacer_after/;
sub import {
my ( undef, @import ) = @_;
my $options
ions{order} = 0 if !defined $options{order};
if ( $options{json}
|| ( defined $options{format} && $options{format} eq 'json' ) )
{
delete $options{repeatable};
delete
ange};
delete $options{negativable};
delete $options{negatable};
$options{json} = 1;
$options{format} = 's';
}
if ( $options{autorange} and not defined $opti
package DR::TarantoolQueue::Task;
use utf8;
use strict;
use warnings;
use Mouse;
use JSON::XS ();
use Carp;
has space => (is => 'ro', isa => 'Str', required => 1);
has status => (
is
format_doc->{$format} if defined $format;
$format_doc_str = 'JSON'
if defined $options_data{ $opt->{name} }{json};
my $spec
= ( defined $short ? "-" . $short .
format_doc->{$format} if defined $format;
$format_doc_str = 'JSON'
if defined $options_data{ $opt->{name} }{json};
push @message,
( defined $short ? "-" . $sh
{$format}
if defined $format;
$format_doc_str = 'JSON'
if defined $options_data{ $opt->{name} }{json};
my $opt_long_name
= "-" . ( length( $opt->{n
eturn bridge($self)->unjson($js);
}
=head2 C<< $obj->MozRepl::RemoteObject::Methods::transform_arguments(@args) >>
This method transforms the passed in arguments to their JSON string
representations
s a Javascript string.
=cut
sub transform_arguments {
my $self = shift;
my $json = bridge($self)->json;
map {
if (! defined) {
'null'
} elsif (/^(?:[1-9][0-
id($cb)
} elsif (ref) {
$json->encode($_);
} else {
$json->encode($_)
}
} @_
};
# Helper to centralize the reblessing
aCloud::JobManager::Broker';
use Net::AMQP::RabbitMQ;
use UUID::Tiny ':std';
use Tie::Cache;
use JSON;
use Data::Dumper;
use Readonly;
use Log::Log4perl qw(:easy);
Log::Log4perl->easy_init(
{
NORMAL => 1,
$MediaCloud::JobManager::Job::MJM_JOB_PRIORITY_HIGH => 2,
);
# JSON (de)serializer
my $json = JSON->new->allow_nonref->canonical->utf8;
# RabbitMQ connection credentials
has '_hos
_declare_queue( $queue_name, $durable, $declare_and_bind_exchange, $lazy_queue );
}
sub _publish_json_message($$$;$$)
{
my ( $self, $routing_key, $payload, $extra_options, $extra_props ) = @_;
.11';
# ABSTRACT: Emulate mobile devices by setting user agents when using webdriver
use Moo;
use JSON;
use Cwd qw/abs_path/;
use Carp qw/croak/;
use List::Util 1.33 qw/any/;
use Selenium::Firefox::Pr
s/UserAgent\.pm$/devices.json/;
my $devices;
{
local $/ = undef;
open (my $fh, "<", $devices_file);
$devices = from_json(<$fh>);
close
Agent/blob/master/lib/Selenium/devices.json>;
they're vetted against the L<values that Mozilla uses for
Firefox|https://code.cdn.mozilla.net/devices/devices.json>.
Usage looks like:
my $sua = Se
my_variable>) will be discarded after
each run.
Returns result on success (serializable by the L<JSON> module). The result will
be discarded if the job is added as a background process.
Provides pro
(optional) C<$args> (hashref), arguments required for running the
function (serializable by the L<JSON> module)
=item * (optional, internal) job handle to be later used by send_progress()
=back
Ret
* (optional) C<$args> (hashref), arguments needed for running the
function (serializable by the L<JSON> module)
=back
Returns result (may be false of C<undef>) on success, C<die()>s on error
=cut
g (2017) many implementations are still
stuck at version 1.0/1.1 of the specification.
B<JSON>. Although JSON is popular and simple, most parsers are not round-trip.
And even if the parser were round
umentation for
L<JSON> Perl module mentions the phrase "round-trip", but it uses the phrase to
mean integrity of values, not preserving comments/whitespaces.)
Note that IOD uses JSON in places.
B<Ap
ore non-newline characters with optional encoding prefix, or
a JSON string with double quotes, or a JSON array started with "[", or a JSON
hash (object) started with "{". Encoding prefix is C<!> follo
e port should be defined at "ports" section',
);
The C<on> parameter defines the data path, via JSON-pointer like expression;
the C<should> parameter provides the closure, which will check the value
o DarkSky
package DarkSky::API;
use strict;
use warnings;
use JSON::XS;
use HTTP::Tiny;
use Moo;
our $VERSION = '1.1.5';
my $json = JSON::XS->new->pretty->canonical;
my $api = "https://api.darksk
response->{reason}\n"
unless $response->{success};
return decode_json( $response->{content} );
}
sub TO_JSON { return { %{ shift() } }; }
1;
=pod
=encoding utf-8
=head1 NAME
DarkSky
::API - Provides Perl API to DarkSky
=head1 SYNOPSIS
use DarkSky::API;
use JSON::XS;
use feature 'say';
my $lat = 43.6667;
my $long = -79.4167;
my $time = "1475363709";
package MozRepl::RemoteObject;
use strict;
use Exporter 'import';
use JSON;
use Encode qw(decode);
use Carp qw(croak);
use Scalar::Util qw(refaddr weaken);
=head1 NAME
MozRepl::RemoteObject - treat
function() {
repl.linkedVars = {};
repl.linkedIdNext = 1;
};
repl.JSON_ok = function(val,context) {
return JSON.stringify({
"status":"ok",
"result": repl.wrapResults(val,
{
var res = eval(js);
return repl.JSON_ok(res,context);
} catch(e) {
//for (var x in e) { alert(x)};
return JSON.stringify({
"status":"error",