[Dbix-class] fetching a column value directly

Rajeev Prasad rp.neuli at yahoo.com
Mon Nov 4 05:29:14 GMT 2013



hello,

I have this "host" table, which has all unique records. So i want to get a specific column value for a specific host. i am doing below, but i think it is not efficient. is there a better way?

my $hostAdd_rs = $schema->resultset('Host')->search({host=>$host},{select=>[qw/addr/]});
while (my $rec = $hostAdd_rs-next() ) {
    $hostAdd = $rec->get_column('addr');
}


can we not do it in a single line command? without any while loop?

i tried, but getting various errors.

ty.
Rajeev




More information about the DBIx-Class mailing list