X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FApp%2FIdiotBox%2FDataSet.pm;fp=lib%2FApp%2FIdiotBox%2FDataSet.pm;h=b23836481427b33c42e25072621d9b41524181e9;hb=265c2b91939cee71396509d9f9dc150c4c9bc39e;hp=0000000000000000000000000000000000000000;hpb=71fd155003c63e8d51dbb7d7ab992752506579aa;p=catagits%2FApp-IdiotBox.git diff --git a/lib/App/IdiotBox/DataSet.pm b/lib/App/IdiotBox/DataSet.pm new file mode 100644 index 0000000..b238364 --- /dev/null +++ b/lib/App/IdiotBox/DataSet.pm @@ -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;