יובל קוג'מן (Yuval Kogman) > POE-Component-ResourcePool-0.04 > POE::Component::ResourcePool::Resource::TryList

Download:
POE-Component-ResourcePool-0.04.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Source  

NAME ^

POE::Component::ResourcePool::Resource::TryList - Delegate to a number of resources.

SYNOPSIS ^

        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 ],
        );

DESCRIPTION ^

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.

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.

ATTRIBUTES ^

resources

The array of resources to deleate to.

syntax highlighting: