BICConnectInfo DBICHashRef/;
use MooseX::Types::JSON qw(JSON);
use MooseX::Types::Path::Class qw(Dir File);
use Try::Tiny;
use JSON::Any qw(DWIW XS JSON);
use namespace::autoclean;
=head1 NAME
DBIx:
ash ref or json string to be used for identifying data to manipulate
=cut
has 'where' => (
is => 'rw',
isa => DBICHashRef,
coerce => 1,
);
=head2 set
a hash ref or json string to
> (
is => 'rw',
isa => DBICHashRef,
coerce => 1,
);
=head2 attrs
a hash ref or json string to be used for passing additional info to the ->search call
=cut
has 'attrs' => (
is
ttyTrace - Pretty Tracing DebugObj
=head1 SYNOPSIS
DBIC_TRACE_PROFILE=~/dbic.json perl -Ilib ./foo.pl
Where dbic.json contains:
{
"profile":"console",
"show_progress":1,
"squash_repeats
BIx::Class administrative library
=over
=item * JSON::Any >= 1.22
=item * Moose >= 0.98
=item * MooseX::Types >= 0.21
=item * MooseX::Types::JSON >= 0.02
=item * MooseX::Types::Path::Class >= 0.
tem * Getopt::Long::Descriptive >= 0.081
=item * JSON::Any >= 1.22
=item * Moose >= 0.98
=item * MooseX::Types >= 0.21
=item * MooseX::Types::JSON >= 0.02
=item * MooseX::Types::Path::Class >= 0.
s generated automatically by calling _gen_pod from the
# Makefile.PL in $AUTHOR mode
my $json_any = {
'JSON::Any' => '1.22',
};
my $moose_basic = {
'Moose'
%$moose_basic,
};
my $admin_basic = {
%$moose_basic,
%$json_any,
'MooseX::Types::Path::Class' => '0.05',
'MooseX::Types::JSON' => '0.02',
'namespace::autoclean' => '
=> {
'Test::EOL' => '1.0',
},
},
test_prettydebug => {
req => $json_any,
},
test_leaks => {
req => {
'Test::Memory::Cycle' => '0',
'Devel:
pes::JSON qw(JSON);
subtype DBICArrayRef,
as ArrayRef;
subtype DBICHashRef,
as HashRef;
coerce DBICArrayRef,
from JSON,
via { _json_to_data ($_) };
coerce DBICHashRef,
from JSON,
v
_json_to_data($_) };
subtype DBICConnectInfo,
as ArrayRef;
coerce DBICConnectInfo,
from JSON,
via { return _json_to_data($_) } ;
coerce DBICConnectInfo,
from Str,
via { return _json_t
via { [ $_ ] };
sub _json_to_data {
my ($json_str) = @_;
my $json = JSON::Any->new(allow_barekey => 1, allow_singlequote => 1, relaxed=>1);
my $ret = $json->jsonToObj($json_str);
return $ret;
m .. store JSON/YAML in a column and have it deflate/inflate automatically?
You can use L<DBIx::Class::InflateColumn> to accomplish YAML/JSON storage transparently.
If you want to use JSON, then in
lowing:
use JSON;
__PACKAGE__->add_columns(qw/ ... my_column ../)
__PACKAGE__->inflate_column('my_column', {
inflate => sub { jsonToObj(shift) },
deflate => sub { objToJson(shift) },
}