Re: [Templates] Single object list problem by VMethods

2009-12-10 Thread Bill Moseley
On Thu, Dec 10, 2009 at 5:33 AM, wrote: > 6 Sorted array of 1 MyObj item: MyObj=HASH(0x1c57c2c) -> foo = > name = > I think that's the issue where a single object (as a hash ref) ends up looking like a list of keys and values when used as a list. I see that I often do this: FOR i =

Re: [Templates] Single object list problem by VMethods

2009-12-10 Thread Petr.Danihlik
Thank you very much for your answers. I've tested your suggestion already (I suppose, it was your answer in some other thread), assuming it should work, but I'm afraid it doesn't. Hopefully, it is because .list is just another VMethod. If you test it in my code from previous message (it should

Re: [Templates] Single object list problem by VMethods

2009-12-10 Thread Andy Wardley
On 10/12/2009 10:52, petr.danih...@zf.com wrote: > 1) Did I understand TT behavior correctly? Yes. I'm afraid so. > 2) What is the reason for such behavior? Isn’t there any way in Perl to > determine whether item an object or a hash ref is? It's one hideous hack after another layered on top of

[Templates] Single object list problem by VMethods

2009-12-10 Thread Petr.Danihlik
It seems, there's a bug in TT which causes that an array of single object item could be handled differently than an array of more object items. This already was discussed many times, but I didn't found any satisfying solution, yet. Problem description: This could happen when a method returns

Re: [Templates] using a '.' in a variable

2009-12-10 Thread Robin Smidsrød
On 10.12.2009 11:19, Andy Wardley wrote: > Robin Smidsrød wrote: >> Hi, [% ${my.var} %]. > > Not quite. You also need quotes around the inner part: > > Hi, [% ${'my.var'} %]. Then I suggest a small doc patch to http://template-toolkit.org/docs/manual/Variables.html#section_Variable_Interpolat

Re: [Templates] using a '.' in a variable

2009-12-10 Thread Andy Wardley
Robin Smidsrød wrote: > Hi, [% ${my.var} %]. Not quite. You also need quotes around the inner part: Hi, [% ${'my.var'} %]. A @Robin: sorry for the duplicate I didn't CC it to the list first time around ___ templates mailing list templates@templ

Re: [Templates] using a '.' in a variable

2009-12-10 Thread Robin Smidsrød
On 10.12.2009 09:52, Reagen Siedl wrote: > Can anyone help me with a query i have about TT? I would like to use a > variable name such as 'my.var' and not have TT try to interpret it as an > array/hash. > > $variables{'my.var'} = "some text"; This should do it. Hi, [% ${my.var} %]. Documentat

[Templates] using a '.' in a variable

2009-12-10 Thread Reagen Siedl
Hi, Can anyone help me with a query i have about TT? I would like to use a variable name such as 'my.var' and not have TT try to interpret it as an array/hash. For example in my perl script I would define: $variables{'my.var'} = "some text"; Is this possible? I think maybe I can do it with G