Would you ever bless a tied variable into the same tied class?

I guess you meant bless a reference on tied variable into the same tied class.

Do not do it unless you are going to post you code into Obfuscated Code section of PerlMonks. Tied variable already has underlaying object. If you bless reference on tied variable you get another object. For these two objects you will have some methods. If these two objects are going to share same package you will have to put methods for two different classes of objects into one package. It is not something I would recomend to do if you want to write clean, easy to understand code.

On the other hand blessing a reference on tied variable into separate package maybe ok. One good example is Tie::SecureHash. References on variables tied into this package are supposed to be blessed into other packages.

--
Ilya Martynov (http://martynov.org/)


In reply to Re: Blessing a Tied something? by IlyaM
in thread Blessing a Tied something? by jcupp

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.