Trond Michelsen wrote:
> Is it possible to access hash elements of an object which is also a
> tied hash?

Yes you can using the regular Perl Stash, but not using the XS Stash which
doesn't supports tied objects (something which is very non-trivial in XS
code).

> FETCH() and STORE() are just wrappers around functions called
> swig_${key}_get and swig_${key}_set(), so I don't _have_ to access the
> object as a hash. It'd just be nice to be able to reduce the general
> uglyness the swig_*_[gs]et methods causes.

TT3 provides a way around this with the TT_get($key) and TT_set($key, $value) 
methods.  You can provide these for your objects to handle the mapping to
internal methods.  e.g.

  sub TT_get {
    my ($self, $key) = @_;
    my $method = "swig_${key}_get";
    $self->$method();
  }

Not much help to you at the moment, but it is on the list of "things broken
in TT2 and fixed in TT3".

A


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

Reply via email to