Data/Sah/Coerce/perl/To_str/From_str/convert_perl_pm_or_pod_to_path.pm

filter: Statementstmt 61.9% 13 / 21 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 60.0% 3 / 5 Podpod 0.0% 0 / 2 totaltotal 51.6% 16 / 31 CC 2 SCAR 10.4
CC
2
Cov
57%
coerce
6.0
meta
2.0
BEGIN
1.0
CRAP 2.8
« Sah/Schema/perl/pod_or_pm_filename.pm ↑ Summary Data/Sah/Coerce/perl/To_str/From_str/convert_perl_pm_to_path.pm »
1 package Data::Sah::Coerce::perl::To_str::From_str::convert_perl_pm_or_pod_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 module/POD 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}
l!l
00
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"}
Aresult
11
00
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', find_pod=>!\$ext || \$ext eq 'pod', 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__
« Sah/Schema/perl/pod_or_pm_filename.pm ↑ Summary Data/Sah/Coerce/perl/To_str/From_str/convert_perl_pm_to_path.pm »