1DBIx::Class::Helper::ScUhseemra:C:oVnetrriifbiuetre(d3D)PBeIrxl::DColcausmse:n:tHaetlipoenr::Schema::Verifier(3)
2
3
4
6 DBIx::Class::Helper::Schema::Verifier - Verify the Results and
7 ResultSets of your Schemata
8
10 package MyApp::Schema;
11
12 __PACKAGE__->load_components('Helper::Schema::Verifier');
13
14 sub result_verifiers {
15 (
16 sub {
17 my ($self, $result, $set) = @_;
18
19 for ($result, $set) {
20 die "$_ does not start with the letter A" unless m/^A/
21 }
22 },
23 shift->next::method,
24 )
25 }
26
28 "DBIx::Class::Helper::Schema::Verifier" is a minuscule framework to
29 assist in creating schemata that are to your very own exacting
30 specifications. It is inspired by my own travails in discovering that
31 "use mro 'c3'" is both required and barely documented in much Perl
32 code. As time goes by I expect to add many more verifiers, but with
33 this inaugural release I am merely including
34 DBIx::Class::Helper::Schema::Verifier::C3.
35
37 result_verifiers
38 You must implement "result_verifiers" in your subclass of "::Verifier".
39 Each verifier gets called on the schema and gets each result and
40 resultset together as arguments. You can use this to validate almost
41 anything about the results and resultsets of a schema; contributions
42 are warmly welcomed.
43
45 Initially I kept this module simple, but after using it in production
46 at ZipRecruiter <https://www.ziprecruiter.com> I found that showing the
47 user the first error that occurred and then giving up was pretty
48 annoying. Now "Schema::Verifier" wraps both "load_namespaces" in
49 DBIx::Class::Schema and "load_classes" in DBIx::Class::Schema and shows
50 all the exceptions encoutered as a list at the end of loading all the
51 results.
52
54 Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
55
57 This software is copyright (c) 2020 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
63
64perl v5.32.1 2021-D0B1I-x2:7:Class::Helper::Schema::Verifier(3)