| 1 | package URI::_db; | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use 5.008001; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use base 'URI::_login'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | 3 | our $VERSION = '0.23'; | |||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||
| 8 | 934 | ▶ | sub uri { shift } | ||||||||||||||||||||||||||||||
|
Subroutine
uri: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 9 | 5 | ▶ | sub _no_scheme_ok { 0 } | ||||||||||||||||||||||||||||||
|
Subroutine
_no_scheme_ok: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||
| 11 | 416 | ▶ | sub canonical_engine { shift->scheme } | ||||||||||||||||||||||||||||||
|
Subroutine
canonical_engine: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||
| 13 | sub canonical { | ||||||||||||||||||||||||||||||||
| 14 | 53 | ▶ | my $canon = shift->SUPER::canonical; | ||||||||||||||||||||||||||||||
|
Subroutine
canonical: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 15 | 53 | my $engine = $canon->canonical_engine; | |||||||||||||||||||||||||||||||
| 16 | 53 | ▶ | return $canon if $canon->scheme eq $engine; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 17 | 17 | $canon = $canon->clone; | |||||||||||||||||||||||||||||||
| 18 | 17 | $canon->scheme($engine); | |||||||||||||||||||||||||||||||
| 19 | 17 | return $canon; | |||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||
| 22 | sub engine { | ||||||||||||||||||||||||||||||||
| 23 | 950 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
engine: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 24 | 950 | ▶ | return $self->scheme unless @_; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 25 | 6 | my $old = $self->scheme(@_); | |||||||||||||||||||||||||||||||
| 26 | 6 | ▶ | bless $self => 'URI::_db' unless $self->isa('URI::_db'); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 27 | 6 | return $old; | |||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||
| 30 | sub has_recognized_engine { | ||||||||||||||||||||||||||||||||
| 31 | 97 | ▶ | ref $_[0] ne __PACKAGE__; | ||||||||||||||||||||||||||||||
|
Subroutine
has_recognized_engine: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||
| 34 | sub dbname { | ||||||||||||||||||||||||||||||||
| 35 | 1146 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
dbname: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 36 | 1146 | my $is_full = $self->opaque =~ m{^//(?://|/?(?!/))}; | |||||||||||||||||||||||||||||||
| 37 | 1146 | ▶ | return $self->path($is_full && defined $_[0] ? "/$_[0]" : shift) if @_; | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
$is_full and defined $_[0]
MC/DC50%1/2
$is_full and defined $_[0]
$is_full
defined $_[0]
Truth table66%2/3
A and B
A= $is_fullB= defined $_[0]
| |||||||||||||||||||||||||||||||||
| 38 | 1136 | ▶ | my @segs = $self->path_segments or return; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 39 | 808 | ▶ | shift @segs if $is_full; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 40 | 808 | join '/' => @segs; | |||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||
| 43 | sub query_params { | ||||||||||||||||||||||||||||||||
| 44 | 1150 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
query_params: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 45 | 1150 | require URI::QueryParam; | |||||||||||||||||||||||||||||||
| 46 | return map { | ||||||||||||||||||||||||||||||||
| 47 | 1150 | my $f = $_; | |||||||||||||||||||||||||||||||
| 48 | 229 | map { $f => $_ } grep { defined } $self->query_param($f) | |||||||||||||||||||||||||||||||
| 49 | } $self->query_param; | ||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||
| 52 | sub _dbi_param_map { | ||||||||||||||||||||||||||||||||
| 53 | 65 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
_dbi_param_map: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 54 | return ( | ||||||||||||||||||||||||||||||||
| 55 | 65 | [ host => scalar $self->host ], | |||||||||||||||||||||||||||||||
| 56 | [ port => scalar $self->_port ], | ||||||||||||||||||||||||||||||||
| 57 | [ dbname => scalar $self->dbname ], | ||||||||||||||||||||||||||||||||
| 58 | ); | ||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||
| 61 | sub dbi_params { | ||||||||||||||||||||||||||||||||
| 62 | 173 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
dbi_params: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 63 | return ( | ||||||||||||||||||||||||||||||||
| 64 | ( | ||||||||||||||||||||||||||||||||
| 65 | 276 | map { @{ $_ } } | |||||||||||||||||||||||||||||||
| 66 | 173 | ▶ | grep { defined $_->[1] && length $_->[1] } $self->_dbi_param_map | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 67 | ), | ||||||||||||||||||||||||||||||||
| 68 | $self->query_params, | ||||||||||||||||||||||||||||||||
| 69 | ); | ||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||
| 72 | 1 | ▶ | sub dbi_driver { return undef } | ||||||||||||||||||||||||||||||
|
Subroutine
dbi_driver: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||
| 74 | sub _dsn_params { | ||||||||||||||||||||||||||||||||
| 75 | 91 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
_dsn_params: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 76 | 91 | my @params = $self->dbi_params; | |||||||||||||||||||||||||||||||
| 77 | 91 | my @kvpairs; | |||||||||||||||||||||||||||||||
| 78 | 91 | ▶ | while (@params) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 79 | 211 | push @kvpairs => join '=', shift @params, shift @params; | |||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||
| 81 | 91 | return join ';' => @kvpairs; | |||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||
| 84 | sub dbi_dsn { | ||||||||||||||||||||||||||||||||
| 85 | 88 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||
|
Subroutine
dbi_dsn: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 86 | 88 | ▶ | my $driver = $self->dbi_driver or return $self->_dsn_params; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 87 | 87 | return join ':' => 'dbi', $driver, $self->_dsn_params; | |||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||
| 90 | 3 | 1; | |||||||||||||||||||||||||||||||