I read it and understood; I just don't agree with your ideas about data structures for templating. I believe you should only nest your data structures when the data actually requires it, which is not the case here. If I were doing this, I would get rid of that top hashref and set it up like this:
<p>Org id: [% org_id %]</p>
<p>Org name: [% org_name %]</p>
<p>Group id: [% group_id %]</p>
<p>Group name: [% group_name %]</p>
I would only use another level below this if there are multiple values. For example, if there are multiple groups per organization, I would represent groups as an array of hashes, so I could make a template like this:
<p>Org id: [% org_id %]</p>
<p>Org name: [% org_name %]</p>
[% FOREACH group = groups %]
<p>Group id: [% group.id %]</p>
<p>Group name: [% group.name %]</p>
[% END %]
|