Common/URI/ftp.pm

filter: Statementstmt 100% 25 / 25 Branchbran 100% 2 / 2 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 94.7% 36 / 38 CC 3 SCAR 5.6
CC
3
Cov
97%
__ANON__
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.8
« Common/comment.pm ↑ Summary Common/URI/gopher.pm »
1 package Regexp::Common::URI::ftp;
2  
3 71 ▶use Regexp::Common qw /pattern clean no_defaults/;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 71 ▶use Regexp::Common::URI qw /register_uri/;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 71 ▶use Regexp::Common::URI::RFC2396 qw /$host $port $ftp_segments $userinfo
Subroutine BEGIN: called CC=1 SCAR=0.0
6 71 $userinfo_no_colon/;
7  
8 71 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 71 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 71 our $VERSION = '2024080801';
12  
13  
14 71 my $ftp_uri = "(?k:(?k:ftp)://(?:(?k:$userinfo)(?k:)\@)?(?k:$host)" .
15 "(?::(?k:$port))?(?k:/(?k:(?k:$ftp_segments)" .
16 "(?:;type=(?k:[AIai]))?))?)";
17  
18 71 my $ftp_uri_password =
19 "(?k:(?k:ftp)://(?:(?k:$userinfo_no_colon)" .
20 "(?::(?k:$userinfo_no_colon))?\@)?(?k:$host)" .
21 "(?::(?k:$port))?(?k:/(?k:(?k:$ftp_segments)" .
22 "(?:;type=(?k:[AIai]))?))?)";
23  
24 71 register_uri FTP => $ftp_uri;
25  
26 pattern name => [qw (URI FTP), "-type=[AIai]", "-password="],
27 3 ▶ create => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
28 my $uri = exists $_ [1] -> {-password} &&
29 3 ▶ !defined $_ [1] -> {-password} ? $ftp_uri_password
Branch: 1 branch
BranchTrueFalseTotal
exists $_[1]{'-password'} && !defined($_[1]{'-password'}) ? : 1 2 3
Condition66%2/3
exists $_[1]{"-password"} and not defined $_[1]{"-password"}
!ll&&!rl&&r
021
MC/DC50%1/2
exists $_[1]{"-password"} and not defined $_[1]{"-password"}
exists $_[1]{"-password"} not defined $_[1]{"-password"}
Truth table66%2/3
A and not(B)
A= exists $_[1]{"-password"}B= not defined $_[1]{"-password"}
ABresult
0X0
100
111
30 : $ftp_uri;
31 3 my $type = $_ [1] -> {-type};
32 3 $uri =~ s/\[AIai\]/$type/;
33 3 $uri;
34 }
35 71 ;
36  
37  
38 71 1;
39  
40 __END__
« Common/comment.pm ↑ Summary Common/URI/gopher.pm »