s;
use utf8;
our $VERSION = '0.0.8'; # VERSION
use Moose;
use MooseX::AttributeShortcuts;
use JSON;
use namespace::autoclean;
=head1 ATTRIBUTES
=over 7
=item id
set/get task id (String)
defa
'mkdtemp';
use File::Path::Tiny;
use File::Spec::Functions;
use YAML::XS qw(LoadFile Dump);
use JSON;
use Parallel::ForkManager;
use Rex -feature => 0.31;
use Rex::Config;
use Rex::Group;
use Rex::
=item report_as_json
my $json_report = $rex_inline->report_as_json;
=cut
sub report_as_yaml { Dump( [ shift->map_reports(sub { Dump($_) }) ] ) }
sub report_as_json { encode_json( [shift->map_rep
orts(sub { encode_json($_) })] ) }
=item print_as_yaml
$rex_inline->print_as_yaml;
=item print_as_json
$rex_inline->print_as_json;
=cut
sub print_as_yaml { print join("\n", shift->map_report
ackage Data::Transit::Writer::JSONVerbose;
use strict;
use warnings;
no warnings 'uninitialized';
our $VERSION = '0.8.04';
use parent 'Data::Transit::Writer';
use JSON;
sub new {
my ($self, $outp
eturn $self->SUPER::new($output, %args);
}
sub _encode {
my ($self, $data) = @_;
return encode_json($data);
}
sub _wrap_top_level_scalar {
my ($self, $converted_data) = @_;
return {"~#'" => $con
ackage Data::Transit::Reader::JSONVerbose;
use strict;
use warnings;
no warnings 'uninitialized';
our $VERSION = '0.8.04';
use parent 'Data::Transit::Reader';
use JSON;
use List::MoreUtils qw(any);
rn decode_json($data);
}
sub _cache {
my ($self, $data) = @_;
return $data;
}
sub _convert {
my ($self, $json) = @_;
if (ref($json) eq 'HASH') {
return $self->SUPER::_convert([%$json]) if any
{$_ =~ /^~#/} keys %$json;
}
return $self->SUPER::_convert($json);
}
1;
;
$Data::Dumper::Sortkeys =1;
use NNexus::Concepts qw(links_from_concept);
use Mojo::JSON qw(decode_json encode_json);
sub serialize_concepts {
my (%options) = @_;
# Annotation Format:
# HTML -
fully linked html with RDFa annotations
# xml - the matches hash in XML format.
# json - the matches in JSON format
# perl - Dump the datastructrure as-is
my ($annotation,$concepts,$domain) =
rn what was given
}
} else {
# stand-off case:
if ($annotation eq 'json') {
return encode_json($concepts); }
# when ('perl') { return Dumper($concepts); } #TODO: Why is th
ge base for autolinking/indexing
=item *
anntation: serialization format for annotation (links, JSON, RDFa)
=item *
embed: boolean for embedded or stand-off annotations
=item *
db: An initialize
my $json = $c->stash('json');
unless ( defined $json->{data} ) {
$json->{data} = {};
$c->stash( 'json' => $json );
=head1 MOJOLICIOUS HOOKS
This module installs an before_render application hook, which gurantees JSON output.
Refer L<Mojolicious::Controller::REST> documentation for output format.
Hook installati
VERSION = '0.12';
use base qw(App::Cmd::Simple);
use Carp;
use Time::Piece;
use File::Temp;
use JSON;
use LWP::UserAgent;
use URI;
my $duration = 2 * 24 * 60 * 60;
sub opt_spec {
return (
ri);
if ($res->is_error) {
croak "HTTP error: ", $res->status_line;
}
JSON::decode_json($res->content);
}
1;
__END__
=encoding utf-8
=for stopwords
=head1 NAME
App::CPAN::Fr
package WebService::MCBouncer;
use 5.010;
use strict;
use LWP::UserAgent;
use JSON;
use Moo;
our $VERSION = '0.03';
=head1 NAME
WebService::MCBouncer - Query MCBouncer API for Minecraft bans
=he
"Failed to query getBans for $username - " . $response->status_line;
}
my $result = JSON::from_json($response->decoded_content);
if (!$result->{success}) {
die "mcbouncer respons
"Failed to query getBans for $username - " . $response->status_line;
}
my $result = JSON::from_json($response->decoded_content);
if (!$result->{success}) {
die "mcbouncer response
.
engines:
template_flute:
iterators:
fruits:
class: JSON
file: fruits.json
=head2 FILTER OPTIONS
Filter options and classes can be specified in the configur
ings;
use JSON::XS;
use File::Temp qw(tempfile);
use Compress::Zlib;
use MIME::Base64;
use URI::Escape;
use Test::More tests => 5;
BEGIN { use_ok( 'JSON::Builder' ) }
my $json = JSON::XS->new()
INK => 1);
my $builder = JSON::Builder->new(
json => $json,
fh => $fh,
read_in => 1000*57
);
build($fh, $builder);
my $r = read_fh($fh);
is_deeply($json->decode($r), $j, "Simple"
file(UNLINK => 1);
my ($fh_plain) = tempfile(UNLINK => 1);
my $builder = JSON::Builder::Compress->new(
json => $json,
fh => $fh,
read_in => 1000*57,
fh_plain => $fh_plain,
);
e;
$Dist::Zilla::Plugin::Web::NPM::Package::VERSION = '0.0.10';
# ABSTRACT: Generate the `package.json` file, suitable for `npm` package manager
use Moose;
with 'Dist::Zilla::Role::FileGatherer';
#
Role::BuildRunner';
with 'Dist::Zilla::Role::AfterBuild';
use Dist::Zilla::File::FromCode;
use JSON 2;
use Path::Class;
use File::ShareDir;
use Cwd;
has 'name' => (
is => 'rw',
$self->add_file(Dist::Zilla::File::FromCode->new({
name => file('package.json') . '',
code => sub {
my $package = {};
)
{
# You must use references to integers in order to have JSON.pm properly
# encode these as JSON boolean values. Without this, JSON will encode integer
# value as string...which is how I foun
tp://stackoverflow.com/questions/1087308/why-cant-i-properly-encode-a-boolean-from-postgresql-via-jsonxs-via-perl
$data->{'silenced'} = ( $args{'silenced'} == 0 ? \0: \1 );
}
my $response = $sel
)
{
# You must use references to integers in order to have JSON.pm properly
# encode these as JSON boolean values. Without this, JSON will encode integer
# value as string...which is how I foun
rom the outside world and is responsible for the state of the various processing jobs.
It speaks JSON through HTTP (soon Websockets!) and aims at simple RESTful communication interfacing with externa
now been revisted, add text here.
=head2 Annotation Schemes
Talk about adding achors to HTML, JSON for editors, etc.
B<TODO:> These are also features that will be ready for the June release, but
make exceptions for circular genomes here.
# see Re: [Gmod-ajax] flatfile-to-json.pl error with GFF
# 2010-07-26
}
else {
g information from components.json
use Moose;
with 'Dist::Zilla::Role::FileGatherer';
with 'Dist::Zilla::Role::FileMunger';
use Dist::Zilla::File::Generated;
use JSON -support_by_pp, -no_export;
has 'filename' => (
isa => 'Str',
is => 'rw',
default => 'components.json'
);
has 'lib_dir' => (
isa => 'Str',
is => 'rw',
default => 'lib'
);
$content =~ m/(\{.*\})/s;
$content = $1;
my $json = JSON->new->relaxed->allow_singlequote->allow_barekey;
return $json->decode($content);
}
#===================================
y %data = @_;
my $json = $self->stash('json');
if ( defined( $json->{data} ) ) {
@{ $json->{data} }{ keys %data } = values %data;
}
else {
$json->{data} = {%data};
json => $json );
return $self;
}
sub message {
my $self = shift;
my ( $message, $severity ) = @_;
$severity //= 'info';
my $json = $self->stash('json');
if ( defined( $json
$json->{messages}}, { text => $message, severity => $severity } );
}
else {
$json->{messages} = [ { text => $message, severity => $severity } ];
}
$self->stash( json => $json
s qw(compile);
use Types::Standard -types;
use Errno qw(EINTR);
use Scalar::Util qw(blessed);
use JSON::XS;
use Carp;
$Carp::Internal{ (__PACKAGE__) }++;
use Module::Runtime qw(use_module);
require by
xes, $links ) = $check->(@_);
($content_type //= 'application/json')
eq 'application/json'
and $value = encode_json($value);
$self->_store( $bucket, $key, $value, $content_type
if we need to decode
$args->{decode} && ($content_type // '') eq 'application/json'
and return \decode_json($value);
# simply return the value
return \$value;
}
sub _store {
m
=head1 OVERVIEW
At the moment, the configuration system is exceedingly simple: it's just a JSON-serialized hash stored as data in the L<Zonemaster::Config> module.
Eventually, this will be changed to
cal overrides of defaults.
The policy data is already distributed as and loaded from an external JSON file. There isn't yet any ability to override policy data, or specify
alternatives.
=head1 CONFI
TTP::Request;
use LWP::UserAgent;
use Data::Dumper;
use MIME::Base64;
use Text::ASCIITable;
use JSON;
sub new {
my $class = shift;
my $self = bless {
lwhome => "$ENV{HOME}/.lw",
apiconfig
uidWeb API Secret: ";
chomp($self->{configure}{secret} = <STDIN>);
print "Default output type [json,perl,table]: ";
chomp($self->{configure}{output} = <STDIN>);
print "Save auth credentials lo
fetchDocs;
if (($self->{configure}{save} =~ m/y/i) ? 1 : 0) {
$self->{configure}{output} ||= 'json';
open my $session, '>', $self->{apiconfig} or die $!;
print $session "username=$self->{conf