AuditAny/Role/Schema.pm

filter: Statementstmt 88.2% 30 / 34 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 12 / 16 Podpod 83.3% 5 / 6 totaltotal 82.7% 48 / 58 CC 2 SCAR 2.6
CC
2
Cov
86%
_apply_storage_role
2.0
all_auditors
2.0
changeset_do
2.0
CRAP 1.3
« AuditAny/DataPoint.pm ↑ Summary AuditAny/Collector/Code.pm »
1 package DBIx::Class::AuditAny::Role::Schema;
2 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 # ABSTRACT: Role to apply to tracked DBIx::Class::Schema objects
6  
7 12 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 12 ▶use MooX::Types::MooseLike::Base qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10  
11 =head1 NAME
12  
13 DBIx::Class::AuditAny::Role::Schema - Role to apply to tracked DBIx::Class::Schema objects
14  
15 =head1 DESCRIPTION
16  
17 This Role is for interfaces only. Its main job is to add the L<DBIx::Class::AuditAny::Role::Storage>
18 role to the DBIC storage object so the change tracking can occur.
19  
20 =head1 REQUIRES
21  
22 =head2 txn_do
23  
24 Standard method which will be available on all DBIC Schema objects
25 =cut
26  
27 12 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 12 ▶use DBIx::Class::AuditAny::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 12 ▶use DBIx::Class::AuditAny::Role::Storage;
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 12 requires 'txn_do';
32  
33 =head1 METHODS
34  
35 =head2 auditors
36  
37 =cut
38 15 ▶sub auditors { (shift)->storage->auditors(@_) }
Subroutine auditors: called CC=1 SCAR=0.0
Pod documented
39  
40 =head2 all_auditors
41  
42 =cut
43 0 ▶sub all_auditors { (shift)->storage->all_auditors(@_) }
Subroutine all_auditors: not called CC=1 SCAR=6.9
Pod documented
44  
45 =head2 auditor_count
46  
47 =cut
48 15 ▶sub auditor_count { (shift)->storage->auditor_count(@_) }
Subroutine auditor_count: called CC=1 SCAR=0.0
Pod documented
49  
50 =head2 add_auditor
51  
52 =cut
53 15 ▶sub add_auditor { (shift)->storage->add_auditor(@_) }
Subroutine add_auditor: called CC=1 SCAR=0.0
Pod documented
54  
55 =head2 changeset_do
56  
57 =cut
58 0 ▶sub changeset_do { (shift)->storage->changeset_do(@_) }
Subroutine changeset_do: not called CC=1 SCAR=6.9
Pod documented
59  
60 ▶sub BUILD {}
Subroutine BUILD: not called CC=1 SCAR=0.0
Pod undocumented
61 after BUILD => sub {
62 0 ▶ my $self = shift;
Subroutine __ANON__: not called CC=1 SCAR=6.9
63 # Just for good measure, not usually called because the role is applied
64 # after the fact (see AuditAny.pm)
65 0 $self->_apply_storage_role;
66 12 };
67  
68 sub _apply_storage_role {
69 15 ▶ my $self = shift;
Subroutine _apply_storage_role: called CC=2 SCAR=7.1
70 # Apply the role to the Storage object:
71 Moo::Role->apply_roles_to_object($self->storage,'DBIx::Class::AuditAny::Role::Storage')
72 15 ▶ unless try{$self->storage->does('DBIx::Class::AuditAny::Role::Storage')};
Subroutine __ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
BranchTrueFalseTotal
unless &try(sub { $self->storage->does("DBIx::Class::AuditAny::Role::Storage"); } ) 15 0 15
73 }
74  
75  
76 12 1;
77  
78  
79 __END__
80  
81 =head1 SEE ALSO
82  
83 =over
84  
85 =item *
86  
87 L<DBIx::Class::AuditAny>
88  
89 =item *
90  
91 L<DBIx::Class>
92  
93 =back
94  
95 =head1 SUPPORT
96
97 IRC:
98
99 Join #rapidapp on irc.perl.org.
100  
101 =head1 AUTHOR
102  
103 Henry Van Styn <vanstyn@cpan.org>
104  
105 =head1 COPYRIGHT AND LICENSE
106  
107 This software is copyright (c) 2012-2015 by IntelliTree Solutions llc.
108  
109 This is free software; you can redistribute it and/or modify it under
110 the same terms as the Perl 5 programming language system itself.
111  
112 =cut
« AuditAny/DataPoint.pm ↑ Summary AuditAny/Collector/Code.pm »