'0.751';
}
use Any::Moose;
use Prophet::Meta::Types;
use Prophet::ConflictingPropChange;
use JSON 'to_json';
use Digest::SHA 'sha1_hex';
has record_type => (
is => 'rw',
isa => 'Str',
);
h
( delete $_->{source_new_value}, delete $_->{target_value} ) ];
}
return sha1_hex( to_json( $struct, { utf8 => 1, canonical => 1 } ) );
}
__PACKAGE__->meta->make_immutable;
no Any::Moose;
ecord_prop( $1, $2, $3 ) };
on qr|^/(.*)/(.*).json$| =>
sub { shift->server->update_record( $1, $2 ) };
on qr|^/(.*).json$| => sub { shift->server->create_record($1) };
}
/static/prophet/(.*)$' =>
sub { shift->server->send_static_file($1) };
on qr'^/records.json' => sub { shift->server->get_record_types };
under qr'/records' => sub {
on qr|^/(.*)
ecord_prop( $1, $2, $3 ); };
on qr|^/(.*)/(.*).json$| =>
sub { shift->server->get_record( $1, $2 ) };
on qr|^/(.*).json$| => sub { shift->server->get_record_list($1) };
nflict->has_conflicting_changes;
$self->log_debug( "Conflicting changeset: "
. JSON::to_json( $conflict, { allow_blessed => 1 } ) );
return $conflict;
}
sub _check_db_uuids_on_mer
= shift;
my $default = shift;
my $json = $self->read_userdata( path => $path ) || $default;
require JSON;
return JSON::from_json( $json, { utf8 => 1 } );
}
sub _do_userdata_writ
my $self = shift;
my $path = shift;
my $value = shift;
require JSON;
my $content =
JSON::to_json( $value, { canonical => 1, pretty => 0, utf8 => 1 } );
$self->write_user
e Prophet::Web::Result;
use Params::Validate qw/:all/;
use File::Spec ();
use Cwd ();
use JSON;
use HTTP::Date;
# Only define a class type constraint for CGI if it's not already defined,
# be
>cgi->param($_) } $self->cgi->param() } );
$self->_send_redirect( to => "/records/$type/$uuid.json" );
}
sub create_record {
my $self = shift;
my $type = shift;
my $record = $self
aram($_) } $self->cgi->param() } );
return $self->_send_redirect( to => "/records/$type/$uuid.json" );
}
sub get_record_prop {
my $self = shift;
my $type = shift;
my $uuid = shi
te.
use Any::Moose;
use Prophet::Change;
use Params::Validate;
use Digest::SHA qw/sha1_hex/;
use JSON;
has creator => (
is => 'rw',
isa => 'Str|Undef',
);
has created => (
is =>
calculate_sha1 {
my $self = shift;
return sha1_hex( $self->canonical_json_representation );
}
sub canonical_json_representation {
my $self = shift;
my $hash_changeset = $se
ete $hash_changeset->{'sequence_no'};
delete $hash_changeset->{'source_uuid'};
return to_json( $hash_changeset,
{ canonical => 1, pretty => 0, utf8 => 1 } );
}
__PACKAGE__->meta->ma
tting::VERSION = '0.751';
}
use Any::Moose;
extends 'Prophet::Record';
use Params::Validate;
use JSON;
has default => ( is => 'ro', );
has label => (
isa => 'Str|Undef',
is => 'rw',
);
ha
) ) {
$entry = [@_];
} else {
$entry = shift @_;
}
my $content = to_json(
$entry,
{
canonical => 1,
pretty => 0,
nless $self->load( uuid => $self->uuid );
my $content = $self->get_raw;
my $entry = from_json( $content, { utf8 => 1 } );
return $entry;
}
__PACKAGE__->meta->make_immutable;
no Any::Moos
e::Find;
use Prophet::Util;
use POSIX qw();
use Memoize;
use Prophet::ContentAddressedStore;
use JSON;
use Digest::SHA qw(sha1_hex);
has '+db_uuid' => (
lazy => 1,
default => sub { shift-
$args{'type'},
uuid => $args{'uuid'}
);
return unless $casfile;
return from_json( $self->_read_file($casfile), { utf8 => 1 } );
}
# XXX TODO: memoize doesn't work on win:
# t\re
eplica';
use Params::Validate qw(:all);
use File::Spec ();
use File::Path;
use Prophet::Util;
use JSON;
use Digest::SHA qw/sha1_hex/;
use DBI;
has dbh => (
is => 'rw',
isa => 'DBI::d
;
my $cs = $self->_load_changeset_from_db( sha1 => $args{sha1} );
return $cs->canonical_json_representation;
}
sub _load_changeset_from_db {
my $self = shift;
my %args = validate(
=item *
L<autobox|autobox>
=item *
L<autobox::Core|autobox::Core>
=item *
L<autobox::JSON|autobox::JSON>
=item *
L<MIME::Base64|MIME::Base64>
=back
=head1 SOURCE
The development version is
reference to a hash representation of a change (such as is returned by
L</as_hash> or serialized json) and returns a new Prophet::Change
representation of it.
This method should be invoked as a clas
S::FS::DirCodec::Universal;
use 5.0080001;
use strict;
use warnings;
use Try::Tiny;
use Carp;
use JSON 2.53 ();
require DataStore::CAS::FS::Dir;
require DataStore::CAS::FS::DirEnt;
require DataStore::
c for saving all arbitrary fields of a DirEnt
our $_json_coder;
sub _build_json_coder {
DataStore::CAS::FS::InvalidUTF8->add_json_filter(
JSON->new->utf8->canonical->convert_blessed, 1
);
}
sub
entry: ".JSON::encode_json($entry);
defined $entry->{type} or croak "Can't serialize typeless directory entry: ".JSON::encode_json($entry);
!defined($_) || (ref $_? ref($_)->can("TO_JSON") : &ut
FATAL => 'all';
use Moo;
use Getopt::Long qw(GetOptionsFromArray);
use Redis;
use Try::Tiny;
use JSON;
=head1 NAME
Uninets::Check::Modules::Redis - Uninets::Check module to check redis servers.
=h
my ($self, $status, $value, $format) = @_;
return JSON->new->encode(
{
message => $value,
status => $status,
}
) if $format eq 'json';
# default last in case some non supported format
'Default: num',
},
formats => {
'num' => 'Returns the status code',
'json' => 'Returns a JSON structure',
},
},
size => {
description => 'Check redis RAM consumption',
sub preset {
return $presets{$_[1]} if %presets;
use JSON ();
my $json = JSON->new;
while ( <DATA> ) {
my $data = $json->decode($_);
my $preset = __PACKAGE__->new;
$preset->chorus
ATAL => 'all';
use Moo;
use Getopt::Long qw(GetOptionsFromArray);
use Try::Tiny;
use MongoDB;
use JSON;
=head1 NAME
Uninets::Check::Modules::MongoDB - Uninets::Check module to check mongodb servers.
my ($self, $status, $value, $format) = @_;
return JSON->new->encode(
{
message => $value,
status => $status,
}
) if $format eq 'json';
# default last in case some non supported format
'Default: num'
},
formats => {
'num' => 'Returns the status code',
'json' => 'Returns a JSON structure',
},
},
},
}
}
=head1 AUTHOR
Matthias Krull, C<< <<m.krull at uni
end I decided on a
pluggable implementation, where a "Universal" plugin uses something plain like
JSON, and more specialized plugins do things like storing an array of UNIX
'stat' fields. Users can a
em Universal
L<DataStore::CAS::FS::DirCodec::Universal> stores all metadata of each DirEnt
using JSON. If you use this codec, you are guaranteed that anything your
CAS::FS::Scanner picked up was sav
$song->name("Perl Song");
$song->tempo(120);
$song->add_section(...);
print $song->json, "\n";
=head1 METHODS
=head2 new [ args ]
Creates a new Music::ChordBot::Opus object.
Initial
y || "opus" ] );
}
=head2 json [ pretty ]
Produces a string representing the song, in JSON format, suitable
for import into the ChordBot app.
If argument is true, the JSON is pretty-printed for rea
.
=cut
sub json {
my ( $self, $pretty ) = @_;
$self->_wrapup;
use JSON ();
my $json = JSON->new;
$json->canonical(1);
$json = $json->pretty if $pretty;
$json->encode($sel
Dezi::MultiTenant;
use strict;
use warnings;
use Dezi::Server;
use Dezi::MultiTenant::Config;
use JSON;
use Plack::Builder;
use Plack::Request;
use Plack::App::URLMap;
use Data::Dump qw( dump );
use C
tion/xml',
'application/json',
],
vary_user_agent => 1;
# JSONP response based on 'callback' param
enable "JSONP";
# / is self-description
available => \%avail,
};
my $resp = to_json($about);
return [
200,
[ 'Content-Type' => 'application/json',
'Content-Length' => length $resp,
types are getting more and more
common as CSV data representation starts to give way to XML and JSON.
RDB's can handle complex data by using I<relational tables>. (the I<R> in
I<RDB>.) But RDB da
'all';
use Moo;
use Getopt::Long qw(GetOptionsFromArray);
use Mojo::UserAgent;
use Try::Tiny;
use JSON;
use Time::HiRes;
=head1 NAME
Uninets::Check::Modules::HTTP - Uninets::Check module to check we
, $value, $format) = @_;
return JSON->new->encode(
{
message => $value,
status => $status,
}
) if $format eq 'json';
# default last in case some n
mats => {
'num' => 'Returns the status code',
'json' => 'Returns a JSON structure',
},
default_format => 'num',
},
f : $$self.$other);
}
sub add_json_filter {
my ($self, $json)= @_;
$json->filter_json_single_key_object(
'*InvalidUTF8*' => \&FROM_JSON
);
$json;
}
sub TO_JSON {
my $x= ${$_[0]};
utf8::upgr
ade($x);
return { '*InvalidUTF8*' => $x };
}
sub FROM_JSON {
my $x= $_[0];
utf8::downgrade($x) if utf8::is_utf8($x);
return bless \$x, __PACKAGE__;
}
sub TO_UTF8 {
${$_[0]};
}
1;
__END__
=po
SYNOPSIS
my $j= JSON->new()->convert_blessed;
DataStore::CAS::FS::InvalidUTF8->add_json_filter($j);
my $x= DataStore::CAS::FS::InvalidUTF8->decode_utf8("\x{FF}");
my $json= $j->encode($x);