[Dbix-class] Shortcut to perform lookups

Dan Horne dan.horne at redbone.co.nz
Tue Jul 7 00:29:05 GMT 2009


Say I have a table called customer  which links to a parent table  
called status. I wonder if there is a shortcut so that I don't need to  
figure out the parent id in advance if I know the unique name.

my $status = $self->schema->resultset('Status')->search({status_name  
=> 'new'})->single;

my $customer = $self->schema->resultset->create({
     name => 'Acme Corp',
     status_id => $status->id
})

I've had a peruse of the Cookbook, but couldn't see anything



More information about the DBIx-Class mailing list