File Coverage

blib/lib/OpenTracing/Implementation/Test/ScopeManager.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             package OpenTracing::Implementation::Test::ScopeManager;
2              
3             our $VERSION = 'v0.103.1';
4              
5 5     5   330923 use Moo;
  5         22  
  5         39  
6 5     5   2315 use OpenTracing::Implementation::Test::Scope;
  5         33  
  5         1096  
7              
8             with 'OpenTracing::Role::ScopeManager';
9              
10             has '+active_scope' => (
11             clearer => 'final_scope',
12             );
13              
14             sub build_scope {
15             my ($self, %options) = @_;
16             my $span = $options{span};
17             my $finish_span_on_close = $options{finish_span_on_close};
18              
19             my $current_scope = $self->get_active_scope;
20             my $restore_scope =
21             $current_scope
22             ? sub { $self->set_active_scope($current_scope) }
23             : sub { $self->final_scope() };
24              
25             my $scope = OpenTracing::Implementation::Test::Scope->new(
26             span => $span,
27             finish_span_on_close => $finish_span_on_close,
28             on_close => $restore_scope,
29             );
30              
31             return $scope
32             }
33              
34             1;
35              
36              
37              
38             =head1 NAME
39              
40             OpenTracing::Implementation::Test::ScopeManager - OpenTracing Test for ScopeManager
41              
42              
43              
44             =head1 AUTHOR
45              
46             Szymon Nieznanski <snieznanski@perceptyx.com>
47              
48              
49              
50             =head1 COPYRIGHT AND LICENSE
51              
52             'Test::OpenTracing::Integration'
53             is Copyright (C) 2019 .. 2020, Perceptyx Inc
54              
55             This library is free software; you can redistribute it and/or modify it under
56             the terms of the Artistic License 2.0.
57              
58             This package is distributed in the hope that it will be useful, but it is
59             provided "as is" and without any express or implied warranties.
60              
61             For details, see the full text of the license in the file LICENSE.
62              
63              
64             =cut