[Dbix-class] why is this returning an hash?

Bill Moseley moseley at hank.org
Thu May 16 14:11:25 GMT 2013


On Wed, May 15, 2013 at 8:59 PM, Rajeev Prasad <rp.neuli at yahoo.com> wrote:

> in below, $id is unique in the table, so it returns just one row.
>
> my @item_array =3D $schema->resultset('Mytable')->search(
>         { item_id =3D> $id },
>         { select   =3D> [qw/item_status/] }
>         );
> print "print array =3D at item_array\n";
>
>
>  ./test.pl
> node status=3DDb::Schema::Result::Mytable=3DHASH(0x17b9cf8)
> $
>
>
> I actually/finally  want to get the value of an specific column by
> supplying $id. not sure how to get that.
>

Or another way:

my $item_status =3D $schema->resultset( 'Mytable' )->search({ item_id =3D> =
$id
})->get_column( 'item_status' )->first;


The docs are pretty good on this:

http://search.cpan.org/~ribasushi/DBIx-Class-0.08250/lib/DBIx/Class/ResultS=
et.pm#get_column
http://search.cpan.org/~ribasushi/DBIx-Class-0.08250/lib/DBIx/Class/ResultS=
etColumn.pm#first


-- =

Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20130516/c53=
5cef2/attachment.htm


More information about the DBIx-Class mailing list