blib/lib/DBIx/Class/Schema/TxnEndHook.pm

filter: Statementstmt 100% 12 / 12 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 94.7% 18 / 19 CC 2 SCAR 3.5
CC
2
Cov
93%
add_txn_end_hook
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.4
« blib/lib/DBIx/Class/Storage/TxnEndHook.pm ↑ Summary
1 package DBIx::Class::Schema::TxnEndHook;
2  
3 2 ▶use 5.008005;
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 sub add_txn_end_hook {
8 2 ▶ my $self = shift;
Subroutine add_txn_end_hook: called CC=2 SCAR=7.1
Pod documented
9  
10 2 ▶ $self->storage or $self->throw_exception
Branch: 1 branch
BranchTrueFalseTotal
$self->storage or $self->throw_exception("add_txn_end_hook called on \$schema without storage") 0 2 2
11 ('add_txn_end_hook called on $schema without storage');
12  
13 2 $self->storage->add_txn_end_hook(@_);
14 }
15  
16 2 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<add_txn_end_hook> 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
« blib/lib/DBIx/Class/Storage/TxnEndHook.pm ↑ Summary