Recommendations for perl-to-python interoperation?

前端 未结 7 1777
甜味超标
甜味超标 2021-01-25 19:53

We have a sizable code base in Perl. For the forseeable future, our codebase will remain in Perl. However, we\'re looking into adding a GUI-based dashboard utility. We are consi

相关标签:
7条回答
  • 2021-01-25 20:08

    Interesting project: I would opt for loose-coupling and consider an XML-RPC or JSON based approach.

    0 讨论(0)
  • 2021-01-25 20:13

    You can spawn a child process and use an IPC mechanism like sockets or STDIO, or even embed one interpreter in the other.

    But why switch languages when Perl offers several Tk (Tk, Tkx, and Tcl::Tk) bindings and a very capable Wx binding?

    I have written and distributed GUI projects with Perl's Tk and Wx libraries.

    If you are need the ability to create stand-alone executables, check out PAR::Packer, ActiveState's PerlApp, and Cava Pacakger.

    0 讨论(0)
  • 2021-01-25 20:16

    Try the CPAN distribution Python (pyperl) for interfacing with python code.

    0 讨论(0)
  • 2021-01-25 20:27

    Well, if you really want to write the GUI in another language (which, seriously, is just a bad idea, since it will cost you more than it could ever benefit you), the thing you should do is the following:

    1. Document your Perl app in terms of the services it provides. You should do it with XML Schema Definition - XSD - for the data types and Web Service Description Language - WSDL - for the actual service.
    2. Implement the services in Perl, possibly using Catalyst::Controller::SOAP, or just XML::Compile::SOAP.
    3. Consume the services from your whatever-language GUI interface.
    4. Profit.

    But honestly, I really suggest you taking a look at the Perl GTK2 binding, it is awesome, including features such as implementing a Gtk class entirely in Perl and using it as argument to a function written in C - for instance, you can write a model class for a gtk tree entirely in Perl.

    0 讨论(0)
  • 2021-01-25 20:30

    I hate to be another one in the chorus, but...

    1. Avoid the use of an alternate language
    2. Use Wx so it's native look and feel makes the application look "real" to non-technical audiences.
    3. Download the Padre source code and see how it does Wx Perl code, then steal rampantly from it's best tricks or maybe just gut it and use the application skeleton (using the Artistic half of the Perl dual license to make it legal).
    4. Build your own Strawberry Perl subclass to package the application as an MSI installer and push it out across the corporate Active Directory domain.

    Of course, I only say all this because you said "Dashboard" which I read as "Corporate", which then makes me assume a Microsoft AD network...

    0 讨论(0)
  • 2021-01-25 20:33

    I'd avoid inter-language calls if possible; fragility and massive increases in dependencies await you down this road. However, there is...

    Inline::Python

    If python must be used, the Inline::* series of modules have been generally well received. This lets you write python inside a perl script. You still have to write perl but it would let you use python libraries inside perl scripts. It will make things more difficult to debug, though.

    0 讨论(0)
提交回复
热议问题