Sah/Schema/perl/identifier/qualified_unicode.pm

filter: Statementstmt 100% 18 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 22 / 22 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Sah/Schema/perl/identifier/qualified_ascii.pm ↑ Summary Sah/Schema/perl/identifier/unqualified_ascii.pm »
1 package Sah::Schema::perl::identifier::qualified_unicode;
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 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶no warnings 'experimental::regex_sets';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
9 1 our $DATE = '2024-02-16'; # DATE
10 1 our $DIST = 'Sah-SchemaBundle-Perl'; # DIST
11 1 our $VERSION = '0.050'; # VERSION
12  
13 1 our $schema = [str => {
14 summary => 'Unqualified identifier in Perl, with "use utf8" in effect',
15 description => <<'_',
16  
17 _
18 match => qr/\A
19 (?[ ( \p{Word} & \p{XID_Start} ) + [_] ])
20 (?[ ( \p{Word} & \p{XID_Continue} ) ])*
21 (?:
22 ::(?[ ( \p{Word} & \p{XID_Continue} ) + [_] ])+
23 )+
24 \z/x,
25  
26 examples => [
27 {value=>'', valid=>0, summary=>'Empty'},
28  
29 # ascii
30 {value=>'foo', valid=>0, summary=>'Not qualified'},
31 {value=>'foo::bar', valid=>1},
32 {value=>"foo'bar", valid=>0, summary=>"This schema does not accept the old (soon-to-be-deprecated) namespace separator"},
33 {value=>'_foo::bar', valid=>1},
34 {value=>'0foo::bar', valid=>0, summary=>'Cannot start with a digit'},
35 {value=>'foo::0', valid=>1, summary=>'Secondary+ parts are allowed to start with a digit (1)'},
36 {value=>'foo::0bar', valid=>1, summary=>'Secondary+ parts are allowed to start with a digit (2)'},
37 {value=>'foo0::bar', valid=>1},
38 {value=>'foo::bar-baz', valid=>0, summary=>'Invalid character (dash)'},
39 {value=>'$foo::bar', valid=>0, summary=>'Sigil not accepted'},
40  
41 # unicode
42 {value=>'bébé::0foo', valid=>1},
43 ],
44  
45 }];
46  
47 1 1;
48 # ABSTRACT: Unqualified identifier in Perl, with "use utf8" in effect
49  
50 __END__
« Sah/Schema/perl/identifier/qualified_ascii.pm ↑ Summary Sah/Schema/perl/identifier/unqualified_ascii.pm »