line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Class::Schema::TxnEndHook; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
44166
|
use 5.008005; |
|
2
|
|
|
|
|
11
|
|
4
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
16
|
|
|
2
|
|
|
|
|
44
|
|
5
|
2
|
|
|
2
|
|
13
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
176
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub add_txn_end_hook { |
8
|
2
|
|
|
2
|
1
|
1147
|
my $self = shift; |
9
|
|
|
|
|
|
|
|
10
|
2
|
50
|
|
|
|
51
|
$self->storage or $self->throw_exception |
11
|
|
|
|
|
|
|
('add_txn_end_hook called on $schema without storage'); |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
|
|
66
|
$self->storage->add_txn_end_hook(@_); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
1; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=encoding utf-8 |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 NAME |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
DBIx::Class::Schema::TxnEndHook - provide add_txn_end_hook method to your schema class |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 SYNOPSIS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
package MyApp::Schema; |
27
|
|
|
|
|
|
|
use parent 'DBIx::Schema'; |
28
|
|
|
|
|
|
|
__PACKAGE__->ensure_class_loaded('DBIx::Class::Storage::TxnEndHook'); |
29
|
|
|
|
|
|
|
__PACKAGE__->ensure_class_loaded('DBIx::Class::Storage::DBI'); |
30
|
|
|
|
|
|
|
__PACKAGE__->inject_base('DBIx::Class::Storage::DBI', 'DBIx::Class::Storage::TxnEndHook'); |
31
|
|
|
|
|
|
|
__PACKAGE__->load_components('Schema::TxnEndHook'); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
package main |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my $schema = MyApp::Schema->connect(...) |
36
|
|
|
|
|
|
|
$schema->txn_begin; |
37
|
|
|
|
|
|
|
$schema->add_txn_end_hook(sub { ... }); |
38
|
|
|
|
|
|
|
$schema->txn_commit; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 DESCRIPTION |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
DBIx::Class::Schema::TxnEndHook provide C method to your schema class. |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 METHODS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=over 4 |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=item $schema->add_txn_end_hook(sub{ ... }) |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
It is short cut for C<< $schema->storage->add_txn_end_hook(sub{ ... }) >>. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=back |