blib/lib/oEdtk/Emailing.pm

filter: Statementstmt 50.0% 10 / 20 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 2 / 4 Podpod 100% 1 / 1 totaltotal 48.1% 13 / 27 CC 2 SCAR 11.6
CC
2
Cov
45%
_delegate
6.0
send_mail
2.0
BEGIN
1.0
CRAP 3.2
« lib/oEdtk/SignedField.pm ↑ Summary blib/lib/oEdtk/Keycloak.pm »
1 package oEdtk::Emailing;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 our $VERSION = 2.1129;
7 1 our @ISA = qw(Exporter);
8 1 our @EXPORT_OK = qw(send_mail);
9  
10 # The public e-mailing client is corporate data and now lives in oEUser::Emailing.
11 # This generic module is a thin delegate so callers using the old oEdtk::Emailing
12 # name keep working. oEUser is an optional companion distribution: it is loaded on
13 # demand, and a missing one fails cleanly rather than breaking the oEdtk load.
14 0 ▶sub _delegate {
Subroutine _delegate: not called CC=2 SCAR=17.9
15 0 my ( $sub, @args ) = @_;
16 0 my $loaded;
17 {
18 0 local $SIG{__DIE__}; # a caught die must not reach oEdtk::Tracking's handler
19 0 $loaded = eval { require oEUser::Emailing; 1 };
20 }
21 0 ▶ die "oEdtk::Emailing requires the companion distribution oEUser "
Branch: 1 branch
BranchTrueFalseTotal
unless $loaded 0 0 0
22 . "(oEUser::Emailing is not installed): $@"
23 unless $loaded;
24 0 return oEUser::Emailing->can($sub)->(@args);
25 }
26  
27 0 ▶sub send_mail { return _delegate( 'send_mail', @_ ) }
Subroutine send_mail: not called CC=1 SCAR=6.9
Pod documented
28  
29 1 1;
30  
31 =head1 NAME
32  
33 oEdtk::Emailing - delegate to the oEUser e-mailing client
34  
35 =head1 SYNOPSIS
36  
37 use oEdtk::Emailing qw(send_mail);
38  
39 send_mail( $subject, $content, $mailing ); # see oEUser::Emailing
40  
41 =head1 DESCRIPTION
42  
43 The public e-mailing client is corporate; it lives in C<oEUser::Emailing>. This
44 module keeps the old C<oEdtk::Emailing> name available to existing callers and
45 forwards every function to the companion distribution, which is loaded on demand.
46 When oEUser is not installed, the call fails with a clear message.
47  
48 =head1 FUNCTIONS
49  
50 =over 4
51  
52 =item send_mail
53  
54 Forwards to C<oEUser::Emailing::send_mail> and returns its result.
55  
56 =back
57  
58 =head1 AUTHOR
59  
60 The oEdtk team.
61  
62 =cut
« lib/oEdtk/SignedField.pm ↑ Summary blib/lib/oEdtk/Keycloak.pm »