SplitURI.pm

filter: Statementstmt 9.7% 4 / 41 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 12.5% 1 / 8 Podpod 0.0% 0 / 7 totaltotal 7.2% 5 / 69 CC 7 SCAR 29.8
CC
7
Cov
8%
splitPathURI
42.0
get_ref_array_of_path
6.0
new
2.0
CRAP 19.6
« ShibbolethRequestMap.pm ↑ Summary Shibboleth.pm »
1 package Lemonldap::Federation::SplitURI ;
2 1 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
4 0 my $class =shift;
5 0 my %args = @_;
6 0 my $self;
7 0 $self=\%args;
8 0 my $_uri = URI->new($self->{uri} );
9 0 $self->{scheme} = $_uri->scheme;
10 0 $self->{path} = $_uri->path;
11 0 $self->{port} = $_uri->port;
12 0 $self->{host} = $_uri->host;
13 0 bless $self,$class;
14 0 $self->splitPathURI($self);
15 0 return $self;
16 }
17  
18  
19  
20 0 ▶sub splitPathURI {
Subroutine splitPathURI: not called CC=6 SCAR=37.4
Pod undocumented
21 0 my $self= shift;
22  
23 0 my $string_of_path = $self->{path};
24  
25 0 my @paths;
26 my $may_rep;
27 0 ▶$may_page= 1 if $string_of_path !~ /\/$/ ;
Branch: 1 branch
BranchTrueFalseTotal
unless $string_of_path =~ m[/$] 0 0 0
28 0 my @tmp_paths = split /\// , $string_of_path ;
29 0 shift @tmp_paths ;# the first it is root directory
30 0 ▶ if (($tmp_paths[-1]=~/\./) and ($may_page)) {
Branch: 2 branches
BranchTrueFalseTotal
if ($tmp_paths[-1] =~ /\./ and $may_page) { } 0 0 0
elsif ($may_page) { } 0 0 0
Condition0%0/3
$tmp_paths[-1] =~ /\./ and $may_page
!ll&&!rl&&r
000
MC/DC0%0/2
$tmp_paths[-1] =~ /\./ and $may_page
$tmp_paths[-1] =~ /\./ $may_page
Truth table0%0/3
A and B
A= $tmp_paths[-1] =~ /\./B= $may_page
ABresult
0X0
100
111
31 0 pop @tmp_paths ;
32 }
33 elsif ($may_page) { # must be tested ahead
34 0 pop @tmp_paths;
35 }
36  
37  
38 0 for my $a_path (@tmp_paths) {
39 0 push @paths , $a_path ;
40 }
41  
42 0 $self->{ref_paths} = \@paths ;
43 0 return 1;
44  
45 }
46  
47 sub get_host
48 0 ▶{
Subroutine get_host: not called CC=1 SCAR=6.9
Pod undocumented
49 0 my $self = shift;
50 0 return $self->{host};
51 }
52 sub get_port
53 0 ▶{
Subroutine get_port: not called CC=1 SCAR=6.9
Pod undocumented
54 0 my $self = shift;
55 0 return $self->{port};
56 }
57 sub get_scheme
58 0 ▶{
Subroutine get_scheme: not called CC=1 SCAR=6.9
Pod undocumented
59 0 my $self = shift;
60 0 return $self->{scheme};
61 }
62 sub get_path
63 0 ▶{
Subroutine get_path: not called CC=1 SCAR=6.9
Pod undocumented
64 0 my $self = shift;
65 0 return $self->{path};
66 }
67  
68 sub get_ref_array_of_path
69 0 ▶{
Subroutine get_ref_array_of_path: not called CC=2 SCAR=17.9
Pod undocumented
70 0 my $self = shift;
71 0 ▶if ($self->{ref_paths}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'ref_paths'}) { } 0 0 0
72 0 return $self->{ref_paths} }
73 0 else { return 0 ;
74 }
75 }
76  
77 1 1;
78  
« ShibbolethRequestMap.pm ↑ Summary Shibboleth.pm »