Class-TransparentFactory

 view release on metacpan or  search on metacpan

lib/Class/TransparentFactory.pm  view on Meta::CPAN

steps:

=over 4

=item Move all your actual implementation into another module.

Its name is not important to Class::TransparentFactory, but let's call
it C<ProviderOne> here. The old namespace by which the implementation
was known we will call C<Facade>.

=item Declare C<Facade> as a transparent factory.

See I<import> below for details. For a typical OOPish module with no
special class methods, this will suffice:

  package Facade;
  use Class::TransparentFactory qw(new);

=item Implement your factory.

See I<impl> for details. Here is where you put the business logic
that determines which provider is suitable and should be used for this
particular call.

=back

=head1 FUNCTIONS

=head2 import

The import directive is your declarative way of specifying which class
methods belong to the transparently facaded API. Supply a simple list of
names. Instance methods need not be specified here, since subsequent
method dispatches on objects created by provider classes will presumably
go to the correct place directly.

=cut

sub import {
    my($c, @funcs) = @_;
    my $caller = caller;
    for my $name (@funcs) {

lib/Class/TransparentFactory.pm  view on Meta::CPAN

ideas for a better name via clever features. Please contact me at the
address below if you have a suggestion.

=head1 AUTHOR

Gaal Yahas, C<< <gaal at forum2.org> >>

=head1 BUGS

Please report any bugs or feature requests to
C<bug-class-transparentfactory at rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Class-TransparentFactory>.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.

=head1 SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Class::TransparentFactory



( run in 0.468 second using v1.01-cache-2.11-cpan-0a6323c29d9 )