# return list of messages stored for the report
sub notices { return @{(shift)->{notices}} }
+ sub report_message;
+ # internal base class helper method for report_message
+ sub _report_message {
+ my $self = shift;
+ my @messages = @_; # collect final messages
+
+ # add notices stored in the packet object...
+ unshift @messages, $self->notices, '';
+ # ...and remove any leading blank lines...
+ shift @messages while $messages[0] eq '';
+ # ...before returning the report message text
+ return join "\n", @messages;
+ }
+
# has this packet been installed into the managed tree?
sub successful { (shift)->{installation_successful} }
$self->SUPER::install;
}
+
+ sub report_message {
+ my $self = shift;
+
+ return $self->_report_message
+ ('processing of '.$self->directive_file_name.' complete');
+ }
}
{
$self->SUPER::install;
}
+
+ sub report_message {
+ my $self = shift;
+
+ return $self->_report_message
+ ('upload of '.join(' and ', $self->target_filepair).' complete');
+ }
}
\f
push @email_addresses, keyidx_email $packet->auth_signature_fingerprints;
# report success
- if (not $packet->has_uploaded_file) {
- mail 'processing of '.$packet->directive_file_name.' complete',
- to => \@email_addresses, subject => $packet->target_package;
- } else {
- my @messages =
- ('upload of '.join(' and ', $packet->target_filepair).' complete');
- # add notices stored in the packet object...
- unshift @messages, $packet->notices, '';
- # ...and remove any leading blank lines...
- shift @messages while $messages[0] eq '';
- # ...before sending the report
- mail join("\n", @messages),
- to => \@email_addresses, subject => $packet->target_package;
- }
+ mail $packet->report_message,
+ to => \@email_addresses, subject => $packet->target_package;
# unlink the directive file
unlink File::Spec->catfile(CONF_DIR_Scratch, $packet->directive_file_name)