In most cases I use the same inflator for multiple columns in a table.
So instead of calling inflate_column with the same attributes for each 
column, I'd like to write

__PACKAGE__->inflate_column(qw/col1 col2 col3/ => {
    inflate => sub { Some:Class->inflate },
    deflate => sub { shift->deflate },
});

Changes to inflate_column() would be easy and backwards-compatible, I 
think. Simply rearranged the code a little bit, but didn't actually 
tested:

sub inflate_column {
  my $self = shift;
  my $attrs = pop;
  $self->throw_exception("inflate_column needs attr hashref")
    unless ref $attrs eq 'HASH';
  foreach my $col (@_) {
    $self->throw_exception("No such column $col to inflate")
      unless $self->has_column($col);
    $self->column_info($col)->{_inflate_info} = $attrs;
    $self->mk_group_accessors('inflated_column' => $col);
  }
  return 1;
}

What do you think?
-- 
Bernhard Graf

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/dbix-class@lists.rawmode.org/

Reply via email to