The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

ResourcePool::Factory - A factory to create ResourcePool::Resource objects

SYNOPSIS

 use ResourcePool::Factory;
 
 my $factory = ResourcePool::Factory->new();

DESCRIPTION

This class acts as a base class for factories which are used together with the ResourcePool. The purpose of a ResourcePool::Factory derived class is to store all required data to construct a ResourcePool::Resource derived object as required. In other words, the factory stores the arguments required for the constructor of the Resource and creates one when asked to do so.

The ResourcePool takes a ResourcePool::Factory on construction and will use it to create the required resources as configured.

ResourcePool::Factory->new

The new method is called to create a new factory.

Usually this method just stores the parameters somewhere and will use it later create_resource is called.

$factory->create_resource

This method is used to actually create a resource according to the parameters given to the new method.

You must override this method in order to do something useful.

Returns: a reference to a ResourcePool::Resource object

$factory->info

This method is used for reporting purposes. It doesn't take any arguments and just returns some human readable string to identify the factory (and the related resource).

You are not required to override this method, but its highly recommended for reporting purposes.

Returns: A human readable string describing the factory

SEE ALSO

ResourcePool, ResourcePool::Resource, ResourcePool::Factory::DBI, ResourcePool::Factory::Net::LDAP

AUTHOR

    Copyright (C) 2002 by Markus Winand <mws@fatalmind.com>

    This program is free software; you can redistribute it and/or
    modify it under the same terms as Perl itself.