| 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
| |||||||||||||||||||||||||||||||||
| 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
Condition0%0/3
$tmp_paths[-1] =~ /\./ and $may_page
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
| |||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||
| 72 | 0 | return $self->{ref_paths} } | |||||||||||||||||||||||||||||||
| 73 | 0 | else { return 0 ; | |||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||
| 77 | 1 | 1; | |||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||