| KiokuDB documentation | Contained in the KiokuDB distribution. |
KiokuDB::Backend::Serialize::JSPON::Converter - Common functionality for JSPON expansion/collapsing
# internal
These attributes are shared by both KiokuDB::Backend::Serialize::JSPON::Converter and KiokuDB::Backend::Serialize::JSPON::Expander.
These attributes are also available in KiokuDB::Backend::Serialize::JSPON and passed to the constructors of the expander and the collapser.
The various field name mappings for the KiokuDB::Entry attributes.
Everything defaults to the attribute name, except class and class_meta
which default to __CLASS__ and __META__ for compatibility with
MooseX::Storage when inline_data is set, and ref_field which is set to
$ref according to the JSPON spec.
Determines whether or not the entry data keys are escaped and the data is
stored in the same top level mapping, or inside the data_field key.
| KiokuDB documentation | Contained in the KiokuDB distribution. |
#!/usr/bin/perl package KiokuDB::Backend::Serialize::JSPON::Converter; use Moose::Role; use namespace::clean -except => 'meta'; sub _jspon_fields { return qw( id class class_meta class_version root deleted tied ref data backend_data ); } has id_field => ( isa => "Str", is => "ro", default => "id", ); has class_field => ( isa => "Str", is => "ro", default => "__CLASS__", ); has class_meta_field => ( isa => "Str", is => "ro", default => "__META__", ); has class_version_field => ( isa => "Str", is => "ro", default => "__VERSION__", ); has root_field => ( isa => "Str", is => "ro", default => "root", ); has deleted_field => ( isa => "Str", is => "ro", default => "deleted", ); has tied_field => ( isa => "Str", is => "ro", default => "tied", ); has ref_field => ( isa => "Str", is => "ro", default => '$ref', ); has data_field => ( isa => "Str", is => "ro", default => "data", ); has backend_data_field => ( isa => "Str", is => "ro", default => "backend_data", ); has inline_data => ( isa => "Bool", is => "ro", default => 0, ); # kinda ugly, used to pass options down to expander/collapser from backend has _jspon_params => ( isa => "HashRef", is => "ro", lazy_build => 1, ); sub _build__jspon_params { my $self = shift; return { ( map { my $name = "${_}_field"; $name => $self->$name } $self->_jspon_fields, ), ( inline_data => $self->inline_data ? 1 : 0 ), }; } __PACKAGE__ __END__