until substr($file, 0, length $stem) eq $stem;
}
- bless { files => \@files, stem => $stem }, $class
+ bless { files => \@files, stem => $stem, notices => [] }, $class
}
+ # store additional messages that should appear in the report
+ sub add_notice { my $self = shift; push @{$self->{notices}}, @_ }
+ # return list of messages stored for the report
+ sub notices { return @{(shift)->{notices}} }
+
# scaffolding for now...
sub files { @{(shift)->{files}} }
sub file_name_stem { (shift)->{stem} }
throw processing_error => command => $step,
summary => $pubfinal." exists and 'replace' was not selected";
}
- push @{$op_header->{notices}},
- "Archived and overwrote $pubfinal with uploaded version";
+ $packet->add_notice
+ ("Archived and overwrote $pubfinal with uploaded version");
}
}
}
to => \@email_addresses, subject => $op_header->{package};
} else {
my @messages = ("upload of $upload_file and $sig_file complete");
- unshift @messages, @{$op_header->{notices}}, '' if $op_header->{notices};
- # The "notices" key in the oplist header is a kludge, but seems to be
- # the best immediate step to only send mail during the report phase.
+ # 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 => $op_header->{package};
}