line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::DBIxTransactionManager; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
25134
|
use 5.006; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
40
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
31
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
846
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
1
|
|
|
|
|
12021
|
|
|
1
|
|
|
|
|
8
|
|
8
|
1
|
|
|
1
|
|
1352
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
56
|
|
9
|
1
|
|
|
1
|
|
871
|
use DBIx::TransactionManager; |
|
1
|
|
|
|
|
3784
|
|
|
1
|
|
|
|
|
179
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Mojolicious::Plugin::DBIxTransactionManager - DBIx::TransactionManager for Mojolicious's plugin |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 VERSION |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Version 0.02 |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 SYNOPSIS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Quick summary of what the module does. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Perhaps a little code snippet. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$self->plugin( DBIxTransactionManager => { dbh => $dbh } ); |
31
|
|
|
|
|
|
|
{ |
32
|
|
|
|
|
|
|
my $txn1 = $self->app->tm->txn_scope; |
33
|
|
|
|
|
|
|
{ |
34
|
|
|
|
|
|
|
my $txn2 = $self->app->tm->txn_scope; |
35
|
|
|
|
|
|
|
... ACTION ... |
36
|
|
|
|
|
|
|
$txn2->commit; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
... ACTION ... |
39
|
|
|
|
|
|
|
$txn1->commit; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 register |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub register { |
49
|
0
|
|
|
0
|
1
|
|
my ($self, $app, $conf) = @_; |
50
|
0
|
|
0
|
|
|
|
$conf ||= {}; |
51
|
|
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
|
croak "dbh is required!" unless $conf->{dbh}; |
53
|
0
|
|
|
0
|
|
|
$app->attr( 'tm' => sub { DBIx::TransactionManager->new( $conf->{dbh} ) } ); |
|
0
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 AUTHOR |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Tatsuya FUKATA, C<< >> |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 BUGS |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
63
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
64
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 SUPPORT |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
perldoc Mojolicious::Plugin::DBIxTransactionManager |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
You can also look for information at: |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=over 4 |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
L |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
L |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item * CPAN Ratings |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
L |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item * Search CPAN |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
L |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=back |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Copyright 2012 Tatsuya FUKATA. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
107
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
108
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=cut |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
1; # End of Mojolicious::Plugin::DBIxTransactionManager |