[Dbix-class] Feature request for
DBIx::Class::InflateColumn::inflate_column
Bernhard Graf
dbic1 at augensalat.de
Fri Oct 27 22:53:00 BST 2006
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
More information about the DBIx-Class
mailing list