Andy,

So I'm proposing that I fix them too and make them do what they should
always have done - a straight conversion between list and hash

  hash.list => [ %$hash ]
  list.hash => { @$list }

Actually, interestingly enough, I'm already overriding HASH_OPS->{'list'} in one of my two projects. But I don't use what you're suggesting there; rather I use

        hash.list => [ $hash ]

which seems to me to match better the way a scalar would convert. Specifically, I use Config::General to read in a file, then toss the resulting hash directly to TT2. So if I have a section:

        <Thing>
                name=Fred
                foo=bmoogle
        </Thing>

then .Thing is a hash, whereas if I have multiple sections, like so:

        <Thing>
                name=Fred
                foo=bmoogle
        </Thing>

        <Thing>
                name=Sue
                foo=rorschach
        </Thing>

then .Thing is an array of hashes. So this way I can use .Thing.list() when I'm not sure which one I'll have. For this, it seems like [$hash] is better than [%$hash] (and exactly matches the way scalar.list works). Just a thought.

Not sure about the list.hash aspect; never used that one.

Here's my question about XS Stash changes: I saw in the documentation that tie'd hashes don't really work with the XS Stash. (Took me a while to find it, and I can't find it again now, but I did eventually come across it.) Is this one of those things that's too horrifically bitchy to even think about fixing, or just something nobody ever got around to? I wish I knew enough about XS and C reps of Perl vars to submit a patch, but, alas, I don't. Just wondering if that was something you could take a look at while you're poking around, or if it's as I say too horrific to even even contemplate. :)


                -- Buddy

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

Reply via email to