| 1 | package Test::Smoke::Mailer::Base; | ||||||||||||||||||||||||||||
| 2 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 3 | our $VERSION = '0.001'; | |||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use Test::Smoke::Util qw( parse_report_Config ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | =head1 NAME | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | Test::Smoke::Mailer::Base - baseclass for Mailers | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | =cut | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 3 | our $P5P = 'perl5-porters@perl.org'; | |||||||||||||||||||||||||||
| 19 | 3 | our $NOCC_RE = ' (?:PASS\b|FAIL\(X\))'; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | =head2 Test::Smoke::Mailer::Base->new() | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | constructor. | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | =cut | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 28 | 0 | my $class = shift; | |||||||||||||||||||||||||||
| 29 | 0 | return bless {@_}, $class; | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | =head2 $mailer->fetch_report( ) | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | C<fetch_report()> reads B<mktest.rpt> from C<{ddir}> and return the | ||||||||||||||||||||||||||||
| 35 | subject line for the mail-message. | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | =cut | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | ▶ | sub fetch_report { | ||||||||||||||||||||||||||
|
Subroutine
fetch_report: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 40 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 0 | $self->{file} = File::Spec->catfile( $self->{ddir}, $self->{rptfile} ); | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 0 | local *REPORT; | |||||||||||||||||||||||||||
| 45 | 0 | ▶ | if ( open REPORT, "< $self->{file}" ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | 0 | $self->{body} = do { local $/; <REPORT> }; | |||||||||||||||||||||||||||
| 47 | 0 | close REPORT; | |||||||||||||||||||||||||||
| 48 | } else { | ||||||||||||||||||||||||||||
| 49 | 0 | require Carp; | |||||||||||||||||||||||||||
| 50 | 0 | Carp::croak( "Cannot read '$self->{file}': $!" ); | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 0 | my @config = parse_report_Config( $self->{body} ); | |||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 0 | return sprintf "Smoke [%s] %s %s %s %s (%s)", @config[6, 1, 5, 2, 3, 4]; | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | =head2 $mailer->error( ) | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | C<error()> returns the value of C<< $mailer->{error} >>. | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | =cut | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 0 | ▶ | sub error { | ||||||||||||||||||||||||||
|
Subroutine
error: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 65 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 0 | ▶ | return $self->{error} || ''; | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'error'} || ''
MC/DC0%0/1
$self->{'error'} || ''
$self->{'error'}
Truth table0%0/2
A
A= $self->{'error'}
| |||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | =head2 $self->_get_cc( $subject ) | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | C<_get_cc()> implements the C<--ccp5p_onfail> option. It looks at the | ||||||||||||||||||||||||||||
| 73 | subject to see if the smoke FAILed and then adds the I<perl5-porters> | ||||||||||||||||||||||||||||
| 74 | mailing-list to the C<Cc:> field unless it is already part of C<To:> | ||||||||||||||||||||||||||||
| 75 | or C<Cc:>. | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | The new behaviour is to only return C<Cc:> on fail. This is determined | ||||||||||||||||||||||||||||
| 78 | by the new global regex kept in C<< $Test::Smoke::Mailer::NOCC_RE >>. | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | =cut | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub _get_cc { | ||||||||||||||||||||||||||
|
Subroutine
_get_cc: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||
| 83 | 0 | my( $self, $subject ) = @_; | |||||||||||||||||||||||||||
| 84 | 0 | ▶ | return "" if $subject =~ m/$Test::Smoke::Mailer::NOCC_RE/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 0 | ▶ | return $self->{cc} || "" unless $self->{ccp5p_onfail}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$self->{'cc'} || ''
MC/DC0%0/1
$self->{'cc'} || ''
$self->{'cc'}
Truth table0%0/2
A
A= $self->{'cc'}
| |||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 0 | ▶ | my $p5p = $Test::Smoke::Mailer::P5P or return $self->{cc}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 89 | 0 | ▶ | my @cc = $self->{cc} ? $self->{cc} : (); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | push @cc, $p5p unless $self->{to} =~ /\Q$p5p\E/ || | ||||||||||||||||||||||||||||
| 92 | 0 | ▶ | $self->{cc} =~ /\Q$p5p\E/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"to"} =~ /\Q$p5p\E/ or $self->{"cc"} =~ /\Q$p5p\E/
MC/DC0%0/2
$self->{"to"} =~ /\Q$p5p\E/ or $self->{"cc"} =~ /\Q$p5p\E/
$self->{"to"} =~ /\Q$p5p\E/
$self->{"cc"} =~ /\Q$p5p\E/
Truth table0%0/3
A or B
A= $self->{"to"} =~ /\Q$p5p\E/B= $self->{"cc"} =~ /\Q$p5p\E/
| |||||||||||||||||||||||||||||
| 93 | 0 | return join ", ", @cc; | |||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 3 | 1; | |||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||
| 101 | (c) 2002-2013, All rights reserved. | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | * Abe Timmerman <abeltje@cpan.org> | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | This library is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 106 | it under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | See: | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | * <http://www.perl.com/perl/misc/Artistic.html>, | ||||||||||||||||||||||||||||
| 111 | * <http://www.gnu.org/copyleft/gpl.html> | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | This program is distributed in the hope that it will be useful, | ||||||||||||||||||||||||||||
| 114 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||||||
| 115 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | =cut | ||||||||||||||||||||||||||||