IPC :: Shareable是否可以使用受祝福的对象?

时间:2022-05-24 12:12:47

I would like to share a blessed object between two or more Perl applications. The object in question is quite expensive to instantiate, but always the same (static). The idea is to instantiate it once in one application and use it in other applications. This particular object is basically an http client using HTTP::Tiny an a whole bunch of other modules. Instantiating it via new() can take more than 50% of the total run time. I think the only module which may be a problem is the HTTP::Tiny since it open sockets, but not really sure. Can I use IPC::Shareable or some other method to share this http client among other applications?

我想在两个或更多Perl应用程序之间共享一个受祝福的对象。有问题的对象实例化非常昂贵,但总是相同(静态)。我们的想法是在一个应用程序中实例化一次,并在其他应用程序中使用它。这个特定的对象基本上是一个使用HTTP :: Tiny的http客户端和一大堆其他模块。通过new()实例化它可能占总运行时间的50%以上。我认为唯一可能存在问题的模块是HTTP :: Tiny,因为它打开套接字,但不是很确定。我可以使用IPC :: Shareable或其他方法在其他应用程序*享此http客户端吗?

Follow-up, are there any significant security issues with IPC::Shareable?

后续行动,IPC :: Shareable是否存在重大安全问题?

1 个解决方案

#1


0  

It supports anything Storable can handle. So it can handle objects, but not file handles (incl sockets). File handles are process-specific anyway.

它支持Storable可以处理的任何东西。所以它可以处理对象,但不能处理文件句柄(包括套接字)。无论如何,文件句柄都是特定于进程的。

Access to the shared memory is controlled using the same permission system that is used to control access to files (via the mode option), so the security issues are the same as they are for files.

使用用于控制文件访问的相同权限系统(通过mode选项)来控制对共享内存的访问,因此安全问题与文件相同。

#1


0  

It supports anything Storable can handle. So it can handle objects, but not file handles (incl sockets). File handles are process-specific anyway.

它支持Storable可以处理的任何东西。所以它可以处理对象,但不能处理文件句柄(包括套接字)。无论如何,文件句柄都是特定于进程的。

Access to the shared memory is controlled using the same permission system that is used to control access to files (via the mode option), so the security issues are the same as they are for files.

使用用于控制文件访问的相同权限系统(通过mode选项)来控制对共享内存的访问,因此安全问题与文件相同。