Class::InsideOut::Manual::About

Class::InsideOut::Manual::About is a guide to this and other implementations of the inside-out technique.
Download

Class::InsideOut::Manual::About Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • David A. Golden
  • Publisher web site:
  • http://search.cpan.org/~dagolden/CPAN-Reporter-Smoker-0.15/lib/CPAN/Reporter/Smoker.pod

Class::InsideOut::Manual::About Tags


Class::InsideOut::Manual::About Description

Class::InsideOut::Manual::About is a guide to this and other implementations of the inside-out technique. Class::InsideOut::Manual::About is a guide to this and other implementations of the inside-out technique.This manual provides an overview of the inside-out technique and its application within Class::InsideOut and other modules. It also provides a list of references for further study.Inside-out object basicsInside-out objects use the blessed reference as an index into lexical data structures holding object properties, rather than using the blessed reference itself as a data structure. $self->{ name } = "Larry"; # classic, hash-based object $name{ refaddr $self } = "Larry"; # inside-outThe inside-out approach offers three major benefits:· Enforced encapsulation: object properties cannot be accessed directly from ouside the lexical scope that declared them· Making the property name part of a lexical variable rather than a hash-key means that typos in the name will be caught as compile-time errors (if using strict)· If the memory address of the blessed reference is used as the index, the reference can be of any typeIn exchange for these benefits, robust implementation of inside-out objects can be quite complex. Class::InsideOut manages that complexity.Philosophy of Class::InsideOutClass::InsideOut provides a set of tools for building safe inside-out classes with maximum flexibility.It aims to offer minimal restrictions beyond those necessary for robustness of the inside-out technique. All capabilities necessary for robustness should be automatic. Anything that can be optional should be. The design should not introduce new restrictions unrelated to inside-out objects, such as attributes and CHECK blocks that cause problems for mod_perl or the use of source filters for syntatic sugar.As a result, only a few things are mandatory:· Properties must be based on hashes and declared via property· Property hashes must be keyed on the Scalar::Util::refaddr· register must be called on all new objectsAll other implementation details, including constructors, initializers and class inheritance management are left to the user (though a very simple constructor is available as a convenience). This does requires some additional work, but maximizes freedom. Class::InsideOut is intended to be a base class providing only fundamental features. Subclasses of Class::InsideOut could be written that build upon it to provide particular styles of constructor, destructor and inheritance support. Requirements: · Perl


Class::InsideOut::Manual::About Related Software