« Data/Sah/Filter/perl/Path/check_file_exists.pm
↑ Summary
Data/Sah/Filter/perl/Path/check_path_not_exists.pm »
| 1 | package Data::Sah::Filter::perl::Path::check_path_exists; | ||
| 2 | |||
| 3 | 1 | ▶ | use 5.010001; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 1 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |
| 8 | 1 | our $DATE = '2024-02-16'; # DATE | |
| 9 | 1 | our $DIST = 'Sah-SchemaBundle-Path'; # DIST | |
| 10 | 1 | our $VERSION = '0.031'; # VERSION | |
| 11 | |||
| 12 | 0 | ▶ | sub meta { |
|
Subroutine
meta: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 13 | +{ | ||
| 14 | 0 | v => 1, | |
| 15 | target_type => 'str', | ||
| 16 | summary => 'Check that path exists (using -e)', | ||
| 17 | might_fail => 1, | ||
| 18 | description => <<'MARKDOWN', | ||
| 19 | |||
| 20 | This means that for a symlink, the target is checked and not the symlink itself. | ||
| 21 | Either regular file or directory or other types of file is allowed. | ||
| 22 | |||
| 23 | MARKDOWN | ||
| 24 | }; | ||
| 25 | } | ||
| 26 | |||
| 27 | 0 | ▶ | sub filter { |
|
Subroutine
filter: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 28 | 0 | my %args = @_; | |
| 29 | |||
| 30 | 0 | my $dt = $args{data_term}; | |
| 31 | |||
| 32 | 0 | my $res = {}; | |
| 33 | |||
| 34 | 0 | $res->{expr_filter} = join( | |
| 35 | "", | ||
| 36 | "do { my \$tmp = $dt; -e \$tmp ? [undef,\$tmp] : [qq('\$tmp' does not exist or is not a file), \$tmp] }", | ||
| 37 | ); | ||
| 38 | |||
| 39 | 0 | $res; | |
| 40 | } | ||
| 41 | |||
| 42 | 1 | 1; | |
| 43 | # ABSTRACT: | ||
| 44 | |||
| 45 | __END__ | ||