简体   繁体   English

从Perl脚本运行Python脚本

[英]Running Python scripts from Perl scripts

I have a complex state machine in Perl which would be call the perl library module supporting different functionality. 我在Perl中有一个复杂的状态机,可以称为支持不同功能的perl库模块。 Each of the library modules are called sequentially based on state machine in perl. 每个库模块都基于Perl中的状态机被顺序调用。

But now I have one of the library module (consisting of many API) in python scripts which is needs to be called from perl state machine. 但是现在我在python脚本中有一个库模块(由许多API组成)之一,需要从perl状态机中调用它。

Please suggest me as to how can I call the sub-routines in python from the perl state-machine. 请向我建议如何从perl状态机调用python中的子例程。

There is an Inline::Python on CPAN, but personally I have been unable to get that to work. CPAN上有一个Inline :: Python ,但就我个人而言,我无法使其正常工作。 Other than that, you can't. 除此之外,您不能。 You will need to create a wrapper script (in Python) which does the calls you need and call that as a separate process. 您将需要创建一个包装器脚本(在Python中),该脚本执行所需的调用并将其作为单独的过程进行调用。 Depending on how the app is structured, you might have to pass data through some language neutral IPC mechanism like sockets or pipes. 根据应用程序的结构,您可能必须通过某种与语言无关的IPC机制(例如套接字或管道)传递数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM