->figure(
{ class => 'op-map' },
$gen->script(
{ type => 'application/json', class => 'op-geotag' },
'{
"type": "Feature",
"geometry
validation and substitution engine
# - execute the request
# - return the proper fragment of the JSON tree
_mk_subs($methods_urls, { prefix => $PREFIX } );
my %app_to_hist = (
jobs => [ job =>
e Test2::Compare::Number qw/number/;
use Test2::Compare::String;
use Carp qw/croak/;
use JSON;
my $json = JSON->new->utf8;
sub row {
my $self = shift;
my $cached_compare_row = $self->_cache
>{$self->identifier_key},
);
}
sub json {
my ($self, $column, @keys) = @_;
my $json_data = $self->row->{$column};
my $data = $json->decode($json_data);
my $out = $data;
for m
ion.
In the JavaScript implementation we have a small Perl program B<po2json> which
converts the same text datafile into a json format that is more usable in
JavaScript. Sadly this datafile must be o
files will be packed together with all other necessary data
files, like the I<mo> file and the I<json> file for the JavaScript, as a Perl
distribution for our central B<DuckPAN> server, which is used
CT: Metadata functions for instant answers
$DDG::Meta::Data::VERSION = '1018';
use JSON::XS qw'decode_json encode_json';
use Path::Class;
use File::ShareDir 'dist_file';
use LWP::UserAgent;
use File::
to mkdir $mdir: $!";
}
debug && warn "Processing metadata";
my $f = "$mdir/metadata.json.bz2";
my $tmp_bak = "$f.bak";
my @timestamps = (stat $f)[8,9];
if(-e $f){
cop
odable());
my $res = $ua->mirror('http://ddg-community.s3.amazonaws.com/metadata/repo_all.json.bz2', $f);
unless($res->is_success || $res->code == 304){
debug && warn "Fail
strict;
use warnings;
use utf8;
use parent "Test2::Compare::Hash";
use Test2::Util::HashBase qw/json_checks/;
use Carp qw/croak/;
use Scalar::Util qw/blessed/;
sub object_base { "Test::MasterData:
;
}
sub add_json_field {
my $self = shift;
my ($name, @path) = @_;
my $check = pop @path;
croak "column name is required"
unless defined $name;
$self->{+JSON_CHECKS} ||=
[];
push @{$self->{+JSON_CHECKS}} => [$name, \@path, $check];
}
sub _wrap_check {
my ($class, $got, $check) = @_;
my $ccheck = $check->clone;
$ccheck->set_file($got->file);
$cch
with a matching run_id
=item state
A Reasonably long TEXT field (or JSON field in supporting databases) capable of holding
a JSON dump of pure Perl data. NOT NULL.
You HAVE to implement inflating a
master_data
load_csv
table
expect_row
relation
like_number
if_column
json
/;
our $DEFAULT_IDENTIFIER_KEY = "id";
use Test::MasterData::Declare::Runner;
use Test::MasterD
::Compare::RowHash", @_)
}
sub row_json {
my ($column, @keys) = @_;
my $check = pop @keys;
my $build = Test2::Compare::get_build();
croak "row_json must be with-in Test::MasterData::
Hash"
unless $build->isa("Test::MasterData::Declare::Compare::RowHash");
$build->add_json_field($column, @keys, $check);
}
sub table {
my ($table_name, $column, @filters_or_expects)
TEXT => 'TEXT',
LONGTEXT => 'TEXT',
ENUM => 'ENUM',
SET => 'ENUM',
JSON => 'BLOB',
);
our %FIELD2STR = (
EMPTY => sub {
return
$_->quote_i
rce: ".$text."!",
html => "<div>text from random source: ".html_enc($text)."!</div>";
Or use JSON-like booleans:
{ option1 => true, option2 => false }
=head1 DESCRIPTION
This meta class inst
edule::LongSteps::Storage/;
use Compress::Zlib;
use DateTime::Format::ISO8601;
use DateTime;
use JSON qw//;
use Log::Any qw/$log/;
use MIME::Base64;
use Scalar::Util;
my $TIME_MAX = '9999-12-31T23:5
amo_state =~ /^{/ ){
# Assume JSON
return JSON::from_json( $dynamo_state );
}
# Assume base64 encoded memGunzip
return JSON::from_json( Compress::Zlib::memGunzip( MIME::Ba
se Moose;
use Compress::Zlib;
use Data::Dumper;
use DateTime::Format::ISO8601;
use DateTime;
use JSON qw//;
use Log::Any qw/$log/;
use MIME::Base64;
has 'storage' => ( is => 'ro', isa => 'Schedule::
le => 1, size => 36 },
state =>
{ data_type => "text",
serializer_class => 'JSON',
is_nullable => 0,
},
error =>
{ data_type => "text", is_nullable =>
strict;
use warnings;
use utf8;
use parent "Test2::Compare::Hash";
use Test2::Util::HashBase qw/json_checks/;
use Carp qw/croak/;
use Scalar::Util qw/blessed/;
sub object_base { "Test::MasterData:
;
}
sub add_json_field {
my $self = shift;
my ($name, @path) = @_;
my $check = pop @path;
croak "column name is required"
unless defined $name;
$self->{+JSON_CHECKS} ||=
[];
push @{$self->{+JSON_CHECKS}} => [$name, \@path, $check];
}
sub _wrap_check {
my ($class, $got, $check) = @_;
my $ccheck = $check->clone;
$ccheck->set_file($got->file);
$cch
# VERSION
use File::Spec;
use Dancer2::Plugin;
use Module::Load;
use Carp;
use JSON ();
use JSON::Pointer;
use YAML::XS;
use Data::Walk;
our $ValidationCompiler; ## no critic (Variables:
}->location, $config->{schema});
if ($config->{schema} =~ /\.json/i) {
require Path::Tiny;
$schema = JSON::from_json(path($file)->slurp_utf8);
} elsif ($config->{schema} =~ /\.
{
(my $r = $_->{'$ref'}) =~ s/^#//;
my $rp = JSON::Pointer->get($schema, $r);
if ('HASH' eq ref $rp) {
: ()
),
'Prereqs::AuthorDeps',
'MetaYAML', # core
'MetaJSON', # core
'CPANFile',
# build system
'ExecDir', # core
'ShareDir
as develop/requires
[MetaYAML] ; generate META.yml (v1.4)
[MetaJSON] ; generate META.json (v2)
[CPANFile] ; generate cpanfile
; build system
[ExecDir
cate => 'has_from',
);
has callback => (
is => 'ro',
predicate => 'has_callback',
);
has wrap_jsonp_callback => (
is => 'ro',
default => sub { 0 },
);
has wrap_string_callback => (
is => 'r
other things into jsonp
croak "Cannot use wrap_jsonp_callback and wrap_string callback at the same time!" if $self->wrap_jsonp_callback && $self->wrap_string_callback;
my $wrap_jsonp_callback = $sel
f->has_callback && $self->wrap_jsonp_callback;
my $wrap_string_callback = $self->has_callback && $self->wrap_string_callback;
my $uses_echo_module = $wrap_jsonp_callback || $wrap_string_callback;
m
S = (all => [@EXPORT_OK], constants => [@CONSTANTS]);
use HTML::TreeBuilder;
use HTTP::Tiny;
use JSON::MaybeXS;
use Time::Piece;
our $STOPS_URL = 'http://www.buscms.com/Nimbus/operatorpages/widgets/
ormat=jsonp&cachebust=123&sourcetype=siri&requestor=Netescape&includeTimestamp=true&_=%d';
our $DEPART_TIME_FORMAT = '%d/%m/%Y %T';
our $NEXTBUS_URL = 'http://nextbus.brookes.ac.uk/%s?format=json&%s';
result->{reason} unless $result->{success};
my $json = $result->{content};
$json = substr $json, 3, (length $json) - 5;
my $stops = decode_json($json)->{stops};
wantarray ? @$stops : $stops
}
sub
ta::ICal::Entry::Alarm::Display;
use DateTime::Format::ICal;
use DateTime::TimeZone;
use JSON::XS qw(encode_json);
use Net::CalDAVTalk::TimeZones;
use Text::VCardFast qw(vcard2hash);
use XML::Spice;
u
ions => [0, 'object', 0, undef],
isAllDay => [0, 'bool', 0, $JSON::false],
start => [0, 'localdate', 1, undef],
timeZone =>
cipants => [0, 'object', 0, undef],
useDefaultAlerts => [0, 'bool', 0, $JSON::false],
alerts => [0, 'object', 0, undef],
},
replyTo => {
e DateTime::Format::x509;
use Digest::MD5 qw(md5_hex);
use Digest::SHA1 qw(sha1);
use Encode;
use JSON;
use LWP::Simple;
use MIME::Base64 qw(decode_base64);
use Moo;
use Try::Tiny;
use Types::Standard
iptive::Full>.
The save/load interface is designed compatible with JSON::XS.
However, any other serializer can be used.
The C<TO_JSON> method is I<guaranteed> to return unblessed hashref
with enough i
::LogScale->new ();
# ..... much later
# Save
print $fd encoder_of_choice( $stat->TO_JSON )
or die "Failed to save: $!";
# ..... and even later
# Load
my $plain_hash
__PACKAGE__.": new(): linear_thresh must be >= 0";
# Can't use fields::new anymore
# due to JSON::XS incompatibility with restricted hashes
my $self = bless {}, $class;
$self->{base} = $opt{b