| 1 | package Data::Sah::Type::str; | ||
| 2 | |||
| 3 | 15 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 15 | ▶ | use Data::Sah::Util::Role 'has_clause'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 15 | ▶ | use Role::Tiny; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 15 | ▶ | use Role::Tiny::With; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 15 | with 'Data::Sah::Type::BaseType'; | |
| 10 | 15 | with 'Data::Sah::Type::Comparable'; | |
| 11 | 15 | with 'Data::Sah::Type::Sortable'; | |
| 12 | 15 | with 'Data::Sah::Type::HasElems'; | |
| 13 | |||
| 14 | 15 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |
| 15 | 15 | our $DATE = '2024-02-16'; # DATE | |
| 16 | 15 | our $DIST = 'Data-Sah'; # DIST | |
| 17 | 15 | our $VERSION = '0.917'; # VERSION | |
| 18 | |||
| 19 | # currently we only support regex instead of hash of regexes | ||
| 20 | #my $t_re = 'regex*|{*=>regex*}'; | ||
| 21 | 15 | my $t_re = ['regex', {req=>1}]; | |
| 22 | |||
| 23 | 15 | has_clause 'encoding', | |
| 24 | v => 2, | ||
| 25 | tags => ['constraint'], | ||
| 26 | schema => ['str', {req=>1}], | ||
| 27 | allow_expr => 0, | ||
| 28 | ; | ||
| 29 | 15 | has_clause 'match', | |
| 30 | v => 2, | ||
| 31 | tags => ['constraint'], | ||
| 32 | schema => $t_re, | ||
| 33 | allow_expr => 1, | ||
| 34 | ; | ||
| 35 | 15 | has_clause 'is_re', | |
| 36 | v => 2, | ||
| 37 | tags => ['constraint'], | ||
| 38 | schema => ['bool', {}], | ||
| 39 | allow_expr => 1, | ||
| 40 | ; | ||
| 41 | |||
| 42 | 15 | 1; | |
| 43 | # ABSTRACT: str type | ||
| 44 | |||
| 45 | __END__ | ||