lib/Mail/DMARC/Report/Store.pm

filter: Statementstmt 92.3% 36 / 39 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 12 / 14 Podpod 0.0% 0 / 6 totaltotal 80.9% 51 / 63 CC 3 SCAR 4.1
CC
3
Cov
91%
backend
3.0
retrieve
2.0
retrieve_todo
2.0
CRAP 1.5
« lib/Mail/DMARC/Report/Send.pm ↑ Summary lib/Mail/DMARC/Test/Transport.pm »
1 package Mail::DMARC::Report::Store;
2 5 our $VERSION = '2.20260827';
3 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use feature 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶use feature 'try';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶no warnings 'experimental::try'; ## no critic (ProhibitNoWarnings)
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 5 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 5 ▶use Module::Load;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 5 ▶use parent 'Mail::DMARC::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 10 ▶sub delete_report( $self, @args ) {
Subroutine delete_report: called CC=1 SCAR=0.0
Pod undocumented
15 10 return $self->backend->delete_report(@args);
16 }
17  
18 4 ▶sub error( $self, @args ) {
Subroutine error: called CC=1 SCAR=0.0
Pod undocumented
19 4 return $self->backend->insert_error(@args);
20 }
21  
22 0 ▶sub retrieve( $self, @args ) {
Subroutine retrieve: not called CC=1 SCAR=6.9
Pod undocumented
23 0 return $self->backend->retrieve(@args);
24 }
25  
26 21 ▶sub next_todo( $self, @args ) {
Subroutine next_todo: called CC=1 SCAR=0.0
Pod undocumented
27 21 return $self->backend->next_todo(@args);
28 }
29  
30 0 ▶sub retrieve_todo( $self, @args ) {
Subroutine retrieve_todo: not called CC=1 SCAR=6.9
Pod undocumented
31 0 return $self->backend->retrieve_todo(@args);
32 }
33  
34 51 ▶sub backend($self) {
Subroutine backend: called CC=3 SCAR=11.1
Pod undocumented
35 51 my $backend = $self->config->{report_store}{backend};
36  
37 51 ▶ croak "no backend defined?!" if !$backend;
Branch: 1 branch
BranchTrueFalseTotal
unless $backend 0 51 51
38  
39 51 ▶ return $self->{$backend} if ref $self->{$backend};
Branch: 1 branch
BranchTrueFalseTotal
if ref $self->{$backend} 25 26 51
40 26 my $module = "Mail::DMARC::Report::Store::$backend";
41 26 try {
42 26 load $module;
43 }
44 catch ($error) {
45 0 croak "Unable to load backend $backend: $error\n";
46 }
47  
48 26 return $self->{$backend} = $module->new;
49 }
50  
51 5 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
« lib/Mail/DMARC/Report/Send.pm ↑ Summary lib/Mail/DMARC/Test/Transport.pm »