$self->flavor_total }
method TO_JSON {
+{
map {;
my ($attr, $val) = ($_, $self->$_);
my $raw = blessed $val && $val->can('TO_JSON') ? $val->TO_JSON : $val;
$attr => $raw
flavors
/,
}
}
with 'App::vaporcalc::Role::Store';
1;
=pod
=for Pod::Coverage TO_JSON
=head1 NAME
App::vaporcalc::Result - A calculated App::vaporcalc::Recipe result
=head1 SYNOPSI
use Rethinkdb::Base -base;
no warnings 'recursion';
use Carp 'croak';
use IO::Socket::INET;
use JSON::PP;
use Rethinkdb::Protocol;
use Rethinkdb::Response;
has host => 'localhost';
has port
lf->auth_key );
$self->_handle->send( pack 'L<',
$self->_protocol->versionDummy->protocol->json );
my $response;
my $char = q{};
do {
$self->_handle->recv( $char, 1 );
$response
return encode_json $data;
}
# temporarily: clean up global optional arguments
sub _simple_encode_hash {
my $data = shift;
my $json = {};
foreach ( keys %{$data} ) {
$json->{$_} = _simple
kage Rethinkdb::Protocol::Protocol;
use Rethinkdb::Base -base;
has 'protobuf' => 0x271ffc41;
has 'json' => 0x7e6970c7;
package Rethinkdb::Protocol::Query;
use Rethinkdb::Base -base;
has 'queryType' =
r_bool' => 2;
has 'r_num' => 3;
has 'r_str' => 4;
has 'r_array' => 5;
has 'r_object' => 6;
has 'r_json' => 7;
package Rethinkdb::Protocol::Term;
use Rethinkdb::Base -base;
has 'termType' => sub { Ret
s 'upcase' => 141;
has 'downcase' => 142;
has 'sample' => 81;
has 'default' => 92;
has 'json' => 98;
has 'to_json_string' => 172;
has 'iso8601' => 99;
has 'to_iso8601' => 100;
has 'epoch_time' => 101;
package Rethinkdb::Util;
use Rethinkdb::Base -base;
use Scalar::Util 'blessed';
use JSON::PP 'encode_json';
use Carp 'croak';
use Rethinkdb::Query::Datum;
use Rethinkdb::Protocol;
my $PROTOCOL = Re
mostly JSON
sub _expr_json {
my $self = shift;
my $value = shift;
if ( blessed($value) && $value->can('_build') ) {
return $value;
}
my $retval;
eval { $retval = encode_json $value
( !$@ && $retval ) {
return Rethinkdb::Query->new(
_type => $PROTOCOL->term->termType->json,
args => $retval
);
}
elsif ( ref $value eq 'ARRAY' ) {
return $self->_make_ar
Simple;
use File::Slurp;
use HTML::TreeBuilder;
use HTML::Element::Library;
use JSON::MaybeXS qw/encode_json decode_json/;
use Plack::Builder;
use Plack::Request;
use Text::CSV;
use Try::Tiny;
sub HT
fid('notes')->find('li') => @notes);
$tree->look_down(name => 'products')->attr(value => encode_json \@data);
$tree->look_down(name => 'total')->attr(value => $total);
[200, ['Content-type' => 't
= sprintf "%X%04X", time, $$;
my $err;
try {
$db{$$}->begin_work;
my $products = decode_json $req->body_parameters->{products};
for my $prod (@$products) {
my $stock = $db{$$}->select
it)
has id => ( is => 'rw' );
has type => ( is => 'rw' );
has tags => ( is => 'rw' );
sub TO_JSON {
my $self= shift;
my %data= %$self;
for (keys %data) {
delete $data{$_}
if $_ =~ /^[^a-z
use strict; use warnings;
use Benchmark 'cmpthese';
use JSON::Tiny ();
use JSON::PP 'encode_json', 'decode_json';
use Text::ZPL;
my $struct = +{
foo => 'bar',
bar => 'baz',
hash => +{
x =>
[ 1 .. 100 ],
},
};
my $tiny = JSON::Tiny->new;
my ($js, $tjs, $zpl);
cmpthese( 2_000, +{
encode_jsonpp => sub {
$js = encode_json $struct
},
encode_jsontiny => sub {
$tjs = $tiny->e
b {
$zpl = encode_zpl $struct
},
});
cmpthese( 2_000, +{
decode_jsonpp => sub {
decode_json $js
},
decode_jsontiny => sub {
$tiny->decode($tjs)
},
decode_zpl => sub {
deco
warnings;
use File::Spec::Functions;
use FindBin;
use lib catdir($FindBin::Bin, '..', 'lib');
use JSON::XS;
use Geo::SpatialDB;
use Geo::SpatialDB::Import::OpenStreetMap;
use Geo::SpatialDB::Storage::
>new(
storage => Geo::SpatialDB::Storage::LMDB_Storable->new(
path => $sdb_path,
)
);
my $j= JSON::XS->new->canonical->allow_blessed->convert_blessed;
if ($key) {
my $x= $sdb->storage->get($key
CS\b
\\bCVS\b
\\.svn
\\.git
,v$
# Makemaker/Build.PL generated files and dirs.
MYMETA.yml
MYMETA.json
MANIFEST.old
^Makefile$
^Build$
^blib
^pm_to_blib$
^_build
^MakeMaker-\d
embedded
cover_db
smoke.
onse = Weather::OpenWeatherMap::Result->new_for(
$type =>
request => $my_request,
json => $content,
);
unless ($my_response->is_success) {
my $code = $my_response->respon
lly
can be used as callbacks for SeeAlso::Server (replacing the default
"seealso" method yielding JSON data).
=cut
our %Defaults = (
# "REVISIT" => 86400, # one day
"REVISIT" => un
db->latlon_precision)
if $lon =~ /\./;
my $result= $sdb->find_at($lat, $lon, $rad);
use JSON::XS;
my $j= JSON::XS->new->canonical->utf8->allow_blessed->convert_blessed;
my %seen_roads;
while (my ($k
package HelloWorld::Resource;
use strict;
use warnings;
use JSON::XS qw[ encode_json ];
use parent 'Web::Machine::Resource';
sub init {
my $se
$self->{json}
= exists $args->{json}
? $args->{json}
: {};
}
sub content_types_provided { [ { 'application/json' => 'to_json' } ] }
sub to_json {
my $self = shift;
encode_json( $self->{json} );
}
}
Web::Machine->new(
resource => 'HelloWorld::Resource',
resource
::More (0.88) -> core
IO::Socket (0) -> core
Socket (1.97) -> core
JSON::PP (2.27103) -> MAKAMAKA/JSON-PP-2.27400
ExtUtils::MakeMaker (0) -> core
ExtUtils::MakeMaker (0) ->
P/PE/PEVANS/IO-Socket-IP-0.37.tar.gz
M/MA/MAKAMAKA/JSON-PP-2.27400.tar.gz
P/PE/PEVANS/IO-Socket-IP-0.37.tar.gz
M/MA/MAKAMAKA/JSON-PP-2.27400.tar.gz
=head1 DESCRIPTION
This is experimenta
RSION = '0.006';
use 5.16.0;
use strict;
use warnings;
use Email::MIME::ContentType;
use URI;
use JSON;
use Carp qw[confess];
use Hash::Merge::Simple 'merge';
use namespace::autoclean;
sub progenitor
pplication') {
my $decoded = $body;
$decoded = from_json($body)
if ($subtype eq 'json');
$decoded = $response->responseXpath
if ($subt
y $scopes = shift // $config->{scopes};
Mojo::JWT::Google->new(
from_json => $config->{gcp_auth_file},
target => $config->{oauth_url} // $self->oauth_
my $tx = pop;
if ($tx->res->json('/access_token')) {
$d->pass($tx->res->json);
}
else {
ender(json => $tx->res->json, status => $tx->res->code);
},
sub { ## error sub
my $tx = pop;
$c->render(json => $tx->res->json, sta
package Golger;
use strict;
use warnings;
use 5.008002;
use AnyEvent::WebSocket::Client;
use JSON::Any;
our $VERSION = version->parse('v0.1.0');
sub connect {
my $connect_info = shift;
my $forma
if (ref $format eq "ARRAY") {
my @format = @$format;
$format = sub {
my $omsg = JSON::Any -> jsonToObj ($_[0]);
my @fm = @{$omsg}{ @format };
print join " ", map {defined ($_) ? $_
{
die "oh noes! this ain't no coderef";
}
} else {
$format = sub {
my $omsg = JSON::Any -> jsonToObj ($_[0]);
my @fm = @{$omsg}{ qw/time host service description/ };
print join "
lookup:
loggmann -H node02 -S httpd
Change default logging format:
loggmann node03 -f "time host service metric"
Output raw (json):
loggmann node04 -r
Help:
loggmann -h
=cut
n a string, like Data::Dumper.
=head3 as_json
my $json = $object->mo->as_json;
Return the contents of the $object as JSON.
=head3 as_yaml
my $json = $object->mo->as_yaml;
Return the cont
u like.
Possible formats are yaml, json and perl.
$format defaults to "perl" which is equivalent to C<< $object->mo->perl >>.
This is simply the long form of C<as_perl>, C<as_json> and C<as_yaml>.
my %args = @_;
my $format = $args{format} // "perl";
state $dumpers = {
json => "as_json",
yaml => "as_yaml",
perl => "as_perl",
};
my $dumper = $d
for dump()") unless $dumper;
return $self->$dumper(%args);
}
sub as_json {
require JSON::MaybeXS;
my $json = JSON::MaybeXS->new
->utf8
->pretty
sed;
# JSON doesn't seem to have an easy way to say
# "just dump objects as references please". This is their
# recommended way to do it (yarf).
local *UNIVERSAL::TO_JSON = sub {