Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I call Perl from within python?

Tags:

python

perl

I have searched a lot and I have understood that there exists inline::Python for putting in python code within Perl.. But I am looking for some means by which I can access modules and functions written in Perl by not writing any Perl code, through a python code.

Maybe, I am asking for too much?

like image 963
zubinmehta Avatar asked Nov 27 '10 20:11

zubinmehta


People also ask

Can we call Perl script in Python?

Open your Python code in your Python editor of choice. Go to the line in the code where you want to run your Perl script. Type "pyth. RunPerl.

How do you call a function in Perl Python?

#!/usr/bin/python from perlfunc import perlfunc, perlreq, perl5lib @perlfunc @perlreq('very_old.pl') def hello(somebody): pass if __name__ == '__main__': assert(hello('python-visit-perl') == 'Hello, python-visit-perl! ')

How do I call a Perl script from another?

If you would like to make a call to, or reference, a Perl script from within a different Perl script, you can accomplish this a system(), exec() or the backtick operator to the path for Perl. For example: system("/usr/bin/perl /path/to/my_script.pl ");


1 Answers

I believe this is the sort of thing that the Parrot project aims to allow. It's a VM that's supposed to be able to run various dynamic languages, including Python and Perl. I've no idea how ready it is for real use, though, and I've never seen any instructions for people wanting to use Parrot, rather than develop it.

like image 91
Thomas K Avatar answered Sep 21 '22 20:09

Thomas K