File Coverage

blib/lib/DBIx/Class/Helper/Schema/Verifier/C3.pm
Criterion Covered Total %
statement 20 20 100.0
branch 2 2 100.0
condition n/a
subroutine 7 7 100.0
pod 1 1 100.0
total 30 30 100.0


line stmt bran cond sub pod time code
1             package DBIx::Class::Helper::Schema::Verifier::C3;
2             $DBIx::Class::Helper::Schema::Verifier::C3::VERSION = '2.034002';
3             # ABSTRACT: Verify that the Results and ResultSets of your Schemata use c3
4              
5 1     1   83642 use strict;
  1         9  
  1         24  
6 1     1   4 use warnings;
  1         2  
  1         20  
7              
8 1     1   369 use MRO::Compat;
  1         1398  
  1         24  
9 1     1   5 use mro 'c3';
  1         2  
  1         4  
10              
11 1     1   23 use base 'DBIx::Class::Helper::Schema::Verifier';
  1         3  
  1         406  
12              
13             sub result_verifiers {
14             (
15             sub {
16 3     3   11 my ($s, $result, $set) = @_;
17              
18 3         7 for ($result, $set) {
19 5         16 my $mro = mro::get_mro($_);
20 5 100       28 die "$_ does not use c3, it uses $mro" unless $mro eq 'c3';
21             }
22             },
23             shift->next::method,
24             )
25 3     3 1 1624 }
26              
27             1;
28              
29             __END__
30              
31             =pod
32              
33             =head1 NAME
34              
35             DBIx::Class::Helper::Schema::Verifier::C3 - Verify that the Results and ResultSets of your Schemata use c3
36              
37             =head1 SYNOPSIS
38              
39             package MyApp::Schema;
40              
41             __PACKAGE__->load_components('Helper::Schema::Verifier::C3');
42              
43             =head1 DESCRIPTION
44              
45             C<DBIx::Class::Helper::Schema::Verifier::C3> verifies that all of your results
46             and resultsets use the C<c3> C<mro>. If you didn't know this was important
47             L<you know now|https://blog.afoolishmanifesto.com/posts/mros-and-you>. Note:
48             this will probably fail on your schema because L<DBIx::Class::ResultSet> does
49             not use C<c3>.
50              
51             =head1 AUTHOR
52              
53             Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
54              
55             =head1 COPYRIGHT AND LICENSE
56              
57             This software is copyright (c) 2019 by Arthur Axel "fREW" Schmidt.
58              
59             This is free software; you can redistribute it and/or modify it under
60             the same terms as the Perl 5 programming language system itself.
61              
62             =cut