NAME

DBIx::Class::Helper::Schema::Verifier - Verify the Results and ResultSets of your Schemata

SYNOPSIS

package MyApp::Schema;

__PACKAGE__->load_components('Helper::Schema::Verifier');

sub result_verifiers {
  (
     sub {
        my ($self, $result, $set) = @_;

        for ($result, $set) {
           die "$_ does not start with the letter A" unless m/^A/
        }
     },
     shift->next::method,
  )
}

DESCRIPTION

DBIx::Class::Helper::Schema::Verifier is a minuscule framework to assist in creating schemata that are to your very own exacting specifications. It is inspired by my own travails in discovering that use mro 'c3' is both required and barely documented in much Perl code. As time goes by I expect to add many more verifiers, but with this inaugural release I am merely including DBIx::Class::Helper::Schema::Verifier::C3.

INTERFACE METHODS

result_verifiers

You must implement result_verifiers in your subclass of ::Verifier. Each verifier gets called on the schema and gets each result and resultset together as arguments. You can use this to validate almost anything about the results and resultsets of a schema; contributions are warmly welcomed.

MORE ERRORS

Initially I kept this module simple, but after using it in production at ZipRecruiter I found that showing the user the first error that occurred and then giving up was pretty annoying. Now Schema::Verifier wraps both "load_namespaces" in DBIx::Class::Schema and "load_classes" in DBIx::Class::Schema and shows all the exceptions encoutered as a list at the end of loading all the results.

AUTHOR

Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2024 by Arthur Axel "fREW" Schmidt.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.