Perl Check - Need Help
Jerry Benton
jerry.benton at mailborder.com
Fri Apr 7 22:58:45 UTC 2017
I am trying to update some Perl code that checks if a socket is FIFO or UNIX and then executes appropriately. I am not entirely sure about the UNIX socket I am creating here. Can any Perl gurus chime in?
use IO::Socket::UNIX;
my $pf_connection = '/var/spool/postfix/public/qmgr';
if(-p $pf_connection){
# FIFO
my $fh = new FileHandle;
$fh->open($pf_connection) or
MailScanner::Log::WarnLog("KickMessage coould not write to FIFO " .
"%s, %s", "$public/qmgr", $!);
print $fh "I";
$fh->close;
}elsif(-S $pf_connection){
# UNIX
my $fh = IO::Socket::UNIX->new(
Type => SOCK_STREAM,
Peer => $pf_connection,
) or
MailScanner::Log::WarnLog("KickMessage coould not write to UNIX " .
"%s, %s", "$public/qmgr", $!);
print $fh "I";
$fh->close;
}else{
MailScanner::Log::WarnLog("Unable to determine socket type (FIFO/UNIX) " .
"%s, %s", "$public/qmgr", $!);
}
-
Jerry Benton
www.mailborder.com
+1 - 844-436-6245
More information about the MailScanner
mailing list