Cmd/TXN.pm

filter: Statementstmt 47.8% 11 / 23 Branchbran 16.6% 1 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 2 totaltotal 37.5% 15 / 40 CC 5 SCAR 21.1
CC
5
Cov
38%
try_txn_commit
12.9
try_txn_begin
6.0
BEGIN
1.0
CRAP 8.2
« Cmd/Command/GC.pm ↑ Summary Cmd/WithDSN/Write.pm »
1 #!/usr/bin/perl
2  
3 package KiokuDB::Cmd::TXN;
4 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 requires "v";
9  
10 1 has _txn => (
11 traits => [qw(NoGetopt)],
12 is => "rw",
13 clearer => "_clear_txn",
14 predicate => "_has_txn",
15 );
16  
17 0 ▶sub try_txn_begin {
Subroutine try_txn_begin: not called CC=2 SCAR=17.9
Pod undocumented
18 0 my ( $self, $b ) = @_;
19  
20 0 ▶ if ( $b->does("KiokuDB::Backend::Role::TXN") ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($b->does("KiokuDB::Backend::Role::TXN")) 0 0 0
21 0 $self->v("starting transaction\n");
22 0 $self->_txn( $b->txn_begin );
23 }
24 }
25  
26 2 ▶sub try_txn_commit {
Subroutine try_txn_commit: called CC=4 SCAR=25.6
Pod undocumented
27 2 my ( $self, $b ) = @_;
28  
29 2 ▶ if ( $self->_has_txn ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_has_txn) 0 2 2
30 0 my $txn = $self->_txn;
31 0 ▶ if ( $self->can("dry_run") and $self->dry_run ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->can('dry_run') and $self->dry_run) { } 0 0 0
Condition0%0/3
$self->can("dry_run") and $self->dry_run
!ll&&!rl&&r
000
MC/DC0%0/2
$self->can("dry_run") and $self->dry_run
$self->can("dry_run") $self->dry_run
Truth table0%0/3
A and B
A= $self->can("dry_run")B= $self->dry_run
ABresult
0X0
100
111
32 0 $self->v("rolling back transaction...");
33 0 $b->txn_rollback($txn);
34 } else {
35 0 $self->v("comitting transaction...");
36 0 $b->txn_commit($txn);
37 }
38 0 $self->_clear_txn;
39 0 $self->v(" done\n");
40 }
41 }
42  
43 1 __PACKAGE__
44  
45 __END__
« Cmd/Command/GC.pm ↑ Summary Cmd/WithDSN/Write.pm »