[Dbix-class] list 2 columns for all records in table not working

Rajeev Prasad rp.neuli at yahoo.com
Wed Oct 17 04:43:58 GMT 2012



hello Paul,

thx. That helped. even though i could see the 'HASH' in my output, i was under the impression (from the doc..) that i should get an array straightway.

now another problem. following is not working, i am currently using work around..


if ( $str=~/\b"$item->itemid"\b/ ) {    
....
        }

(i tried few things above, in the end)  my workaround

my $tmpvar=$item->itemid  ;
if ( $str=~/\b$tmpvar\b/ ) {    
....
        }


i was thinking if i do not have to use a variable just for one step...

________________________________
From: Paul Findlay <Paul.Findlay at fonterra.com>
To: Rajeev Prasad <rp.neuli at yahoo.com>; DBIx::Class user and developer list <dbix-class at lists.scsys.co.uk> 
Sent: Tuesday, October 16, 2012 9:30 PM
Subject: RE: [Dbix-class] list 2 columns for all records in table not working



Hi Rajeev,

You are tried to print an array, and then tried to print each object in an array. Since each object is a blessed hash, the “Itemdb::Schema::Result::Itemlist=HASH(..)” is appearing because perl doesn’t know any better way to convert it to a string.

Have you considered:

foreach my $item (@items) {
    print $item->itemid, ' ', $item->artistid, "\n";
}

Instead?

This is documented in “Basic Usage” https://metacpan.org/module/DBIx::Class::Manual::Intro#Basic-usage

(sorry about the HTML email everyone)

Paul Findlay 
Process Information Engineer 
paul.findlay at fonterra.comdirect +64 7 849 7871
Fonterra Co-operative Group Limited, Te Rapa, Hamilton, New Zealand 

________________________________
DISCLAIMER
This email contains information that is confidential and which may be legally privileged. If you have received this email in error, please notify the sender immediately and delete the email. This email is intended solely for the use of the intended recipient
and you may not use or disclose this email in any way.        



More information about the DBIx-Class mailing list