1 use IPC::SysV qw(IPC_PRIVATE IPC_RMID IPC_NOWAIT IPC_STAT S_IRWXU S_IRWXG S_IRWXO);
4 #Creating a message queue
8 $msq = new IPC::Msg(IPC_PRIVATE, S_IRWXU | S_IRWXG | S_IRWXO)
9 || die "msgget: ",$!+0," $!\n";
13 #Putting a message on the queue
16 $msq->snd($msgtype,$msg,0) || print "not ";
19 #Check if there are messages on the queue
20 $ds = $msq->stat() or print "not ";
23 print "not " unless $ds && $ds->qnum() == 1;
26 #Retreiving a message from the queue
27 $rmsgtype = 0; # Give me any type
28 $rmsgtype = $msq->rcv($rmsg,256,$rmsgtype,IPC_NOWAIT) || print "not ";
31 print "not " unless $rmsgtype == $msgtype && $rmsg eq $msg;
34 $ds = $msq->stat() or print "not ";
37 print "not " unless $ds && $ds->qnum() == 0;
40 $msq->remove || print "not ";