Thomas Rubattel > DBIx-Class-LookupColumn >
DBIx::Class::LookupColumn    Annotate this POD  View/Report Bugs
Module Version: 0.10   Source     DBIx::Class::LookupColumn -
DBIx::Class components to help using Lookup tables.
DBIx::Class::LookupColumn::Auto is probably what you need to
apply this system on your schema.   # User table with columns
user_id, name, and user_type_id (foreign_key to UserType Lookup
table)  package MySchema::Result::User;
__PACKAGE__->add_columns( "user_id",{}, "name", {},
"user_type_id", {} );  __PACKAGE__->belongs_to( "user_type" =>
"Schema3::Result::UserType", {"user_type_id" =>
"self.user_type_id"} );   # UserType Lookup table, with 2
columns (user_type_id, name) with rows: ( 1 => 'Administrator' ,
2 => 'User' , 3 => 'Guest' )   # $user is a DBIx::Class::Row
instance, e.g. $user=$schema->resultset('User')->find( { name =>
'Flash Gordon'} )  print $user->type; # print 'Administrator',
not very impressive, could be written as
$user->user_type()->name()  print $user->type; # same t