| 1 | package Sah::Schema::perl::identifier::qualified_ascii; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 1 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |
| 7 | 1 | our $DATE = '2024-02-16'; # DATE | |
| 8 | 1 | our $DIST = 'Sah-SchemaBundle-Perl'; # DIST | |
| 9 | 1 | our $VERSION = '0.050'; # VERSION | |
| 10 | |||
| 11 | 1 | our $schema = [str => { | |
| 12 | summary => 'Qualified identifier in Perl, without "use utf8" in effect', | ||
| 13 | description => <<'_', | ||
| 14 | |||
| 15 | _ | ||
| 16 | match => qr/\A[A-Za-z_][A-Za-z_0-9]*(?:::[A-Za-z_0-9]+)+\z/, | ||
| 17 | max_len => 251, # total max length, with qualifier and all the '::', but without the sigil | ||
| 18 | |||
| 19 | examples => [ | ||
| 20 | {value=>'', valid=>0, summary=>'Empty'}, | ||
| 21 | |||
| 22 | # ascii | ||
| 23 | {value=>'foo', valid=>0, summary=>'Not qualified'}, | ||
| 24 | {value=>'foo::bar', valid=>1}, | ||
| 25 | {value=>"foo'bar", valid=>0, summary=>"This schema does not accept the old (soon-to-be-deprecated) namespace separator"}, | ||
| 26 | {value=>'_foo::bar', valid=>1}, | ||
| 27 | {value=>'0foo::bar', valid=>0, summary=>'Cannot start with a digit'}, | ||
| 28 | {value=>'foo::0', valid=>1, summary=>'Secondary+ parts are allowed to start with a digit (1)'}, | ||
| 29 | {value=>'foo::0bar', valid=>1, summary=>'Secondary+ parts are allowed to start with a digit (2)'}, | ||
| 30 | {value=>'foo0::bar', valid=>1}, | ||
| 31 | {value=>'foo::bar-baz', valid=>0, summary=>'Invalid character (dash)'}, | ||
| 32 | {value=>'$foo::bar', valid=>0, summary=>'Sigil not accepted'}, | ||
| 33 | |||
| 34 | # unicode | ||
| 35 | {value=>'foo::bébé', valid=>0, summary=>'Non-latin letter not accepted'}, | ||
| 36 | ], | ||
| 37 | |||
| 38 | }]; | ||
| 39 | |||
| 40 | 1 | 1; | |
| 41 | # ABSTRACT: Qualified identifier in Perl, without "use utf8" in effect | ||
| 42 | |||
| 43 | __END__ | ||