http://www.perlmonks.org?node_id=504425

After several weeks of intense development, I feel comfortable in releasing (unleashing?) a new module on CPAN: Object::InsideOut

Object::InsideOut provides comprehensive support for implementing classes using the inside-out object model.

It implements inside-out objects as anonymous scalar references that have been blessed into a class with the scalar containing the ID for the object (usually a sequence). Object data (i.e., fields) are stored in arrays within the class's package and are indexed on the object's ID.

This module offers all the capabilities of Class::Std with the following additional key advantages:

Rationale:
Prior to the publication of Perl Best Practices, I came across discussions of inside-out objects here on Perl Monks, and I liked the concept so much that I converted my other module (Math::Random::MT::Auto) to using inside-out objects, including tackling the problem of using inside-out objects in threaded code (i.e., use threads;).

With the release of Perl Best Practices, I looked at converting Math::Random::MT::Auto to using Class::Std instead of my own inside-out object support code. To my dismay, I found that Class::Std was not thread-safe. Further, its object structure (empty scalar ref) and single method of determining object IDs (refaddr) were incompatible with what I had written.

While I laud Damian Conway for the work he did on Class::Std, its slowness (due to calculating the object ID at every turn), lack of thread support, and inflexibilities (lack of support for user-supplied object ID, accessor naming conventions, and so on) lead me to further development of my inside-out support code. In overcoming these deficiencies, the resulting module architecture was such that it could not be combined with Class:Std, and thus required the issuance of an new and separate module to CPAN.

As part of the development of this module, I made sure that it incorporated all of the functionality of Class::Std so that there would be no want for using this module. Further, I discovered that, unlike hash-based objects, it was possible to share scalar-based objects between threads when using threads::shared.

All in all, I feel that Object::InsideOut provides comprehensive support for the development of inside-out object classes that provides speed and flexibility, as well as the capability to work with objects in a threaded application complete with object sharing, if needed.

Plea:
I would like to invite my fellow monks to look at what I've developed. Hopefully, some of you may find it useful. I would, of course, appreciate any critiques, suggestions, ideas, etc. that you might have. Thank you.

Update:
The lastest version of Object::InsideOut supports using arrays for storing object field data. This resulted in an impressive speed improvement (mentioned above) that I hope will be a further incentive to my fellow monks to give Object::InsideOut a try.


Remember: There's always one more bug.