|
NAMEClass::Adapter::Builder - Generate Class::Adapter classesSYNOPSISpackage My::Adapter; use strict; use Class::Adapter::Builder ISA => 'Specific::API', METHODS => [ qw{foo bar baz} ], method => 'different_method'; 1; DESCRIPTION"Class::Adapter::Builder" is another mechanism for letting you create Adapter classes of your own.It is intended to act as a toolkit for generating the guts of many varied and different types of Adapter classes. For a simple base class you can inherit from and change a specific method, see Class::Adapter::Clear. The Pragma InterfaceThe most common method for defining Adapter classes, as shown in the synopsis, is the pragma interface.This consists of a set of key/value pairs provided when you load the module. # The format for building Adapter classes use Class::Adapter::Builder PARAM => VALUE, ...
Any params other than the ones specified above are taken as translated methods. # If you provide the following # foo => bar # It the following are equivalent $decorator->foo; $decorator->_OBJECT_->bar; This capability is provided primarily because in Perl one of the main situations in which you hit the limits of Perl's inheritance model is when your class needs to inherit from multiple different classes that containing clashing methods. For example: # If your class is like this package Foo; use base 'This', 'That'; 1; If both "This->method" exists and "That->method" exists, and both mean different things, then "Foo->method" becomes ambiguous. A "Class::Adapter" could be used to wrap your "Foo" object, with the "Class::Adapter" becoming the "That" sub-class, and passing "$decorator->method" through to "$object->that_method". METHODSYes, "Class::Adapter::Builder" has public methods and later on you will be able to access them directly, but for now they are remaining undocumented, so that I can shuffle things around for another few versions.Just stick to the pragma interface for now. SUPPORTBugs should be reported via the CPAN bug tracker at<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Class-Adapter> For other issues, contact the author. AUTHORAdam Kennedy <adamk@cpan.org>SEE ALSOClass::Adapter, Class::Adapter::ClearCOPYRIGHTCopyright 2005 - 2011 Adam Kennedy.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.
Visit the GSP FreeBSD Man Page Interface. |