Sah/Schema/perl/distname_with_optional_ver.pm

filter: Statementstmt 100% 12 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 100% 14 / 14 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Sah/Schema/perl/distname/default_this_dist.pm ↑ Summary Sah/Schema/perl/distname_with_ver.pm »
1 package Sah::Schema::perl::distname_with_optional_ver;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
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 => 'Perl distribution name (e.g. Foo-Bar) with optional version number suffix (e.g. Foo-Bar@0.001)',
13 match => '\A[A-Za-z_][A-Za-z_0-9]*(-[A-Za-z_0-9]+)*(@[0-9][0-9A-Za-z]*(\\.[0-9A-Za-z_]+)*)?\z',
14 'x.perl.coerce_rules' => [
15 'From_str::normalize_perl_distname',
16 ],
17  
18 # provide a default completion which is from list of installed perl distributions
19 'x.completion' => 'perl_distname',
20  
21 description => <<'_',
22  
23 For convenience (particularly in CLI with tab completion), you can input one of:
24  
25 Foo::Bar
26 Foo/Bar
27 Foo/Bar.pm
28 Foo.Bar
29  
30 and it will be coerced into Foo-Bar form.
31  
32 _
33  
34 examples => [
35 {value=>'', valid=>0},
36 {value=>'Foo-Bar', valid=>1},
37 {value=>'Foo-Bar@1', valid=>1},
38 {value=>'Foo-Bar@1.0', valid=>1},
39 {value=>'Foo::Bar@1.0.0', valid=>1, validated_value=>'Foo-Bar@1.0.0'},
40 {value=>'Foo-Bar@0.5_001', valid=>1},
41 {value=>'Foo::Bar@0.5_001', valid=>1, validated_value=>'Foo-Bar@0.5_001'},
42 {value=>'Foo-Bar@a', valid=>0},
43 ],
44  
45 }];
46  
47 1 1;
48 # ABSTRACT: Perl distribution name (e.g. Foo-Bar) with optional version number suffix (e.g. Foo-Bar@0.001)
49  
50 __END__
« Sah/Schema/perl/distname/default_this_dist.pm ↑ Summary Sah/Schema/perl/distname_with_ver.pm »