I'm rather new to Perl OO-ness (but I have significant experience in other languages), but I must say, I like this idea very very much. It fixes one of my biggest issues with Perl OO -- enforcing encapsulation requires some huge incantations that make the code rather hard to read.
Just thinking aloud, but could something similar be done to enforce private variables? This would be a cool feature to have, even if strangely implemented. Hopefully in the same module?
Even if some extra private-variable functionality was not added, I can see how this could trivially be used to restrict an accessor/mutator function. Generally I try to write my OO such that trivial accessor/mutators aren't needed (too many accessors/mutators tends to indicate design flaws), but in Perl, the accessor/mutators are somewhat useful since it's way too easy to create a typo in a hash lookup.
Also, source filters, from what I know of them, are supposed to be evil...but as long as this one doesn't bork with line numbers, it should be ok! Seems like goodness to me.
Cool. I'd say definitely put something like this on CPAN. I'd use it.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
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:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||