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.
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?
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.
Another solution is to write a Perl daemon and talk to it over a domain socket, pipe, or some other method of IPC.
You might also be interested in the Perl documentation covering embedding perl.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With