File Coverage

blib/lib/Data/TxnBuffer/Base.pm
Criterion Covered Total %
statement 19 19 100.0
branch 2 2 100.0
condition n/a
subroutine 6 6 100.0
pod 1 1 100.0
total 28 28 100.0


line stmt bran cond sub pod time code
1             package Data::TxnBuffer::Base;
2 6     6   2847 use strict;
  6         10  
  6         159  
3 6     6   29 use warnings;
  6         10  
  6         128  
4 6     6   9437 use Try::Tiny;
  6         9782  
  6         924  
5              
6             sub txn_read {
7 6     6 1 779 my ($self, $code) = @_;
8              
9 6         8 my ($ret, $err);
10             try {
11 6     6   194 $code->($self);
12 2         17 $ret = $self->spin;
13             } catch {
14 4     4   151 $err = $_;
15 4         28 $self->reset;
16 6         41 };
17              
18 6 100       63 if ($err) {
19             # rethrow
20 4         17 die $err;
21             }
22              
23 2         6 $ret;
24             }
25              
26             1;
27              
28             __END__