[Catalyst] Getting hashref instead of value

Kenneth S Mclane ksmclane at us.ibm.com
Tue May 8 15:44:01 GMT 2012


The Catalyst helper script created most of the relationships. I added a 
few at the bottom of the Account.pm file to since there are a bunch of 
them based on "account_id", so I made them myself and gave them different 
names. progress, metrics, compliance are ones I did. the one called 
"department_id" was created by the helper and I didn"t want to chang it. I 
guess I could redefine it below with a different name. Strangely, the 
account table has a belongs to AND a has many to itself based on the 
account_id field. I am actually looking to get a list nad that is what I 
get except for the one field.



From:
Alexander Hartmaier <alexander.hartmaier at t-systems.at>
To:
<catalyst at lists.scsys.co.uk>
Date:
05/08/2012 10:35 AM
Subject:
Re: [Catalyst] Getting hashref instead of value



Am 2012-05-08 17:25, schrieb Ari Constancio:
> On Tue, May 8, 2012 at 4:13 PM, Kenneth S Mclane <ksmclane at us.ibm.com> 
wrote:
>> My template that cretaes the uri:
>>
>> <td><a href="[% c.uri_for('/accountdetails/detail/') %][% 
account.account_id
>> %]">[% account.account_code %]</a></td>
>>
>> If someone could point me in the right direction, Ive been fighting 
this for
>> days.
> Hi Kenneth,
>
> I suppose you mean to use
>
> [% c.uri_for('/accountdetails/detail/', account.account_id) %]
>
> instead of
>
> [% c.uri_for('/accountdetails/detail/') %][% account.account_id %]
No he doesn't because he isn't using Chained but Local where the
dispatcher knows nothing about the number of args.

I assume that you have defined a relationship on the account_id column
without giving it a different name. This makes DBIx::Class inflate the
related row into an object.
Two solutions:
- use a different accessors for your relationships (that's what I'm doing)
- use acount.get_column('account_id') when you can to get the column
value instead of the related row

Also note that it's a common problem that Template Toolkit calls
everything in list context.
search_rs was added to DBIx::Class to make sure you always get a
resultset object and not a list of row objects.
>
> Regards,


*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be 
privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*

_______________________________________________
List: Catalyst at lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: 
http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20120508/155059ce/attachment.htm


More information about the Catalyst mailing list