A mathematician confided
That the möbius band is one sided.
You'll have quite a laugh
If you cut one in half,
'Cause it stays in one piece when divided.

I had an idea for a joke module, that provides möbius objects: inside out objects that are also not inside-out. However, thinking more about it, I can see that this could have practical uses.

Imagine the scenario of refactoring in-house modules for inside outedness. The modules themselves could be refactored to use Class::Std, Object::InsideOut, Class::InsideOut or whatever, but lots of existing legacy code could break if it is relying on de-encapsulation ->{foo} syntax.

Möbius objects could provide a migration path allowing the legacy code to still work, albeit generating warnings whenever encapsulation is violated, but still working.

Inside out objects tend to be implemented as a blessed scalarref, using the address or some other unique low level property (their values are not actually used). The möbius object could still use this address, but be a blessed, tied hashref or arrayref. The tie mechanism will intercept any attempts to access attributes directly, and will do the right thing, generating warnings as necessary.

What do others think? Is this idea worth pursuing? Or should it retain "joke module" status?

--

Oh Lord, won’t you burn me a Knoppix CD ?
My friends all rate Windows, I must disagree.
Your powers of persuasion will set them all free,
So oh Lord, won’t you burn me a Knoppix CD ?
(Missquoting Janis Joplin)


In reply to RFC: Class::Moebius by rinceWind

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.