| 1 | package Catmandu::Pluggable; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 21 | ▶ | use Catmandu::Sane; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 21 | our $VERSION = '1.2025'; | |||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 21 | ▶ | use Moo::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 21 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 16 | ▶ | sub plugin_namespace {'Catmandu::Plugin'} | ||||||||||||||||||||||||||
|
Subroutine
plugin_namespace: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 15 | ▶ | sub with_plugins { | ||||||||||||||||||||||||||
|
Subroutine
with_plugins: called CC=6 SCAR=19.3
Pod
documented
| |||||||||||||||||||||||||||||
| 13 | 15 | my $class = shift; | |||||||||||||||||||||||||||
| 14 | 15 | ▶ | $class = ref $class || $class; | ||||||||||||||||||||||||||
|
Condition66%2/3
ref $class || $class
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table66%2/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||
| 15 | 0 | ▶ | my @plugins = ref $_[0] eq 'ARRAY' ? @{$_[0]} : @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 16 | 15 | @plugins = split /,/, join ',', @plugins; | |||||||||||||||||||||||||||
| 17 | 15 | ▶ | @plugins || return $class; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 18 | 15 | my $ns = $class->plugin_namespace; | |||||||||||||||||||||||||||
| 19 | Moo::Role->create_class_with_roles( | ||||||||||||||||||||||||||||
| 20 | $class, | ||||||||||||||||||||||||||||
| 21 | map { | ||||||||||||||||||||||||||||
| 22 | 15 | my $pkg = $_; | |||||||||||||||||||||||||||
| 23 | 16 | ▶ | if ($pkg !~ s/^\+// && $pkg !~ /^$ns/) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$pkg =~ s/^\+// or $pkg =~ /^$ns/
MC/DC0%0/2
$pkg =~ s/^\+// or $pkg =~ /^$ns/
$pkg =~ s/^\+//
$pkg =~ /^$ns/
Truth table33%1/3
A or B
A= $pkg =~ s/^\+//B= $pkg =~ /^$ns/
| |||||||||||||||||||||||||||||
| 24 | 16 | $pkg = "${ns}::${pkg}"; | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | 16 | $pkg; | |||||||||||||||||||||||||||
| 27 | } @plugins | ||||||||||||||||||||||||||||
| 28 | ); | ||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 21 | 1; | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | __END__ | ||||||||||||||||||||||||||||