Hiya,

I am using DBIx-Class-0.08010 and I want to constrain the contents of a column, i.e. a column 'name' can only contain text starting with [a- z]. In Class::DBI I could use

__PACKAGE__->constrain_column(name => qr/^[a-z].*$/);

I have tried to overload the accessor in DBIC and this works on existing items, but the accessor is not called when an object is created

$schema->resultset("Names")->create({ name => "4name" });

What is the best way to achieve this with current code? On IRC it was suggested I could use Moose and MooseX::Types (any examples on the 'net of using Moose with DBIx::Class? Couldn't find any) or create a custom resultset and tell my table class to use that via __PACKAGE__- >resultset_class().

I am using $schema->deploy to set up my database (so I can version it later) so i wouldn't want to break usage of this.

TIA

Duncs


_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]

Reply via email to