| 1 | package OpenTracing::Implementation; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | |||||||||||||||||||||
| 6 | 3 | our $VERSION = 'v0.33.0'; | |||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | sub OT_IMPLEMENTATION_NAME { | ||||||||||||||||||||
| 9 | exists $ENV{ PERL_OPENTRACING_IMPLEMENTATION } ? | ||||||||||||||||||||
| 10 | $ENV{ PERL_OPENTRACING_IMPLEMENTATION } : | ||||||||||||||||||||
| 11 | exists $ENV{ OPENTRACING_IMPLEMENTATION } ? | ||||||||||||||||||||
| 12 | $ENV{ OPENTRACING_IMPLEMENTATION } : | ||||||||||||||||||||
| 13 | 3 | ▶ | 'NoOp' | ||||||||||||||||||
|
Subroutine
OT_IMPLEMENTATION_NAME: called CC=3 SCAR=11.2
Pod
undocumented
Branch: 2 branches
| |||||||||||||||||||||
| 14 | } | ||||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | sub OT_DEBUG { | ||||||||||||||||||||
| 17 | exists $ENV{ PERL_OPENTRACING_DEBUG } ? | ||||||||||||||||||||
| 18 | $ENV{ PERL_OPENTRACING_DEBUG } : | ||||||||||||||||||||
| 19 | exists $ENV{ OPENTRACING_DEBUG } ? | ||||||||||||||||||||
| 20 | $ENV{ OPENTRACING_DEBUG } : | ||||||||||||||||||||
| 21 | exists $ENV{ DEBUG } ? | ||||||||||||||||||||
| 22 | $ENV{ DEBUG } : | ||||||||||||||||||||
| 23 | undef | ||||||||||||||||||||
| 24 | 5 | ▶ | } | ||||||||||||||||||
|
Subroutine
OT_DEBUG: called CC=4 SCAR=16.6
Pod
undocumented
Branch: 3 branches
| |||||||||||||||||||||
| 25 | # | ||||||||||||||||||||
| 26 | # it was meant to be a constant, but during test, these seem to be dynamic | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 3 | ▶ | use OpenTracing::GlobalTracer; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | 3 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 33 | 3 | ▶ | use Module::Load; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | 3 | our @CARP_NOT; | |||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | sub import { | ||||||||||||||||||||
| 38 | 3 | ▶ | my $package = shift; | ||||||||||||||||||
|
Subroutine
import: called CC=2 SCAR=8.1
| |||||||||||||||||||||
| 39 | 3 | ▶ | return unless @_; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | 0 | __PACKAGE__->bootstrap_global_tracer( @_ ) | |||||||||||||||||||
| 42 | } | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | 1 | ▶ | sub bootstrap_tracer { shift->_build_tracer( @_ ) } | ||||||||||||||||||
|
Subroutine
bootstrap_tracer: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 2 | ▶ | sub bootstrap_default_tracer { shift->_build_tracer( undef, @_ ) } | ||||||||||||||||||
|
Subroutine
bootstrap_default_tracer: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 47 | |||||||||||||||||||||
| 48 | sub bootstrap_global_tracer { | ||||||||||||||||||||
| 49 | 1 | ▶ | OpenTracing::GlobalTracer->set_global_tracer( shift->_build_tracer( @_ ) ); | ||||||||||||||||||
|
Subroutine
bootstrap_global_tracer: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 50 | 1 | return OpenTracing::GlobalTracer->get_global_tracer | |||||||||||||||||||
| 51 | } | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | sub bootstrap_global_default_tracer { | ||||||||||||||||||||
| 54 | 1 | ▶ | OpenTracing::GlobalTracer->set_global_tracer( shift->_build_tracer( undef, @_ ) ); | ||||||||||||||||||
|
Subroutine
bootstrap_global_default_tracer: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 55 | 1 | return OpenTracing::GlobalTracer->get_global_tracer | |||||||||||||||||||
| 56 | } | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | # _build_tracer | ||||||||||||||||||||
| 59 | # | ||||||||||||||||||||
| 60 | # passing undef as implementation name will cause to use the $ENV | ||||||||||||||||||||
| 61 | # | ||||||||||||||||||||
| 62 | sub _build_tracer { | ||||||||||||||||||||
| 63 | 5 | ▶ | my $package = shift; | ||||||||||||||||||
|
Subroutine
_build_tracer: called CC=3 SCAR=11.1
| |||||||||||||||||||||
| 64 | 5 | my $implementation_name = shift; | |||||||||||||||||||
| 65 | 5 | my @implementation_args = @_; | |||||||||||||||||||
| 66 | |||||||||||||||||||||
| 67 | 5 | my $implementation_class = | |||||||||||||||||||
| 68 | __PACKAGE__->_get_implementation_class( $implementation_name ); | ||||||||||||||||||||
| 69 | |||||||||||||||||||||
| 70 | 5 | ▶ | carp "Loading implementation $implementation_class" | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 71 | if OT_DEBUG; | ||||||||||||||||||||
| 72 | |||||||||||||||||||||
| 73 | 5 | load $implementation_class; | |||||||||||||||||||
| 74 | |||||||||||||||||||||
| 75 | 5 | eval { load $implementation_class }; | |||||||||||||||||||
| 76 | 5 | ▶ | croak "GlobalTracer can't load implementation [$implementation_class]" | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 77 | if $@; | ||||||||||||||||||||
| 78 | |||||||||||||||||||||
| 79 | 5 | my $tracer = $implementation_class->bootstrap_tracer( @implementation_args); | |||||||||||||||||||
| 80 | |||||||||||||||||||||
| 81 | 5 | return $tracer | |||||||||||||||||||
| 82 | } | ||||||||||||||||||||
| 83 | |||||||||||||||||||||
| 84 | sub _get_implementation_class { | ||||||||||||||||||||
| 85 | 5 | ▶ | my $class = shift; | ||||||||||||||||||
|
Subroutine
_get_implementation_class: called CC=3 SCAR=11.0
| |||||||||||||||||||||
| 86 | 5 | ▶ | my $implementation_name = shift // OT_IMPLEMENTATION_NAME; | ||||||||||||||||||
|
Condition66%2/3
shift() // OT_IMPLEMENTATION_NAME()
MC/DC0%0/2
shift() // OT_IMPLEMENTATION_NAME()
shift()
OT_IMPLEMENTATION_NAME()
Truth table66%2/3
A // B
A= shift()B= OT_IMPLEMENTATION_NAME()
| |||||||||||||||||||||
| 87 | |||||||||||||||||||||
| 88 | 5 | ▶ | my $implementation_class = substr( $implementation_name, 0, 1) eq '+' ? | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 89 | substr( $implementation_name, 1 ) | ||||||||||||||||||||
| 90 | : | ||||||||||||||||||||
| 91 | 'OpenTracing::Implementation::' . $implementation_name; | ||||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | 5 | return $implementation_class | |||||||||||||||||||
| 94 | } | ||||||||||||||||||||
| 95 | |||||||||||||||||||||
| 96 | 3 | 1; | |||||||||||||||||||