« Data/Sah/Coerce/perl/To_str/From_str/convert_perl_pm_to_path.pm
↑ Summary
Data/Sah/Coerce/perl/To_str/From_str/convert_perl_pod_to_path.pm »
| 1 | package Data::Sah::Coerce::perl::To_str::From_str::convert_perl_pod_or_pm_to_path; | ||||||||||||
| 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-Perl'; # DIST | |||||||||||
| 10 | 1 | our $VERSION = '0.050'; # VERSION | |||||||||||
| 11 | |||||||||||||
| 12 | 0 | ▶ | sub meta { | ||||||||||
|
Subroutine
meta: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 13 | +{ | ||||||||||||
| 14 | 0 | v => 4, | |||||||||||
| 15 | summary => 'Convert POD/module name existing in @INC to its filesystem path', | ||||||||||||
| 16 | prio => 50, | ||||||||||||
| 17 | }; | ||||||||||||
| 18 | } | ||||||||||||
| 19 | |||||||||||||
| 20 | 0 | ▶ | sub coerce { | ||||||||||
|
Subroutine
coerce: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||
| 21 | 0 | my %args = @_; | |||||||||||
| 22 | |||||||||||||
| 23 | 0 | my $dt = $args{data_term}; | |||||||||||
| 24 | |||||||||||||
| 25 | 0 | my $res = {}; | |||||||||||
| 26 | |||||||||||||
| 27 | 0 | ▶ | $res->{modules}{'Module::Path::More'} //= {version=>0, core=>0, pp=>1}; | ||||||||||
|
Condition0%0/2
$res->{"modules"}{"Module::Path::More"} //= {"version", 0, "core", 0, "pp", 1}
MC/DC0%0/1
$res->{"modules"}{"Module::Path::More"} //= {"version", 0, "core", 0, "pp", 1}
$res->{"modules"}{"Module::Path::More"}
Truth table0%0/2
A
A= $res->{"modules"}{"Module::Path::More"}
| |||||||||||||
| 28 | 0 | $res->{expr_match} = "1"; | |||||||||||
| 29 | 0 | $res->{expr_coerce} = join( | |||||||||||
| 30 | "", | ||||||||||||
| 31 | "do { ", | ||||||||||||
| 32 | "my \$_sahc_orig = $dt; ", | ||||||||||||
| 33 | "if (\$_sahc_orig =~ m!\\A\\w+((?:/|::)+\\w+)*(?:\\.pm|\\.pod)?\\z!) {", | ||||||||||||
| 34 | " (my \$tmp = \$_sahc_orig) =~ s!/+!::!g; my \$ext; \$tmp =~ s/\\.(pm|pod)\\z// and \$ext = \$1;", | ||||||||||||
| 35 | " Module::Path::More::module_path(module=>\$tmp, find_pm=>!\$ext || \$ext eq 'pm' ? 2:0, find_pod=>!\$ext || \$ext eq 'pod' ? 1:0, find_prefix=>0, find_pmc=>0) || \$_sahc_orig ", | ||||||||||||
| 36 | "} else {", | ||||||||||||
| 37 | " \$_sahc_orig ", | ||||||||||||
| 38 | "} ", | ||||||||||||
| 39 | "}", | ||||||||||||
| 40 | ); | ||||||||||||
| 41 | |||||||||||||
| 42 | 0 | $res; | |||||||||||
| 43 | } | ||||||||||||
| 44 | |||||||||||||
| 45 | 1 | 1; | |||||||||||
| 46 | # ABSTRACT: | ||||||||||||
| 47 | |||||||||||||
| 48 | __END__ | ||||||||||||