blib/lib/Data/Printer/Filter/URI.pm

filter: Statementstmt 67.8% 19 / 28 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 5 / 6 Podpod n/a totaltotal 51.0% 24 / 47 CC 6 SCAR 31.5
CC
6
Cov
49%
__ANON__
42.0
BEGIN
1.0
BEGIN
1.0
CRAP 23.4
↑ Summary
1 package Data::Printer::Filter::URI;
2 # ABSTRACT: pretty-printing URI objects
3  
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use warnings qw(all);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use Data::Printer::Filter;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Term::ANSIColor;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 our $VERSION = '0.008'; # VERSION
12  
13  
14 2 our @schemes = qw(
15 URL
16 data
17 file
18 ftp
19 gopher
20 http
21 https
22 ldap
23 ldapi
24 ldaps
25 mailto
26 mms
27 news
28 nntp
29 pop
30 rlogin
31 rsync
32 rtsp
33 rtspu
34 sip
35 sips
36 snews
37 ssh
38 telnet
39 tn3270
40 urn
41 urn::oid
42 );
43  
44 0 ▶filter $_ => sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
45 0 my ($obj, $p) = @_;
46  
47 0 my $str = qq($obj);
48  
49 0 ▶ $str =~ s{^
Branch: 1 branch
BranchTrueFalseTotal
if defined $obj->scheme 0 0 0
50 \b
51 0 @{[$obj->scheme]}
52 \b
53 }{
54 colored(
55 $obj->scheme,
56 exists($p->{color}{uri_scheme})
57 ? $p->{color}{uri_scheme}
58 0 ▶ : q(bright_green)
Branch: 1 branch
BranchTrueFalseTotal
exists $p->{'color'}{'uri_scheme'} ? : 0 0 0
59 )
60 }ex if defined $obj->scheme;
61  
62 0 ▶ $str =~ s{
Branch: 1 branch
BranchTrueFalseTotal
if $obj->can("host") and defined $obj->host 0 0 0
Condition0%0/3
$obj->can("host") and defined $obj->host
!ll&&!rl&&r
000
MC/DC0%0/2
$obj->can("host") and defined $obj->host
$obj->can("host") defined $obj->host
Truth table0%0/3
A and B
A= $obj->can("host")B= defined $obj->host
ABresult
0X0
100
111
63 \b
64 0 \Q@{[$obj->host]}\E
65 \b
66 }{
67 colored(
68 $obj->host,
69 exists($p->{color}{uri_host})
70 ? $p->{color}{uri_host}
71 0 ▶ : q(bold)
Branch: 1 branch
BranchTrueFalseTotal
exists $p->{'color'}{'uri_host'} ? : 0 0 0
72 )
73 }ex if $obj->can(q(host))
74 and defined $obj->host;
75  
76 0 return $str;
77 2 } for qw(Mojo::URL), map +qq(URI::$_), @schemes, qw(
78 scp
79 sftp
80 urn::isbn
81 urn::uuid
82 );
83  
84 2 1;
85  
86 __END__
↑ Summary