File Coverage

blib/lib/Amon2/ContextGuard.pm
Criterion Covered Total %
statement 20 20 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 25 26 96.1


line stmt bran cond sub pod time code
1             # THIS IS INTERNAL CLASS.
2             # DO NOT USE THIS CLASS DIRECTLY.
3             use strict;
4 25     25   170 use warnings;
  25         55  
  25         713  
5 25     25   143 use utf8;
  25         61  
  25         600  
6 25     25   3320  
  25         109  
  25         265  
7             my ($class, $context, $dst) = @_;
8             my $orig = $$dst;
9 25     25 0 1709 $$dst = $context;
10 25         51 bless [$orig, $dst], $class;
11 25         41 }
12 25         98  
13             my $self = shift;
14              
15             # paranoia: guard against cyclic reference
16 25     25   3224 delete ${$self->[1]}->{$_} for keys %{${$self->[1]}};
17              
18             ${$self->[1]} = $self->[0];
19 25         42 }
  25         41  
  25         117  
  54         139  
20              
21 25         55 1;
  25         262  
22