| 1 | package Mojolicious::Plugin::DBIxTransactionManager; | ||||||||||||
| 2 | |||||||||||||
| 3 | 2 | ▶ | use 5.006; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | 2 | ▶ | use Mojo::Base 'Mojolicious::Plugin'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 2 | ▶ | use Carp; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | 2 | ▶ | use DBIx::TransactionManager; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 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 | 2 | 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 | 0 | ▶ | sub register { | ||||||||||
|
Subroutine
register: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||
| 49 | 0 | my ($self, $app, $conf) = @_; | |||||||||||
| 50 | 0 | ▶ | $conf ||= {}; | ||||||||||
|
Condition0%0/2
$conf ||= {}
MC/DC0%0/1
$conf ||= {}
$conf
Truth table0%0/2
A
A= $conf
| |||||||||||||
| 51 | |||||||||||||
| 52 | 0 | ▶ | croak "dbh is required!" unless $conf->{dbh}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 53 | 0 | ▶ | $app->attr( 'tm' => sub { DBIx::TransactionManager->new( $conf->{dbh} ) } ); | ||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||
| 54 | } | ||||||||||||
| 55 | |||||||||||||
| 56 | =head1 AUTHOR | ||||||||||||
| 57 | |||||||||||||
| 58 | Tatsuya FUKATA, C<< <tatsuya.fukata at gmail.com > >> | ||||||||||||
| 59 | |||||||||||||
| 60 | =head1 BUGS | ||||||||||||
| 61 | |||||||||||||
| 62 | Please report any bugs or feature requests to C<bug-mojolicious-plugin-dbixtransactionmanager at rt.cpan.org>, or through | ||||||||||||
| 63 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Mojolicious-Plugin-DBIxTransactionManager>. 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<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Mojolicious-Plugin-DBIxTransactionManager> | ||||||||||||
| 83 | |||||||||||||
| 84 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||
| 85 | |||||||||||||
| 86 | L<http://annocpan.org/dist/Mojolicious-Plugin-DBIxTransactionManager> | ||||||||||||
| 87 | |||||||||||||
| 88 | =item * CPAN Ratings | ||||||||||||
| 89 | |||||||||||||
| 90 | L<http://cpanratings.perl.org/d/Mojolicious-Plugin-DBIxTransactionManager> | ||||||||||||
| 91 | |||||||||||||
| 92 | =item * Search CPAN | ||||||||||||
| 93 | |||||||||||||
| 94 | L<http://search.cpan.org/dist/Mojolicious-Plugin-DBIxTransactionManager/> | ||||||||||||
| 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 | 2 | 1; # End of Mojolicious::Plugin::DBIxTransactionManager | |||||||||||