[Dbix-class] fetching a column value directly
Rajeev Prasad
rp.neuli at yahoo.com
Mon Nov 4 22:13:28 GMT 2013
thx all !!!
On Monday, November 4, 2013 1:46 AM, Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯 <daxim at cpan.org> wrote:
Your code is correct. `search` may return several results, so you must
either iterate over them or assign/do something with all the results,
e.g.
->search(…)->all
returns a list of Host resultrow objects. If you are sure the hosts is
unique and therefore `search` will only find one result, you can simply
write:
my $host_addr = ………->search(…)->first->addr
Note the automatically generated accessor for the column.
_______________________________________________
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/dbix-class@lists.scsys.co.uk
More information about the DBIx-Class
mailing list