in reply to Re: Default column values in DBIx::Class
in thread Default column values in DBIx::Class

Thank you!!

So as not to have my constants in two places, I've written something like this:

sub new { my ( $class, $attr ) = @_; foreach my $col ( $class->columns ) { my $col_info = $class->column_info( $col ); if ( ! defined $attr->{$col} && exists $col_info->{default_value} && ! $col_info->{is_auto_increment} ) { $attr->{$col} = $col_info->{default_value}; } } return $class->next::method( $attr ); }

With the little testing that I've done so far, this seems to work like a charm.

Thanks again!