> So what I'd really like is some sort of 'interface' object that could be
> passed into the template instead of the 'real' object, which only has a
> subset of the methods available.

My approach to this is to not pass objects at all.  I have my data objects
implement a method called view(), which returns a plain vanilla data
structure (usually a hash, possibly with nested lists, etc.) and pass that
to the template.  It gives better performance (calls in the template are
just variable access now, not methods) and allows me to juggle the data a
bit for simpler templating.

You could easily add a default view() to Class::DBI, which could be
overridden for specific classes.

- Perrin



Reply via email to