lib/FP/url_.pm

filter: Statementstmt 100% 33 / 33 Branchbran 75.0% 3 / 4 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 91.6% 44 / 48 CC 4 SCAR 8.0
CC
4
Cov
95%
url_
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« lib/PXML/Preserialize.pm ↑ Summary lib/FP/Trampoline.pm »
1 #
2 # Copyright (c) 2014-2021 Christian Jaeger, copying@christianjaeger.ch
3 #
4 # This is free software, offered under either the same terms as perl 5
5 # or the terms of the Artistic License version 2 or the terms of the
6 # MIT License (Expat version). See the file COPYING.md that came
7 # bundled with this file.
8 #
9  
10 =head1 NAME
11  
12 FP::url_
13  
14 =head1 SYNOPSIS
15  
16 1 ▶ use FP::url_;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 my $u = url_ path => "index.html", fragment => "foo#bar";
18 # $u is an URI object
19 is "$u", 'index.html#foo%23bar';
20  
21 =head1 DESCRIPTION
22  
23  
24 =head1 NOTE
25  
26 This is alpha software! Read the status section in the package README
27 or on the L<website|http://functional-perl.org/>.
28  
29 =cut
30  
31 package FP::url_;
32 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 2 ▶use warnings FATAL => 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
35 2 ▶use Exporter "import";
Subroutine BEGIN: called CC=1 SCAR=0.0
36  
37 2 our @EXPORT = qw(url_);
38 2 our @EXPORT_OK = qw();
39 2 our %EXPORT_TAGS = (all => [@EXPORT, @EXPORT_OK]);
40  
41 2 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
42  
43 2 our @keys = qw(scheme path fragment);
44  
45 2 our %keys = map { $_ => $_ } @keys;
46  
47 1 ▶sub url_ {
Subroutine url_: called CC=4 SCAR=14.0
Pod undocumented
48 1 my $u = URI->new;
49 1 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 2 1 3
50 2 my $k = shift;
51 2 ▶ @_ or die "url_: uneven number of arguments";
Branch: 1 branch
BranchTrueFalseTotal
@_ or die "url_: uneven number of arguments" 2 0 2
52 2 my $v = shift;
53 2 ▶ my $m = $keys{$k} // die "url_: unknown key '$k'";
Condition50%1/2
$FP::url_::keys{$k} // die("url_: unknown key '${k}'")
l!l
20
MC/DC0%0/1
$FP::url_::keys{$k} // die("url_: unknown key '${k}'")
$FP::url_::keys{$k}
Truth table50%1/2
A
A= $FP::url_::keys{$k}
Aresult
11
00
54 2 $u->$m($v);
55 }
56 $u
57 1 }
58  
59 2 1
« lib/PXML/Preserialize.pm ↑ Summary lib/FP/Trampoline.pm »