Sah/Schema/filename/unix.pm

filter: Statementstmt 100% 9 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 100% 10 / 10 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
CRAP 1.0
« Sah/Schema/filename/not_exists.pm ↑ Summary Sah/Schema/filename/unix/basename.pm »
1 package Sah::Schema::filename::unix;
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-16'; # DATE
7 1 our $DIST = 'Sah-SchemaBundle-Path'; # DIST
8 1 our $VERSION = '0.031'; # VERSION
9  
10 1 our $schema = ["str" => {
11 summary => 'Filesystem file name on a Unix system',
12 match => '\A(?:/|/?(?:[^/\0]{1,255})(?:/[^/\0]{1,255})*)\z',
13 description => <<'MARKDOWN',
14  
15 This is like the `filename` schema but with extra checks relevant to the Unix,
16 (e.g. a path element cannot be longer than 255 characters) and prefilters (e.g.
17 multipile consecutive slashes `//` will be normalized into a single one `/`).
18  
19 MARKDOWN
20 'x.completion' => ['filename'],
21 prefilters => [
22 'Path::expand_tilde',
23 'Path::strip_slashes',
24 ],
25  
26 examples => [
27 {value=>'', valid=>0},
28 {value=>'foo', valid=>1},
29 {value=>'foo/bar', valid=>1},
30 {value=>'foo//bar', valid=>1, validated_value=>'foo/bar'},
31 {value=>'a' x 256, valid=>0, summary=>'Path element too long'},
32 {value=>"foo\0", valid=>0, summary=>"Contains null character"},
33 ],
34  
35 }];
36  
37 1 1;
38 # ABSTRACT: Filesystem file name on a Unix system
39  
40 __END__
« Sah/Schema/filename/not_exists.pm ↑ Summary Sah/Schema/filename/unix/basename.pm »