This is unnecessary, and possibly unwise:
...
my $mode = (stat($self->{_spool_dir}))[2];
if ( $mode & 07077 ) { # must be sharing spool directory with external app
$self->log(LOGWARN,
"Changing permissions on file to permit scanner access");
chmod $mode, $filename;
}
...
The LOGWARN perhaps should be changed - this warning will show up for
every single message if it shows up at all, and all it tells is that you
have some group permissions on the spool directory, so it's not a per
message warning.