如何在C ++应用程序中嵌入Perl?

时间:2021-09-25 21:04:13

I would like to call Perl script files from my c++ program.

我想从我的c ++程序中调用Perl脚本文件。

I am not sure that the people I will distribute to will have Perl installed.

我不确定我将分发给谁的人将安装Perl。

Basically I'm looking for a .lib file that I can use that has an Apache like distribution license.

基本上我正在寻找一个我可以使用的.lib文件,它具有类似Apache的分发许可证。

3 个解决方案

#1


14  

You can embed perl into your app.

您可以将perl嵌入到您的应用中。

#2


6  

I'm currently writing a library for embedding Perl in C++, but it's not finished yet. In any case I would recommend against using the EP library. Not only has it not been maintained for years, but is also has some severe architectural deficiencies and is rather limited in its scope. If you are interested in alpha software you can contact me about it, otherwise I'd advice you to use the raw API.

我目前正在编写一个用于在C ++中嵌入Perl的库,但它还没有完成。无论如何,我建议不要使用EP库。它不仅没有维持多年,而且还有一些严重的架构缺陷,而且其范围相当有限。如果您对alpha软件感兴趣,可以与我联系,否则我建议您使用原始API。

#3


1  

To call perl from C++ you need to use the API, as someone else mentioned; the basic tutorial is available in the perlxstut documentation.

要从C ++调用perl,您需要像其他人提到的那样使用API​​; perlxstut文档中提供了基本教程。

Note that you will most probably need more than just a ".lib", because you'll need a lot of tiny modules which are located in the "lib" directory of the perl distrib: strict.pm, etc. That's a not a big deal though, I guess; the apache example you mentioned has the same constraint of delivering some default configuration files etc.

请注意,您很可能需要的不仅仅是“.lib”,因为您需要很多小模块,这些模块位于perl distrib:strict.pm的“lib”目录中,等等。这不是我想,这很重要;您提到的apache示例与提供某些默认配置文件等具有相同的约束。

However, to distribute Perl, on Windows (I guess you're on Windows since you mentionned a .lib file), the ActiveState distribution which everyone uses might cause some licensing headache. It's not really clear to me, but it seems like you cannot redistribute ActivePerl in a commercial product. Note that, if you want to embed Perl in a C++ program, you might have to recompile it anyway, to have the same compilation flags on Perl and on your program.

但是,要在Windows上分发Perl(我想你自从提到.lib文件以来就在Windows上),每个人使用的ActiveState发行版可能会引起一些许可问题。这对我来说并不是很清楚,但似乎你无法在商业产品中重新分配ActivePerl。请注意,如果要在C ++程序中嵌入Perl,则可能必须重新编译它,以便在Perl和程序上具有相同的编译标志。

#1


14  

You can embed perl into your app.

您可以将perl嵌入到您的应用中。

#2


6  

I'm currently writing a library for embedding Perl in C++, but it's not finished yet. In any case I would recommend against using the EP library. Not only has it not been maintained for years, but is also has some severe architectural deficiencies and is rather limited in its scope. If you are interested in alpha software you can contact me about it, otherwise I'd advice you to use the raw API.

我目前正在编写一个用于在C ++中嵌入Perl的库,但它还没有完成。无论如何,我建议不要使用EP库。它不仅没有维持多年,而且还有一些严重的架构缺陷,而且其范围相当有限。如果您对alpha软件感兴趣,可以与我联系,否则我建议您使用原始API。

#3


1  

To call perl from C++ you need to use the API, as someone else mentioned; the basic tutorial is available in the perlxstut documentation.

要从C ++调用perl,您需要像其他人提到的那样使用API​​; perlxstut文档中提供了基本教程。

Note that you will most probably need more than just a ".lib", because you'll need a lot of tiny modules which are located in the "lib" directory of the perl distrib: strict.pm, etc. That's a not a big deal though, I guess; the apache example you mentioned has the same constraint of delivering some default configuration files etc.

请注意,您很可能需要的不仅仅是“.lib”,因为您需要很多小模块,这些模块位于perl distrib:strict.pm的“lib”目录中,等等。这不是我想,这很重要;您提到的apache示例与提供某些默认配置文件等具有相同的约束。

However, to distribute Perl, on Windows (I guess you're on Windows since you mentionned a .lib file), the ActiveState distribution which everyone uses might cause some licensing headache. It's not really clear to me, but it seems like you cannot redistribute ActivePerl in a commercial product. Note that, if you want to embed Perl in a C++ program, you might have to recompile it anyway, to have the same compilation flags on Perl and on your program.

但是,要在Windows上分发Perl(我想你自从提到.lib文件以来就在Windows上),每个人使用的ActiveState发行版可能会引起一些许可问题。这对我来说并不是很清楚,但似乎你无法在商业产品中重新分配ActivePerl。请注意,如果要在C ++程序中嵌入Perl,则可能必须重新编译它,以便在Perl和程序上具有相同的编译标志。