Dynamic generation of nested combinations of variants
The tumble() method calls a sequence of 'provider' code references each of which returns a hash. The first provider is called and then, for each hash item it returns, the tumble() method recurses to call the next provider.
The recursion continues until there are no more providers to call, at which point the consumer code reference is called. Effectively the providers create a tree of combinations and the consumer is called at the leafs of the tree.
If a provider returns no items then that part of the tree is pruned. Further providers, if any, are not called and the consumer is not called.
During a call to tumble() three values are passed down through the tree and into the consumer: path, context, and payload.
The path and context are derived from the names and values of the hashes returned by the providers. Typically the path define the current "path" through the tree of combinations.
The providers are passed the current path, context, and payload. The payload is cloned at each level of recursion so that any changes made to it by providers are only visible within the scope of the generated sub-tree.
Note that although the example above shows the path, context and payload as array references, the tumbler code makes no assumptions about them. They can be any kinds of values.
- Developed at devel:languages:perl
- Sources inherited from project openSUSE:Factory
- Download package
-
Checkout Package
osc -A https://api.opensuse.org checkout openSUSE:Backports:SLE-15-SP4:RebuildFactoryUpdates/perl-Data-Tumbler && cd $_
- Create Badge
Source Files
Filename | Size | Changed |
---|---|---|
Data-Tumbler-0.010.tar.gz | 0000017635 17.2 KB | |
perl-Data-Tumbler.changes | 0000000148 148 Bytes | |
perl-Data-Tumbler.spec | 0000003186 3.11 KB |
Comments 0