> 
> yes, have the class implement this method:
> 
> sub keys {
>   my $self = shift;
>   return [ keys %$self ];
> }

I was hoping to find a way that didn't require modifying classes. I have a
template which can be pointed at any TT source to find out what variables
are available (like a fancy Dumper output). However it descends into a hash
only if hash.keys exists.

I found this out recently when I set up Bryar and wanted to find out what
variables I could use in my custom templates. My introspection template
would work for much of the data structure but skip the various Bryar objects
embedded in the data structure. Yet they can be accessed like normal hashes:
[% bryar.config.description %].

There seems to be a mismatch between what can be accessed as keys and what
the keys vmethod returns.

- Mark.


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

Reply via email to