I am maintaining some existing code
I see this fragment:
msgsnd( $mQueue, pack("l! a*", length($msg), $msg), 0)
|| ... error handling ...
I would like to understand the call to pack() as the second argument to msgsnd.
I find the following documentation for msgsend
Calls the System V IPC function msgsnd to send the message MSG to the message queue ID. MSG must begin with the native long integer message type, be followed by the length of the actual message, and then finally the message itself. This kind of packing can be achieved with pack("l! a*", $type, $message) . Returns true if successful, false on error. See also SysV IPC in perlipc and the documentation for IPC::SysV and IPC::Msg .
This gives the second parameter to pack as $type, but does not explain what $type is. The code I'm trying to understand instead passes the message length.
What's going on? So far as I can tell the existing code is working reliably.