NAME
Class::Factory::Patched - Patched version of Class::Factory
SYNOPSIS
See Class::Factory
DESCRIPTION
This is a patched version of Class::Factory. It is included because Class::Factory has closures over lexical variables, and those variables cannot be accessed from the outside. It also doesn't allow to add or register mappings that have already been defined.
However, I need to override mappings. You can see an example in the tests of Class::Accessor::FactoryTyped, but basically the idea is this:
A person object has a name object and an address object. This person object is used in two different applications. One application wants the person to just have a single fullname string and a single address string. The other application wants the name to be split into first name and last name, and the address to be split into street address, postal code, city and country.
The second application needs to inherit from the first application because it shares a lot of common characteristics with it.
We would still like to use the same person object, though, because it interacts with other parts of the application in some standard way.
So the first application would tell the factory to map the person_name
to a class that just has a simple fullname string and the person_address
to a class that just has a simple address string.
The second application, because it inherits from the first application, also inherits the factory, but redefines the person_name
and person_address
object types to point to the more complex implementations.
This isn't possible with Class::Factory alone, because when the second application tries to redefine the mappings, Class::Factory doesn't allow it.
Therefore I propose the following additions to Class::Factory. If and when the author of Class::Factory includes them in Class::Factory, this patch module will go away.
PATCHES
- remove_factory_type
-
Takes a list of object types and removes them from the factory. This is the opposite of
add_factory_type()
. - unregister_factory_type
-
Takes a list of object types and unregisters them from the factory. This is the opposite of
register_factory_type()
.
TAGS
If you talk about this module in blogs, on del.icio.us or anywhere else, please use the classfactoryenhanced
tag.
BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests to bug-class-factory-enhanced@rt.cpan.org
, or through the web interface at http://rt.cpan.org.
INSTALLATION
See perlmodinstall for information and options on installing Perl modules.
AVAILABILITY
The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit <http://www.perl.com/CPAN/> to find a CPAN site near you. Or see <http://www.perl.com/CPAN/authors/id/M/MA/MARCEL/>.
AUTHOR
Marcel Grünauer, <marcel@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2007 by Marcel Grünauer
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.