NAME

Sah::Schemas::Str - Various string schemas

VERSION

This document describes version 0.014 of Sah::Schemas::Str (from Perl distribution Sah-Schemas-Str), released on 2023-09-03.

SAH SCHEMAS

The following schemas are included in this distribution:

  • hexstr

    String of bytes in hexadecimal notation, e.g. "ab99" or "CAFE".

    Whitespace is allowed and will be removed.

  • latin_alpha

    String containing only zero or more Latin letters, i.e. A-Z or a-z.

  • latin_alphanum

    String containing only zero or more Latin letters/digits, i.e. A-Za-z0-9.

  • latin_letter

    A single latin letter, i.e. A-Z or a-z.

  • latin_lowercase_alpha

    String containing only zero or more lowercases Latin letters, i.e. a-z.

    Uppercase letters will be coerced to lowercase.

  • latin_lowercase_letter

    A single latin lowercase letter, i.e. a-z.

  • latin_uppercase_alpha

    String containing only zero or more uppercase Latin letters, i.e. A-Z.

    Uppercase letters will be coerced to lowercase.

  • latin_uppercase_letter

    A single latin uppercase letter, i.e. A-Z.

  • non_empty_str

    A non-empty string (length >= 1) (alias for str1).

  • percent_str

    A number in percent form, e.g. "10.5%".

    This schema accepts floating number followed by percent sign. Unlike the percent schema from Sah::Schemas::Float, The percent sign will not be removed nor the number be converted to decimal (e.g. 50% to 0.5).

  • str1

    A non-empty string (length >= 1).

  • str_or_aos

    String or array (0+ length) of (defined) string.

  • str_or_aos1

    String or array (1+ length) of (defined) string.

  • str_or_re

    String or regex (if string is of the form `/.../`).

    Either string or Regexp object is accepted.

    If string is of the form of /.../ or qr(...), then it will be compiled into a Regexp object. If the regex pattern inside /.../ or qr(...) is invalid, value will be rejected.

    Currently, unlike in normal Perl, for the qr(...) form, only parentheses ( and ) are allowed as the delimiter.

    Currently modifiers i, m, and s after the second / are allowed.

HOMEPAGE

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

SOURCE

Source repository is at https://github.com/perlancar/perl-Sah-Schemas-Str.

SEE ALSO

Sah - schema specification

Data::Sah - Perl implementation of Sah

Sah::Schema::re_from_str

AUTHOR

perlancar <perlancar@cpan.org>

CONTRIBUTING

To contribute, you can send patches by email/via RT, or send pull requests on GitHub.

Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:

% prove -l

If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me.

COPYRIGHT AND LICENSE

This software is copyright (c) 2023, 2022, 2020 by perlancar <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.

BUGS

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

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.