f->component );
}
has json => (
is => 'ro',
lazy => 1,
builder => '_build_json',
);
method _build_json() {
eval "use JSON::Any; 1;" or die $@;
return JSON::Any->new;
}
1;
__EN
<Exobrain::Cache> object, with a namespace of
C<$self->component>.
=head2 json
my $json = $self->json;
Returns a L<JSON::Any> object.
=head1 AUTHOR
Paul Fenwick <pjf@cpan.org>
=head1 COPYRIG
se;
use JSON::Any;
use Method::Signatures;
use Carp;
use Moose::Util::TypeConstraints;
# ABSTRACT: Raw, low-level access to Exobrain packets
our $VERSION = '1.08'; # VERSION
my $json = JSON::Any->
s[0];
my (undef, $namespace, $source) = split(/_/, $frames->[0]);
my $metadata = $json->decode( $frames->[1] );
return $class->$orig(
namespace => $namespace,
es},
summary => $frames->[2],
data => $json->decode( $frames->[3] ),
raw => $json->decode( $frames->[4] ),
nosend => 1,
);
}
package Exobrain::JSONify;
use Moose::Role;
use Storable qw(dclone);
use Data::Structure::Util qw(unbless);
# Basic role that allows converting self object into JSON.
# Really we should use MooseX::S
sub TO_JSON {
my ($self) = @_;
return unbless dclone $self; # Yuck!
}
1;
__END__
=pod
=head1 NAME
Exobrain::JSONify
=head1 VERSION
version 1.08
=for Pod::Coverage TO_JSON
=head1
nings;
use JSON::Any;
# ABSTRACT: Type system for Exobrain
our $VERSION = '1.08'; # VERSION
my $json = JSON::Any->new( allow_blessed => 1 );
use MooseX::Types -declare => [qw(
JSON
POI
HashRef
Ref
Str
Num
Int
);
subtype JSON,
as Str,
where { $json->decode($_) }
;
coerce JSON,
from Ref,
via { $json->encode($_) }
;
subtype SmsStr,
as Str,
wh
Constraints;
use Carp;
use ZMQ::Constants qw(ZMQ_SNDMORE);
use ZMQ;
use JSON::Any;
use Data::Dumper;
use Exobrain::Types qw(JSON);
# ABSTRACT: Top-level role for all exobrain messages
our $VERSION =
# data.
requires qw(summary);
# TODO: We should use JSON::XS, because we need specialised features
# for handling objects.
my $json = JSON::Any->new( convert_blessed => 1 );
# We define a du
s;
push(@frames, join("_", "EXOBRAIN", $self->namespace, $self->source));
push(@frames, $json->encode( {
timestamp => $self->timestamp,
roles => $self->roles,
# TO