"Roderick A. Anderson" <[EMAIL PROTECTED]> writes:

> [...]
> Further coding -- under Windows -- seems to indicate at $tt->error() 
> doesn't show up when used with die. [...]

I've been using TT under Windows for some years and can't confirm
this.  Could you give a complete example?

> [...]  And I mention this as it looks like my problem was the old 
> odd count in the hash error.

You are not by any chance talking about a message like the following?

    Odd number of elements in hash assignment at a.pl line 8.

There is nothing wrong with having an odd number of keys in a hash,
neither in Perl nor in TT.

The "Odd number" in the message above means that you have a wrong
initialisation of your hash like e.g.

   %HASH = ('key1' => 'value1'
           ,'key2' => 'value2'
           ,'key3');

OK, this is easy to spot.  However, I recall a case where it took me
some time to figure out what happened:

   %HASH = ('key1' => somefunction('value1')
           ,'key2' => 'value2'
           ,'key3' => 'value3');

In this case somefunction() is evaluated in list context.  If, for
some reason, somefunction() returns an empty list if called in list
context, or a list of two elements, then you get an "Odd number of
elements".  As a consequence, 'key2' is being seen as a value, and
'value2' is the key for 'key3' and so on (keep in mind that '=>' is
just an alias for ',').  Exchanging keys and values can of course make
TT choke.
-- 
Cheers,
haj


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

Reply via email to