hello,

i'm experiencing a weird problem using tt2.

i have a sub ref in my tt2 config defined as follows:

loadlead => sub { return crm::model::lead->load(@_) }

i call this sub in a template:

[% lead = loadlead(row.leadid, row.subid, account.accountid) %]

i know loadlead() is being called properly. when loadlead returns a blessed
reference, and i use it in the template, for example:

[%lead.name%]

i always get something like:

crm::model::lead=HASH(0x8851788)

when i don't bless the hash, everything works as expected. if i make the call
in the perl code and assign the result to tt2 config like:

lead => crm::model::lead->($$row{leadid}, $$row{subid}, $$account{accountid})

it also works fine in this case too, even if the result is blessed!

can someone explain what is going on? i suspect this has something to do with
the templated being processed in an eval'ed environment, but i'm not sure. is
there a workaround other than creating the object within the perl code?

thanks,

scott weisman

_______________________________________________
templates mailing list
[EMAIL PROTECTED]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to