use JSON::XS;
use HTML::Entities qw(encode_entities);
use Getopt::Long;
use Devel::Dwarn;
use Devel::SizeMe::Graph;
use DBI;
my $dbh;
my %node_queue;
my %node_cache;
my $db_modtime;
my $j = JSON::XS
html<span class="divider">$divider</span></li>}
} @{$response{name_path}};
$self->render(json => \%response);
};
sub _set_node_queue {
my $nodes = shift;
++$node_queue{$_} for @$node
)); # numify
$node->{leaves} = $j->decode(delete $node->{leaves_json});
$node->{attr} = $j->decode(delete $node->{attr_json});
return $node;
}
sub _fetch_node_tree {
my ($id, $depth
ugin::Cache::VERSION = '0.0.3';
}
use Moose;
use JSON;
use Gideon::Registry;
#ABSTRACT: Cache Plugin
extends 'Gideon::Plugin';
my $serializer = JSON->new->utf8->canonical;
sub find_one {
my (
package Wight::Chart::ChartJS;
use Moo;
use JSON::XS;
use Encode;
use Graphics::Color::RGB;
extends 'Wight::Chart';
our $VERSION = '0.003'; # VERSION
#TODO: import roles for each type for more opti
park => { cls => "Line", config => {
scaleShowLabels => JSON::XS::false,
pointDot => JSON::XS::false,
scaleShowGridLines => JSON::XS::false,
}},
bar => { cls => "Bar" },
radar => { c
_;
my $w = $self->wight;
my $src = $types->{$self->type};
my $config = {
animation => JSON::XS::false,
%{$src->{config} || {} },
%{$local_config || {} },
};
#if type is spark,
semble a microsite with Handlebars
use strict;
use warnings;
use File::Next;
use Path::Class;
use JSON;
use Try::Tiny;
use Text::Handlebars;
use Text::Xslate 'mark_raw';
sub assemble {
my $class
andlebars',
content_name => 'content.handlebars',
config_name => 'config.json',
templates_dir => 'templates/',
fragments_dir => 'fragments/',
bui
$child->is_dir;
# any level in the hierarchy can have a wrapper.handlebars or config.json
next if $child->basename eq $args->{wrapper_name}
|| $child->basenam
CT: get Ivan Bessarabov's weight data
use strict;
use warnings;
use Carp;
use LWP::Simple;
use JSON;
use Time::Local;
my $true = 1;
my $false = '';
sub new {
my ($class, %opts) = @_;
cr
";
}
}
sub __get_data {
my ($self) = @_;
my $json = get("http://ivan.bessarabov.ru/weight.json");
my $data = from_json($json);
my $day_data = $data->[0]->{day};
my %date2we
CT: Save google charts to images using phantomjs
our $VERSION = '0.003'; # VERSION
use Moo;
use JSON::XS;
use Encode;
extends 'Wight::Chart';
sub src_html { 'google.html' }
#TODO: import roles for
$self->height - $self->border,
},
%{$self->options}
};
my $args = decode_utf8(encode_json({
options => $options,
type => $types->{$self->type},
rows => $self->rows,
column
ON
use strictures 1;
use Moo;
use Wight;
use Encode;
use File::Share qw/dist_file/;
use Cwd;
use JSON::XS;
has 'output' => ( is => 'rw', default => sub { 'example.png'} );
has 'rows' => ( is => 'rw'
shift},$class);
}
sub true {'true' }
sub false { undef }
sub null { 'null' }
##from json to perl
sub to_perl {
my $self = shift;
#remove comments
$self->{data} =~ s/\n+\s
ata";
croak "invalid json" if $@;
#return bless($str,'Cake::Utils::Serializer::Base');
return $str;
return _stringify($data);
}
sub to_json {
my $self = shift;
1)->Pair(' : ');
my $json = $dumper->Dump;
$json =~ s/(?:'((.*?)[^\\'])?')/$1 ? '"'.$1.'"' : '""'/ge;
$json =~ s/\\'/'/g;
$json =~ s/\\\\/\\/g;
$json =~ s/(\\x\{(.*?)\})/chr(h
"jpg" => "image/jpeg",
"js" => "application/javascript",
"json" => "application/json",
"log" => "text/plain",
"m3u" => "audio/x-mpegurl",
"m4
my/application/my_application_local.{yml,yaml,cnf,conf,jsn,json,...}
and
path/to/my/application/my_application.{yml,yaml,cnf,conf,jsn,json,...}
... and load the found configuration information app
ge::Passing>, send output to MongoDB
=head1 METHODS
=over
=item consume
Consumes a message by JSON encoding it save it in MongoDB
=back
=head1 ATTRIBUTES
=over
=item database
Required, Str, t
008005;
use strict;
use warnings;
our $VERSION = "0.02";
use parent qw/Plack::Middleware/;
use JSON;
use Try::Tiny;
use Data::Dumper;
use Text::Xslate;
use Plack::Request;
use Term::ANSIColor;
use
ype", "application/json");
req.send(JSON.stringify(opts));
req.onreadystatechange = function() {
if(req.readyState == 4) {
var res = JSON.parse(req.response
THOR
Tasuku SUENAGA a.k.a. gunyarakun E<lt>tasuku-s-github@titech.acE<gt>
=head1 TODO
- REPL
- JSON response
=head1 SEE ALSO
L<Plack::Middleware::StackTrace> L<Devel::StackTrace::AsHTML> L<Plack:
==============================================
# Load Settings from outer file / must be a valid json file
#============================================================================
sub loadSett
ake::Utils::get_file($file);
}; if ($@){
die "can't open file $file";
}
##json to perl
return Cake::Utils->serialize($conf)->to_perl;
}
#==============================
lf->body(Dumper $data);
}
sub json {
my $self = shift;
my $data = shift;
if (ref $data eq 'HASH'){
$data = $self->serialize($data)->to_json;
}
$self->content_type
:UserAgent;
use JSON::Any;
use HTTP::Request::Common qw(POST);
our @EXPORT_OK = qw(verify_remotely);
my $REMOTE_VERIFIER = 'https://verifier.login.persona.org/verify';
my $json = JSON::Any->new;
ha
ata;
if ($resp->is_success) {
my $message = $resp->decoded_content;
$data = $json->decode($message);
}
else {
$data = {
status => 'failure',
ash;
}
1;
__END__
=head1 NAME
Cake::Plugin::I18N
=head1 SYNOPSIS
##in your settings.json
{
"plugins" : [
"I18N" : {
"path" : "/full/path/to/your/l
List nesting, among other things, it's hard to be exactly
# precise about the size of the JSON serialization, but this will get
# us pretty close.
my $featSize = $self->{me
Bio::JBrowse::Store::NCList::JSONFileStorage;
BEGIN {
$Bio::JBrowse::Store::NCList::JSONFileStorage::AUTHORITY = 'cpan:RBUELS';
}
{
$Bio::JBrowse::Store::NCList::JSONFileStorage::VERSION = '0.1';
;
use JSON 2 ();
use IO::File;
use Fcntl ":flock";
use PerlIO::gzip;
use constant DEFAULT_MAX_JSON_DEPTH => 2048;
sub new {
my ($class, $outDir, $compress, $opts) = @_;
# create JSON objec
my $json = JSON->new->relaxed->max_depth( DEFAULT_MAX_JSON_DEPTH );
# set opts
if (defined($opts) and ref($opts) eq 'HASH') {
for my $method (keys %$opts) {
$json->$meth
formatVersion => 1
};
$self->store->put( 'trackData.'.( $self->{compress} ? 'jsonz' : 'json' ), $trackData);
}
sub writeHistograms {
my ( $self ) = @_;
#this series of number
my $getStart = $attrs->makeGetter("start");
my $getEnd = $attrs->makeGetter("end");
my $jsonStore = $self->store;
my $refEnd = $self->lazyNCList->maxEnd || 0;
my $featureCount = $sel
istChunkSize);
for (my $k = 0; $k <= $#{$chunks}; $k++) {
$jsonStore->put("hist-$histBases-$k" . $jsonStore->ext,
$chunks->[$k]);
}
push
ata::Dumper>, would turn the entire object into a string, much like the real code
above. Or into JSON, XML, BerkleyDB, etc. But, the end values would be lost in the stream. If you were given an obj
tent of request, which can be formated
# $m -> ct() content type returned, ie: 'application/json'
# $m -> status() HTTP status code of response
sub redirect_ok {
# need to allow 'put' to
ontent returned from WebHDFS is left in the native JSON format. Including your favorite JSON module like JSON::Any
will help with mangaging the JSON output. To get access to the content stored in y
le=>'my/new/hdfs/file.txt',
});
=item * getfilestatus() - returns a json structure containing status of file or directory. Required input is a HDFS path.
$h