| 1 | package Sah::Schema::matcher::str; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 1 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |
| 6 | 1 | our $DATE = '2024-02-06'; # DATE | |
| 7 | 1 | our $DIST = 'Sah-Schemas-Str'; # DIST | |
| 8 | 1 | our $VERSION = '0.018'; # VERSION | |
| 9 | |||
| 10 | 1 | our $schema = [any => { | |
| 11 | summary => 'Something that can be matched against string', | ||
| 12 | description => <<'MARKDOWN', | ||
| 13 | |||
| 14 | Currently these things are allowed: | ||
| 15 | - another string | ||
| 16 | - regexp (Regexp object) | ||
| 17 | - array of strings | ||
| 18 | - coderef | ||
| 19 | |||
| 20 | MARKDOWN | ||
| 21 | of => [ | ||
| 22 | 'str*', | ||
| 23 | 'obj::re*', | ||
| 24 | 'aos*', | ||
| 25 | 'code*', | ||
| 26 | ], | ||
| 27 | examples => [ | ||
| 28 | {value=>'foo', valid=>1}, | ||
| 29 | {value=>['foo', 'bar', 'baz'], valid=>1}, | ||
| 30 | {value=>[qr/foo/], valid=>0, summary=>'Currently only array of strings are allowed'}, | ||
| 31 | {value=>qr/foo/, valid=>1}, | ||
| 32 | {value=>'foo', valid=>1}, | ||
| 33 | {value=>'foo', valid=>1}, | ||
| 34 | ], | ||
| 35 | |||
| 36 | }]; | ||
| 37 | |||
| 38 | 1 | 1; | |
| 39 | # ABSTRACT: | ||
| 40 | |||
| 41 | __END__ | ||