apparently vaguely working store code
[catagits/App-IdiotBox.git] / lib / App / IdiotBox / DataSet.pm
diff --git a/lib/App/IdiotBox/DataSet.pm b/lib/App/IdiotBox/DataSet.pm
new file mode 100644 (file)
index 0000000..b238364
--- /dev/null
@@ -0,0 +1,30 @@
+package App::IdiotBox::DataSet;
+
+use strict;
+use warnings FATAL => 'all';
+use Scalar::Util qw(blessed);
+
+use base qw(DBIx::Data::Collection::Set);
+
+sub _inflate {
+  my ($self, $raw) = @_;
+  my %new;
+  foreach my $k (keys %$raw) {
+    my @parts = split /\./, $k;
+    my $final = pop @parts;
+    @parts or ($new{$k} = $raw->{$k}, next);
+    my $targ = \%new;
+    $targ = $targ->{$_}||={} for @parts;
+    $targ->{$final} = $raw->{$k};
+  }
+  $self->_class->{inflate}->($self, \%new);
+}
+
+sub _deflate {
+  my ($self, $obj) = @_;
+  $self->_class->{deflate}->($self, $obj)
+}
+
+sub _merge { die "no" }
+
+1;