Package Info

perl-Data-Tumbler


Dynamic generation of nested combinations of variants


Development/Libraries/Perl

NOTE: This is alpha code and liable to change while it and Test::WriteVariants mature.

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.

See Test::WriteVariants for a practical example use.


License: Artistic-1.0 OR GPL-1.0-or-later
URL: https://metacpan.org/release/Data-Tumbler

Categories

Releases

Package Version Update ID Released Package Hub Version Platforms Subpackages
0.010-bp156.3.1 info GA Release 2023-07-22 15 SP6
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Data-Tumbler
0.010-bp155.2.10 info GA Release 2023-05-17 15 SP5
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Data-Tumbler
0.010-bp154.1.23 info GA Release 2022-05-09 15 SP4
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Data-Tumbler
0.010-bp153.1.15 info GA Release 2021-03-06 15 SP3
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Data-Tumbler
0.010-bp152.3.16 info GA Release 2020-04-16 15 SP2
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Data-Tumbler
0.010-bp151.1.1 info GA Release 2019-06-18 15 SP1
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-Data-Tumbler