blib/lib/Mail/DMARC/Report/Store.pm untested

filter: Statementstmt 0.0% 0 / 39 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 14 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 63 CC 3 SCAR 13.5
CC
3
Cov
0%
backend
12.0
delete_report
2.0
error
2.0
CRAP 3.9
1 package Mail::DMARC::Report::Store;
2 our $VERSION = '2.20260827';
3 use strict;
4 use warnings;
5 use feature 'signatures';
6 use feature 'try';
7 no warnings 'experimental::try'; ## no critic (ProhibitNoWarnings)
8  
9 use Carp;
10 use Module::Load;
11  
12 use parent 'Mail::DMARC::Base';
13  
14 sub delete_report( $self, @args ) {
15 return $self->backend->delete_report(@args);
16 }
17  
18 sub error( $self, @args ) {
19 return $self->backend->insert_error(@args);
20 }
21  
22 sub retrieve( $self, @args ) {
23 return $self->backend->retrieve(@args);
24 }
25  
26 sub next_todo( $self, @args ) {
27 return $self->backend->next_todo(@args);
28 }
29  
30 sub retrieve_todo( $self, @args ) {
31 return $self->backend->retrieve_todo(@args);
32 }
33  
34 sub backend($self) {
35 my $backend = $self->config->{report_store}{backend};
36  
37 croak "no backend defined?!" if !$backend;
38  
39 return $self->{$backend} if ref $self->{$backend};
40 my $module = "Mail::DMARC::Report::Store::$backend";
41 try {
42 load $module;
43 }
44 catch ($error) {
45 croak "Unable to load backend $backend: $error\n";
46 }
47  
48 return $self->{$backend} = $module->new;
49 }
50  
51 1;
52  
53 __END__
54  
55 =pod
56  
57 =head1 NAME
58  
59 Mail::DMARC::Report::Store - persistent storage broker for reports
60  
61 =head1 VERSION
62  
63 version 2.20260827
64  
65 =head1 SYNOPSIS
66  
67 =head1 DESCRIPTION
68  
69 At present, the only storage module is L<SQL|Mail::DMARC::Report::Store::SQL>.
70  
71 I experimented with perl's AnyDBM storage backend, but chose to deploy with SQL because a single SQL implementation supports many DBD drivers, including SQLite, MySQL, and DBD (same as AnyDBM).
72  
73 This Store class provides a layer of indirection, allowing one to write a new Mail::DMARC::Report::Store::MyGreatDB module, update their config file, and not alter the innards of Mail::DMARC. Much.
74  
75 =head1 AUTHORS
76  
77 =over 4
78  
79 =item *
80  
81 Matt Simerson <msimerson@cpan.org>
82  
83 =item *
84  
85 Davide Migliavacca <shari@cpan.org>
86  
87 =item *
88  
89 Marc Bradshaw <marc@marcbradshaw.net>
90  
91 =back
92  
93 =head1 COPYRIGHT AND LICENSE
94  
95 This software is copyright (c) 2026 by Matt Simerson.
96  
97 This is free software; you can redistribute it and/or modify it under
98 the same terms as the Perl 5 programming language system itself.
99  
100 =cut