Re: Iterate over a blessed reference

Dave Howorth <dhoworth-fDajt2Yx3S8pY9vWkoisglpr/1R2p/[email protected]> Tue, 04 Feb 2014 15:39:47 +0000
Newsgroups gmane.comp.lang.perl.modules.template-toolkit
Organization MRC Laboratory for Molecular Biology
Message-ID <[email protected]>
Ziermann, Markus wrote:
> Is there an easy way to iterate over nested perl objects (blessed
> hashrefs) in template toolkit? If not, perhaps an easy way to convert
> a complex structure of nested objects to hashes?

It depends on the objects. You just invoke the objects' methods in the
template, so if they provide methods to iterate, then yes.

Alternatively, build a loop using an ->all method or whatever just as
you would in Perl.