blib/lib/URI/Coralize.pm

filter: Statementstmt 100% 25 / 25 Branchbran 87.5% 7 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 94.7% 36 / 38 CC 5 SCAR 12.5
CC
5
Cov
97%
coralize
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.5
↑ Summary
1 package URI::Coralize;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use URI ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 our $VERSION = '0.01';
9 2 $VERSION = eval $VERSION;
10  
11 5 ▶sub URI::coralize {
Subroutine coralize: called CC=5 SCAR=16.1
Pod undocumented
12 5 my ($uri) = @_;
13  
14 # CoralCDN doesn't proxy secure requests and simply redirects to the
15 # requested resource.
16 5 ▶ return $uri if 'http' ne $uri->scheme;
Branch: 1 branch
BranchTrueFalseTotal
if "http" ne $uri->scheme 1 4 5
17  
18 4 my $host = eval { $uri->host };
19 4 ▶ return $uri unless $host;
Branch: 1 branch
BranchTrueFalseTotal
unless $host 0 4 4
20  
21 # Don't coralize the coralized.
22 4 ▶ return $uri if $host =~ m[ (?:^ | \.) nyud.net $]x;
Branch: 1 branch
BranchTrueFalseTotal
if $host =~ / (?:^ | \.) nyud.net $/x 1 3 4
23  
24 3 my $new = $uri->clone;
25  
26 3 ▶ if (80 != $uri->port) {
Branch: 1 branch
BranchTrueFalseTotal
if (80 != $uri->port) 1 2 3
27 1 $host .= '.' . $uri->port;
28 1 $new->port(undef);
29 }
30  
31 3 $host .= '.nyud.net';
32  
33 3 $new->host($host);
34  
35 3 return $new;
36 }
37  
38  
39 2 1;
40  
41 __END__
↑ Summary