blib/lib/Catmandu/Transactional.pm untested

filter: Statementstmt 0.0% 0 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod n/a totaltotal 0.0% 0 / 15 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Catmandu::Transactional;
2  
3 use Catmandu::Sane;
4  
5 our $VERSION = '1.0201_02';
6  
7 use Moo::Role;
8 use namespace::clean;
9  
10 requires 'transaction';
11  
12 1;
13  
14 __END__
15  
16 =pod
17  
18 =head1 NAME
19  
20 Catmandu::Transactional - Optional role for transactional stores
21  
22 =head1 SYNOPSIS
23  
24 # bag will be untouched
25 my $store->transaction(sub {
26 $store->bag('books')->add({title => 'Time must have a stop'});
27 die;
28 });
29  
30 =head1 METHODS
31  
32 =head2 transaction($sub)
33  
34 C<transaction> takes a coderef that will be executed in the context of a
35 transaction. If an error is thrown, the transaction will rollback. If the code
36 executes successfully, the transaction will be committed. There is no support
37 for nested transactions, nested calls to C<transaction> will simply be subsumed
38 by their parent transaction.
39  
40 =cut