App-Test-Generator

 view release on metacpan or  search on metacpan

lib/App/Test/Generator/Sample/Module.pm  view on Meta::CPAN

=head4 output

    { type => SCALAR }

=cut

sub validate_score {
	my ($self, $score) = @_;

	croak 'Score is required'    unless defined $score;

	# Accept integers, decimals, and values like '.5' but not '1.2.3'
	croak 'Score must be numeric'
		unless $score =~ /^(?:\d+\.?\d*|\.\d+)$/;

	croak 'Score out of range'
		unless $score >= $MIN_SCORE && $score <= $MAX_SCORE;

	# Compare against the pass threshold constant
	return $score >= $PASS_THRESHOLD ? 'Pass' : 'Fail';
}

=head2 mysterious_method

A deliberately under-validated method used to test that
L<App::Test::Generator::SchemaExtractor> correctly assigns low
confidence when validation is absent.

=head3 Arguments

=over 4

=item * C<$thing>

A value to double. No type validation is performed intentionally.

=back

=head3 Returns

C<$thing * 2>.

=head3 API specification

=head4 input

    {
        self  => { type => OBJECT },
        thing => { type => 'any' },
    }

=head4 output

    { type => 'number' }

=cut

sub mysterious_method {
	my ($self, $thing) = @_;

	# Intentionally unvalidated — used to verify that SchemaExtractor
	# flags low-confidence schemas when no validation logic is present.
	# Callers passing non-numeric values will trigger a Perl warning;
	# this is expected behaviour for this test fixture.
	return $thing * 2;
}

=head1 AUTHOR

Example Author

=head1 LICENSE

This is free software.

=cut

1;



( run in 0.812 second using v1.01-cache-2.11-cpan-e1769b4cff6 )