NAME

Data::Sah::CoerceJS - Generate coercer code

VERSION

This document describes version 0.040 of Data::Sah::CoerceJS (from Perl distribution Data-Sah-Coerce), released on 2019-12-04.

SYNOPSIS

 use Data::Sah::CoerceJS qw(gen_coercer);

 # use as you would use Data::Sah::Coerce

DESCRIPTION

This module is just like Data::Sah::Coerce except that it uses JavaScript coercion rule modules.

VARIABLES

$Log_Coercer_Code => bool (default: from ENV or 0)

If set to true, will log the generated coercer code (currently using Log::ger at trace level). To see the log message, e.g. to the screen, you can use something like:

 % TRACE=1 perl -MLog::ger::LevelFromEnv -MLog::ger::Output=Screen \
     -MData::Sah::CoerceJS=gen_coercer -E'my $c = gen_coercer(...)'

FUNCTIONS

gen_coercer

Usage:

 gen_coercer() -> any

Generate coercer code.

This is mostly for testing. Normally the coercion rules will be used from Data::Sah.

This function is not exported by default, but exportable.

No arguments.

Return value: (any)

ENVIRONMENT

LOG_SAH_COERCER_CODE => bool

Set default for $Log_Coercer_Code.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Data-Sah-Coerce.

SOURCE

Source repository is at https://github.com/perlancar/perl-Data-Sah-Coerce.

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Sah-Coerce

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

SEE ALSO

Data::Sah::Coerce

App::SahUtils, including coerce-with-sah to conveniently test coercion from the command-line.

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2019, 2018, 2017, 2016 by perlancar@cpan.org.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.