适用于PHP的Perl解释器 [英] Perl interpreter for PHP

查看:86
本文介绍了适用于PHP的Perl解释器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我计划在我的新站点上使用的某些功能已经作为免费的Perl模块提供了.因此,我正在研究使用它们的可能性,而不是在PHP中再次对其进行编码.我打算使用execsystem函数来调用perl脚本,这会很慢.但是我遇到了 pecl扩展名,它允许

Some of the functions I am planning for a new site of mine are already available as free Perl modules. Hence I am looking at the possibility of using them, rather than coding them again in PHP. I was planning to use exec or system function to call the perl script, which will be slow. But I came across a pecl extension which allows PHP to interpret perl code.

这会影响我其他未使用perl脚本的php页面的性能吗?我知道额外的模块会增加我的内存使用率,但是除此之外,还会有问题吗?

Will this affect the performance of my other php pages, which are not using the perl script? I understand that the extra module will increase my memory usage, but other than that, will there be any issues?

推荐答案

看来,它所做的只是将perl嵌入到PHP进程中.您应该看到内存增加了几兆字节,再加上您在Perl中创建的所有数据.它不应减慢任何代码的速度.它只是内存中另一个等待您调用的库.此解决方案有两个好处:您不必浪费时间生成另一​​个进程,也不必解析所打印文本的返回值.

It looks like all it is doing is embedding perl inside the PHP process. You should see a memory increase of a few megabytes plus any data you create in Perl. It should not slow down any code. It is just another library sitting in memory waiting for you to call it. There are two benefits of this solution: you don't have to waste time spawning another process and you don't have to parse the return values from text being printed.

另一种解决方案是编写一个Perl守护程序,并通过域套接字,管道或IPC的某些其他方法与之对话.

Another solution is to write a Perl daemon and talk to it over a domain socket, pipe, or some other method of IPC.

您可能还对涵盖嵌入perl 的Perl文档感兴趣.

You might also be interested in the Perl documentation covering embedding perl.

这篇关于适用于PHP的Perl解释器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆