logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: question about function returning a blessed hash: msg#00095

Subject: Re: question about function returning a blessed hash
Did you see what Data::Dumper reports?

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

might prove to be informative ...

jeffa

--- Scott Weisman <sweisman-e+AXbWqSrlAAvxtiuMwx3w@xxxxxxxxxxxxxxxx> wrote:
> 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
> templates-MnLy+PD7ppGDO3lXZvfOKmD2FQJk+8+b@xxxxxxxxxxxxxxxx
> http://lists.template-toolkit.org/mailman/listinfo/templates


__________________________________
Do you Yahoo!?
Find out what made the Top Yahoo! Searches of 2003
http://search.yahoo.com/top2003



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>