IMHO, if HTML::Template were to allow such a wide open definition of what it accepts, it would be a support nightmare. Accepting every tied and overloaded data-structure would certainly degrade performance for plain old everyday hash-refs.

Personally, I think HTML::Template is fine as it is. It's very stable, extremly usable and has a simple and well defined API/interface. Subclass it if you want it to do these things.

I actually think your argument is more with tie than it is with HTML::Template. ( Overloading the %{} operator still requires you to return a hash-ref. If you dont want to return a real hash-ref, then it needs to be a tied hash-ref (see the overload doc for more info) ) What I think you really want is for tie to say "i am a hash" rather than "you can treat me like a hash". But to be honest, I am not a fan of that approach though.

-stvn

In reply to Re: "Is it a hashref" vs "Can I use it like a hashref?" by stvn
in thread "Is it a hashref" vs "Can I use it like a hashref?" by blokhead

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.