[Dbix-class] tinyint and enum mapping

jackal me at jackal.in
Thu Oct 30 07:45:16 GMT 2008


On Tuesday 28 October 2008 03:05:48 Matt S Trout wrote:
> > Module I want to contribute, ModifyColumn, can do it:
> >
> > my @status = qw/ok banned warned something else/;
> > __PACKAGE__->modify_column('status', {
> >     inflate => sub { $status[$_[0]] },
> >     deflate => sub {
> >         my $value = shift;
> >         for (my $i=0; $i<=$#status; $i++) {
> >             return $i if $status[$i] eq $value;
> >         }
> >         return undef;
> >     }
> > });
> >
> > http://lists.scsys.co.uk/pipermail/dbix-class/2008-October/006968.html
>
> Be nice if you could handle >1 value and >1 actual column - the biggest
> annoyance of inflate_column has been the limitation of 1 column and 1
> attribute.

I don't clearly understand what you mean. Can you give an example of desired 
interface?

Now I'm doing like this:
foreach my $c (qw/col1 col2 col3/) {
  __PACKAGE__->modify_column($c, {...});
}


-- 
Kind regards, Eugeny.



More information about the DBIx-Class mailing list