[Dbix-class] doing a search

Octavian Rasnita orasnita at gmail.com
Fri Jan 19 16:18:37 GMT 2007


Hi,

I am trying to make a simple search, but I don't know what I am doing wrong, 
and it doesn't print the right result:

my $roles = $schema->resultset("UserRole")->search;

while (my $role = $roles->next) {
print $role->id_role . "\n";
}

It prints:

Intra::User=HASH(0x20efc48)
Intra::User=HASH(0x20dfea8)
...

I am sure something is missing and I am not dereferencing something 
somewhere, but I can't see where.
If I use exactly the same code but instead of searching in the user_role 
table I search in the role table, and print a field from that table, it 
prints fine.

In the role table I have the fields "id" and "role" and if I print 
$role->role, it works well.
In the user_role table I have id_user and id_role fields, but if I print 
$role->id_role, it doesn't print correctly, just as I shown.

Help!

Thank you.

Octavian




More information about the Dbix-class mailing list