blib/lib/Test/Smoke/App/ConfigSmoke/Mail.pm untested

filter: Statementstmt 0.0% 0 / 43 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 62 CC 7 SCAR 35.1
CC
7
Cov
0%
config_mail
56.0
BEGIN
2.0
BEGIN
2.0
CRAP 33.5
1 package Test::Smoke::App::ConfigSmoke::Mail;
2 use warnings;
3 use strict;
4  
5 our $VERSION = '0.001';
6  
7 use Exporter 'import';
8 our @EXPORT = qw/ config_mail /;
9  
10 use Test::Smoke::App::AppOption;
11 use Test::Smoke::App::Options;
12  
13 =head1 NAME
14  
15 Test::Smoke::App::ConfigSmoke::Mail - Mixin for Test::Smoke::App::ConfigSmoke.
16  
17 =head1 DESCRIPTION
18  
19 These methods will be added to the L<Test::Smoke::App::ConfigSmoke> class.
20  
21 =head2 config_mail
22  
23 Configure options: C<mail>, C<mail_type>, C<mserver>, C<to>, C<cc>, C<bcc>, C<swcc>, C<swbcc>
24  
25 =cut
26  
27 sub config_mail {
28 my $self = shift;
29  
30 print "\n-- Mail section --\n";
31  
32 my $use_mail = $self->handle_option(Test::Smoke::App::Options->mail);
33 return if !$use_mail;
34  
35 # discurrage ccp5p_onfail
36 $self->current_values->{ccp5p_onfail} = 0;
37  
38 my $mail_type = $self->handle_option(Test::Smoke::App::Options->mail_type());
39 for my $option (qw( from to cc bcc )) {
40 $self->handle_option(Test::Smoke::App::Options->$option);
41 }
42  
43 # Use the option definitions as a guide for asking values
44 my %mc = Test::Smoke::App::Options->mailer_config;
45 my $soptions = $mc{special_options}->{$mail_type};
46  
47 for my $option (qw( sendmailbin sendemailbin mailbin mailxbin mserver msport msuser )) {
48 if ( grep { $_->name eq $option } @{$soptions} ) {
49 $self->handle_option(Test::Smoke::App::Options->$option);
50 }
51 }
52  
53 if ($self->current_values->{msuser}) {
54 $self->handle_option(Test::Smoke::App::Options->mspass);
55 }
56  
57 if ($mail_type !~ /::/) {
58 for my $option (qw( swcc swbcc )) {
59 (my $related = $option) =~ s{^sw}{};
60 next if ! $self->current_values->{$related};
61  
62 if ( grep { $_->name eq $option } @{$soptions} ) {
63 $self->handle_option(Test::Smoke::App::Options->$option);
64 }
65 }
66 }
67 }
68  
69 1;
70  
71 =head1 COPYRIGHT
72  
73 E<copy> MMXXII - All rights reserved.
74  
75 * Abe Timmerman <abeltje@cpan.org>
76  
77 This library is free software; you can redistribute it and/or modify
78 it under the same terms as Perl itself.
79  
80 See:
81  
82 =over 4
83  
84 =item * L<http://www.perl.com/perl/misc/Artistic.html>
85  
86 =item * L<http://www.gnu.org/copyleft/gpl.html>
87  
88 =back
89  
90 This program is distributed in the hope that it will be useful,
91 but WITHOUT ANY WARRANTY; without even the implied warranty of
92 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
93  
94 =cut