| 1 | package MojoX::Authentication::Util; | ||||||||||||||||||||||||||||
| 2 | 23 | ▶ | use v5.24; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 23 | ▶ | use experimental qw< signatures >; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 23 | ▶ | use Scalar::Util qw< blessed >; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 23 | ▶ | use Exporter qw< import >; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 23 | ▶ | use Module::Runtime qw< use_module >; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 23 | our @EXPORT_OK = qw< | |||||||||||||||||||||||||||
| 10 | coercer_for | ||||||||||||||||||||||||||||
| 11 | decode_name | ||||||||||||||||||||||||||||
| 12 | encode_name | ||||||||||||||||||||||||||||
| 13 | >; | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 16 | ▶ | sub coercer_for ($name, $class) { | ||||||||||||||||||||||||||
|
Subroutine
coercer_for: called CC=1 SCAR=0.2
Pod
documented
| |||||||||||||||||||||||||||||
| 16 | 18 | ▶ | return sub ($x) { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.6
| |||||||||||||||||||||||||||||
| 17 | 18 | ▶ | return ($x->can($name) // sub { $_[0] })->($x) if blessed($x); | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
Condition33%1/3
$x->can($name) // sub {
$_[0];
}
MC/DC0%0/2
$x->can($name) // sub {
$_[0];
}
$x->can($name)
sub {
$_[0];
}
Truth table33%1/3
A // B
A= $x->can($name)B= sub {
$_[0];
}
| |||||||||||||||||||||||||||||
| 18 | 10 | ▶ | return $x->() if ref($x) eq 'CODE'; # factory sub | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 19 | 10 | return use_module($class)->new($x); | |||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | 16 | } | |||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 129 | ▶ | sub encode_name ($name) { | ||||||||||||||||||||||||||
|
Subroutine
encode_name: called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||
| 24 | 0 | return $name =~ s{([%/])}{sprintf('%%%02x', ord($1))}regmxs; | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 56 | ▶ | sub decode_name ($name) { | ||||||||||||||||||||||||||
|
Subroutine
decode_name: called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||
| 28 | 0 | return $name =~ s{%(..)}{chr(hex($1))}regmxs; | |||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 23 | 1; | |||||||||||||||||||||||||||