VERSION
Version 0.34
DESCRIPTION
Analyses the source code of a method and adds evidence to a App::Test::Generator::Model::Method object describing what kind of value the method returns. Evidence is used downstream by "resolve_return_type" in App::Test::Generator::Model::Method to determine the most likely return type.
new
Construct a new Return analyser.
my $analyser = App::Test::Generator::Analyzer::Return->new;
Arguments
None.
Returns
A blessed hashref.
API specification
input
{}
output
{
type => OBJECT,
isa => 'App::Test::Generator::Analyzer::Return',
}
analyze
Scan the source code of a method for return patterns and add weighted evidence to the method object. Detects three patterns: returning a property from $self, returning $self itself, and returning a constant literal value.
my $analyser = App::Test::Generator::Analyzer::Return->new;
$analyser->analyze($method);
my $type = $method->resolve_return_type;
Arguments
$methodAn App::Test::Generator::Model::Method object. Evidence is added to this object in place via
add_evidence.
Returns
Nothing (undef). All results are communicated via side effects on the $method object.
Notes
The interface of this analyser differs from App::Test::Generator::Analyzer::ReturnMeta, which operates on a raw schema hashref. This analyser operates on a Model::Method object directly.
API specification
input
{
self => { type => OBJECT, isa => 'App::Test::Generator::Analyzer::Return' },
method => { type => OBJECT, isa => 'App::Test::Generator::Model::Method' },
}
output
{ type => UNDEF }
LICENCE AND COPYRIGHT
Copyright 2025-2026 Nigel Horne.
Usage is subject to GPL2 licence terms. If you use it, please let me know.