line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Role for actions that are transactional |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Pinto::Role::Transactional; |
4
|
|
|
|
|
|
|
|
5
|
51
|
|
|
51
|
|
29494
|
use Moose::Role; |
|
51
|
|
|
|
|
119
|
|
|
51
|
|
|
|
|
446
|
|
6
|
51
|
|
|
51
|
|
286079
|
use MooseX::MarkAsMethods ( autoclean => 1 ); |
|
51
|
|
|
|
|
129
|
|
|
51
|
|
|
|
|
510
|
|
7
|
|
|
|
|
|
|
|
8
|
51
|
|
|
51
|
|
161728
|
use Try::Tiny; |
|
51
|
|
|
|
|
120
|
|
|
51
|
|
|
|
|
3601
|
|
9
|
|
|
|
|
|
|
|
10
|
51
|
|
|
51
|
|
318
|
use Pinto::Util qw(throw); |
|
51
|
|
|
|
|
114
|
|
|
51
|
|
|
|
|
10111
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.13'; # VERSION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
requires qw( execute repo ); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
around execute => sub { |
23
|
|
|
|
|
|
|
my ( $orig, $self, @args ) = @_; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
$self->repo->txn_begin; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $result = try { $self->$orig(@args); $self->repo->txn_commit } |
28
|
|
|
|
|
|
|
catch { $self->repo->txn_rollback; throw $_ }; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
return $self->result; |
31
|
|
|
|
|
|
|
}; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=pod |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=encoding UTF-8 |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=for :stopwords Jeffrey Ryan Thalhammer |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 NAME |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Pinto::Role::Transactional - Role for actions that are transactional |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 VERSION |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
version 0.13 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 AUTHOR |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Jeffrey Ryan Thalhammer <jeff@stratopan.com> |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Jeffrey Ryan Thalhammer. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
61
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |