POE::Component::ResourcePool::Resource::TryList - Delegate to a number of resources.
use POE::Component::ResourcePool::Resource::TryList; my $good = POE::Component::ResourcePool::Resource::Good->new( ... ); my $better = POE::Component::ResourcePool::Resource::Better->new( ... ); my $best = POE::Component::ResourcePool::Resource::TryList->new( resources => [ $better, $good ], );
This class allows you to specify fallback lists for resources easily.
The resources will be delegated to appropriately.
The only difference is that sometimes resources that return false from could_allocate will still have try_allocating called on them, because the try list only requires that one of the sub resources return true from could_allocate.
could_allocate
try_allocating
It is trivial to subclass and override it such that could_allocate only returns true if all the sub resources do, thus resolving this issue. However, this seems to have a diminished practical value to me.
The array of resources to deleate to.
To install POE::Component::ResourcePool, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POE::Component::ResourcePool
CPAN shell
perl -MCPAN -e shell install POE::Component::ResourcePool
For more information on module installation, please visit the detailed CPAN module installation guide.