_parent => $self,
_type => $self->_termType->insert,
args => Rethinkdb::Util->_expr_json($args),
optargs => $params,
);
return $q;
}
sub sync {
my $self = shift;
my $q = R
st')->table('dc_universe')->create->run;
Create this table. A RethinkDB table is a collection of JSON documents.
If successful, the operation returns an object: C<< {created => 1} >>. If a
table wit
shift;
$str =~ s!^!// !g;
$str;
}
sub eval_expr_js {
require File::Temp;
require JSON::MaybeXS;
require Language::Expr::Compiler::js;
require Nodejs::Util;
my ($expr, $op
@_;
$opts //= {};
state $default_jsc = Language::Expr::Compiler::js->new;
state $json = JSON::MaybeXS->new->allow_nonref;
my $jsc = $opts->{js_compiler} // $default_jsc;
# code
lare vars\n") . join("", map { "let $_ = ".$json->encode($opts->{vars}{$_}).";\n" } sort keys %{$opts->{vars}})
: ""),
"console.log(JSON.stringify(",
$jsc->compile($expr),
>{_rdb};
return $q;
}
sub json {
my $self = shift;
my $value = shift;
my $q = Rethinkdb::Query->new(
_rdb => $self,
_type => $self->term->termType->json,
args => $value,
);
optargs,
);
return $q;
}
sub geojson {
my $self = shift;
my $args = shift;
my $q = Rethinkdb::Query->new(
_type => $self->term->termType->geojson,
args => $args,
);
return $
t error.
=head2 expr
r->expr({a => 'b'})->merge({b => [1,2,3]})->run($conn);
Construct a RQL JSON object from a native object.
=head2 js
r->js("'str1' + 'str2'")->run($conn);
r->table('marv
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.
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
package Rethinkdb::Response;
use Rethinkdb::Base -base;
use JSON::PP;
use Rethinkdb::Protocol;
has [qw{ type type_description response token error_type backtrace profile }];
sub _init {
my $class
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;
ill,
);
return $q;
}
sub to_geojson {
my $self = shift;
my $q = Rethinkdb::Query->new(
_parent => $self,
_type => $self->_termType->to_geojson,
);
return $q;
}
sub includes
a single JSON result, or a cursor,
depending on the query.
=head2 update
r->table('posts')->get(1)->update({status => 'published'})->run;
Update JSON documents in a table. Accepts a JSON document
=> 'Aleas jacta est',
status => 'draft'
})->run;
Replace documents in a table. Accepts a JSON document or a ReQL expression, and
replaces the original document with the new one. The new docum
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 "
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
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
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
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
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
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
use utf8;
use 5.008_005;
our $VERSION = '0.02';
use Moose;
use Types::Standard qw< :types >;
use JSON::MaybeXS;
use Path::Tiny;
use List::Util qw< first >;
use namespace::autoclean;
=encoding utf-8
In a controller action
#
my $vega = $c->view('Vega');
$vega->specfile('patient-chart.json');
$vega->bind_data({
"patient" => [{
id => $patient->id,
clone(@args);
}
=head1 ATTRIBUTES
=head2 json
Read-only. Object with C<encode> and C<decode> methods for reading and writing
JSON. Defaults to:
JSON::MaybeXS->new->utf8->convert_blessed->can
sdIndex . '/_bulk',
method => 'POST',
headers => {
'Content-Type' => 'application/json',
'Content-Length' => length($payload),
}
};
my $req = HTTP::Request->new();
$re
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>.
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