Of all the inside-out class modules, I consider this one to be the best. It provides everything an inside-out class needs (accessors, pseudo-encapsulation, thread-safety), and nothing you don't want (cumulative methods, perl6-ish syntax, [string|num|*]ification). Using other modules like Class::Std is like hammering a nail with a chainsaw. Sure, I can cut down trees with it, but all I want to do is hammer the nail!
This module is an excellent implementation of the concept and in fact the only one on CPAN that I consider acceptable.
Adam Kennedy writes that â€œthe number of uses in which is has a positive effect large enough to make up for its negatives being exceedingly small.â€ I disagree. The traditional way of doing OO in Perl 5 is curiously stuck in an era where namespaces and strict.pm do not exist, much as they did not in Perl 4. As Class::InsideOut::Manual::About outlines, inside-out objects enjoy the â€œvarsâ€ stricture for the names of instance attributes and a natural way to namespace the attributes so that sub- and superclasses can define identically named attributes without treading on each other. And because the referee is not even used, it can be of any type, making classes truly modular and independent of each other.
It is a common misconception that inside-out objects are mainly about strong encapsulation. In fact, that is only a minor point of the technique, and one I would encourage people to give up by using â€œourâ€ instead of â€œmyâ€ for their property hashes. If you are after true strong encapsulation in Perl 5, you should use closure-based objects; it is close to impossible to breach that protection.
The benefits lie elsewhere, and Class::InsideOut is the only implementation on CPAN to provide them in full. Not only does it do so, it does it with an elegant and minimal API that is well documented. I have no complaints whatsoever.
While I mildly detest the inside-out object concept in general (the number of uses in which is has a positive effect large enough to make up for its negatives being exceedingly small) and recommend against them for all but the most crazy situtations where you asbolutely need to protect your class internals from anything but a PadWalker-weilding maniac, it would seem this author at least understands WHY inside-out objects are so screwed as a concept (cloning, leaking, Storable-incompatibility, Clone incompatibility, and on and on and on) and has gone about provide suitably complete re-implementations of all the functionality that inside-out module lose out on by not being normal.
This module and Object::InsideOut are the only two implementations I would consider safe and solid enough to use in production. And this one is the lighter of the two. Start with this module, and if you need more power trade up later to the heavier Object::InsideOut.
I like this rather a lot. A nice minimal implementation of inside out objects that doesn't get in the way, and doesn't force you to recast your entire OO infrastructure. No source filters, CHECK blocks, etc. so works fine with mod_perl. Nice.