NAME
Sub::Contract::Pool - A pool of all subroutine contracts
SYNOPSIS
use Sub::Contract::Pool qw(get_contract_pool);
my $pool = get_contract_pool();
TODO
DESCRIPTION
All subroutine contracts defined via creating instances of Sub::Contract or Sub::Contract::Memoizer are automatically added to a pool of contracts.
You can query this pool to retrieve contracts defined for specific parts of your code, and modify, recompile, enable and disable contracts selectively at runtime.
Sub::Contract::Pool is a singleton pattern, giving you access to a unique contract pool created at compile time by Sub::Contract.
API
my $pool = get_contract_pool()
;-
Return the contract pool.
new()
-
Pool constructor, for internal use only. DO NOT USE NEW, always use
get_contract_pool()
. $pool->list_all_contracts
-
Return all contracts registered in the pool.
$pool->has_contract($fully_qualified_name)
-
Return true if the subroutine identified by
$fully_qualified_name
has a contract. $pool->enable_all_contracts
-
Enable all the contracts registered in the pool.
$pool->disable_all_contracts
-
Disable all the contracts registered in the pool.
$pool->enable_contracts_matching($regexp)
-
Enable all the contracts registered in the pool whose contractor's fully qualified names matches the string
$regexp
.regexp
works as forfind_contracts_matching
. $pool->disable_contracts_matching($regexp)
-
Disable all the contracts registered in the pool whose contractor's fully qualified names matches the string
$regexp
.regexp
works as forfind_contracts_matching
. $pool->find_contracts_matching($regexp)
-
Find all the contracts registered in the pool and whose contractor's fully qualified names matches the string
$regexp
. TODO
SEE ALSO
See 'Sub::Contract'.
VERSION
$Id: Pool.pm,v 1.7 2008/04/25 14:01:52 erwan_lemonnier Exp $
AUTHOR
Erwan Lemonnier <erwan@cpan.org>
LICENSE
See Sub::Contract.