Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Embedding Python in Perl?

Posted on 1998-06-30
2
Medium Priority
?
747 Views
Last Modified: 2010-05-18
I have a friend who is damn good programmer, but (unfortunately) his scripting language of choice is Python, while I am Perl lover. Does anybody know of a good, easy way to embed Python code (or use a "use" or "require") into a Perl script on a Unix machine? Thanks....
0
Comment
Question by:Dyrewolf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
b2pi earned 150 total points
ID: 1208251
I can come up with only three (not very good) ways to do this.

The first is that you could obviously use system calls to execute python programs.  You could even have some communication between the child python program and the parent perl program using simple ipc.  However, you're not going to get the same results as simply calling a subroutine.

Second way:  Building on the last, you set up a perl server and a python server (whether the python server starts the perl , or the perl starts the python, or they're both started independently doesn't matter). The two of them communicate with each other via straight sockets, and you avoid start up time by having them both running

Third way: Write a python interpreter in perl :)

For 50 points, what do you expect? :)
0
 
LVL 84

Expert Comment

by:ozo
ID: 1208252
Fourth way: write an XSUB interface. (see `perldoc perlxstut`)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question