NAME
Mock::Data::GeneratorSub - Wrap a coderef to become a blessed Generator object
DESCRIPTION
This class wraps a generator coderef to become a Generator object, and supply default parameters for "generate" which can be overridden or combined with additional parameters.
CONSTRUCTOR
new
Mock::Data::GeneratorSub->new( $coderef, @default_params );
This object's generate
method calls the $coderef
after merging the parameters passed to generate
with this list of @default_params
. When merging parameters, named parameters are replaced by-name, and positional parameters are replacing entirely if new positional parameters are provided.
METHODS
generate
$generator->generate($mock, @params);
Merge @params
with $self->params
and then call $self->coderef
compile
$generator->compile(@params);
Return a function sub($mock){ ... }
which calls $self->coderef
with the @params
merged with $self->params
.
AUTHOR
Michael Conrad <mike@nrdvana.net>
VERSION
version 0.04
COPYRIGHT AND LICENSE
This software is copyright (c) 2024 by Michael Conrad.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.