有没有办法在Perl 6中处理Unix套接字?
我想使用Unix套接字与 mpv 进行通信,但Perl 6不提供任何高级别这样做的界面。所以我想我可以为此编写一个小模块,开始深入挖掘,找到了 IO :: Socket :: INET
的实现,并了解了NQP操作 nqp :: socket
和 nqp :: connect
。
I'd like to communicate with mpv using Unix sockets, but Perl 6 doesn't offer any high level interface for doing that. So I thought I could write a little module for that, started digging deeper, found the implementation of IO::Socket::INET
, and learned about the NQP ops nqp::socket
and nqp::connect
.
但是,我在 NQP运营清单中找不到任何提及,它们似乎与传统的BSD套接字API截然不同。因此,我想问一下:那两个能够创建一个Unix套接字并连接到它吗?如果是这样,怎么样?或者是否有另一种方式?
However, I couldn't find any mention of those in the NQP operations list, and they seem to be quite distinct from the traditional BSD socket API. Hence I'd like to ask: are those two able to create a Unix socket and connect to it? If so, how? Or is there perhaps another way?
我认为现在最好的方法是使用NativeCall接口来调用C级别功能。有一些旧的设计文档表明IO :: Socket :: UNIX被认为是。但它还没有成为当前版本的语言规范(还)。
I think the best way right now is to use the NativeCall interface to call the C level functions. There are some old design documentation that suggest an IO::Socket::UNIX was thought about. But it's not made it into contemporary releases of the language specification (yet).