apparently vaguely working store code
[catagits/App-IdiotBox.git] / lib / App / IdiotBox / DataSet.pm
1 package App::IdiotBox::DataSet;
2
3 use strict;
4 use warnings FATAL => 'all';
5 use Scalar::Util qw(blessed);
6
7 use base qw(DBIx::Data::Collection::Set);
8
9 sub _inflate {
10   my ($self, $raw) = @_;
11   my %new;
12   foreach my $k (keys %$raw) {
13     my @parts = split /\./, $k;
14     my $final = pop @parts;
15     @parts or ($new{$k} = $raw->{$k}, next);
16     my $targ = \%new;
17     $targ = $targ->{$_}||={} for @parts;
18     $targ->{$final} = $raw->{$k};
19   }
20   $self->_class->{inflate}->($self, \%new);
21 }
22
23 sub _deflate {
24   my ($self, $obj) = @_;
25   $self->_class->{deflate}->($self, $obj)
26 }
27
28 sub _merge { die "no" }
29
30 1;