NAME Class::Adapter - Perl implementation of the Adapter Design Pattern DESCRIPTION The "Class::Adapter" class is intended as an abstract base class for creating any sort of class or object that follows the *Adapter* pattern, and some that follow the *Decorator* pattern. (sort of) What is an Adapter? The term *Adapter* refers to a *"Design Pattern"* of the same name, from the famous "Gang of Four" book. Although their original implementation is designed for Java and similar single-inheritance strictly-typed langauge, the situation for which it applies is still valid. An *Adapter* in this Perl sense of the term is used to achieve by composition (objects containing other object) what can't be achieved by inheritance (sub-classing). This is similar to the *Decorator* pattern, but is intended to be applied primarily on a class-by-class basis, as opposed to being flexible when used with a single one-off object. The "Class::Adapter" object holds a parent object that it "wraps", and when a method is called on the "Class::Adapter", it manually calls the same (or different) method with the same (or different) parameters on the parent object contained within it. Instead of these custom methods being hooked in on an object-by-object basis, they are defined at the class level. Basically, a "Class::Adapter" class/object is your fall-back position when Perl's inheritance model fails you, or is no longer good enough, and you need to do something twisty in order to make several APIs play nicely with each other. What can I do with this specific Class::Adapter class Well actually... nothing. The base "Class::Adapter" class doesn't even implement a way to push method calls through to the underlying object, since the way in which THAT happens is the bit that changes from case to case. To actually DO something, you probably want to go take a look at Class::Adapter::Builder, which makes the creation of *Adapter* classes relatively quick and easy. METHODS The "Class::Adapter" class itself supplies only the two most common methods, a default constructor and a private method to access the underlying object. new $object The default "new" constructor takes a single object as argument and creates a new object which holds the passed object. Returns a new "Class::Adapter" object, or "undef" if you do not pass in an object. _OBJECT_ The "_OBJECT_" method is provided primarily as a convenience, and a tool for people implementing sub-classes, and allows the "Class::Adapter" interface to provide a guarenteed correct way of getting to the underlying object, should you need to do so. BUGS It's still early day yet, so you should expect some change throughout the entire "Class::Adapter" namespace. SUPPORT Bugs should be reported via the CPAN bug tracker at For other issues, contact the author. TO DO - Write more comprehensive tests AUTHOR Adam Kennedy (Maintainer), , cpan@ali.as SEE ALSO Class::Adapter::Clear, Class::Adapter::Factory COPYRIGHT Copyright 2005 Adam Kennedy. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module.