Discussion:
call perl from python code
Stella Levin
2012-04-22 10:21:14 UTC
Permalink
Hi,
I have installed Inline::Python.
Manual says: "perl is a Python module bundled with Inline::Python that gives you access to Perl from inside your Python code"- I cannot find this perl module under installation package
- I cannot get working:

#! /usr/bin/env python
import perl
perl.eval("printf \"HelloFromPerl\";")

- I can get working:

#!/usr/bin/perl
use Inline Python => <<'END';
print "Hello from python"
END

Any help will be appreciated.
Thanks, Stella
Stefan Seifert
2012-04-22 18:44:21 UTC
Permalink
Hi Stella,
Post by Stella Levin
I have installed Inline::Python.
Manual says: "perl is a Python module bundled with Inline::Python that gives
you access to Perl from inside your Python code"- I cannot find this perl
This may be a bit misleading. The "perl" module is only available in code
running from Inline::Python. To expand your second example:

#!/usr/bin/perl
use 5.10.0;
sub test {
say "Hello from Perl within Python";
}
use Inline Python => <<'END';
perl.test()
END

Regards,
Stefan
David Mertens
2012-04-22 19:09:50 UTC
Permalink
Stella -

Did you have any luck using PyPerl? http://wiki.python.org/moin/PyPerl

David
Post by Stella Levin
Hi,
I have installed Inline::Python.
Manual says: "perl is a Python module bundled with Inline::Python that
gives you access to Perl from inside your Python code"- I cannot find this
perl module under installation package
#! /usr/bin/env python
import perl
perl.eval("printf \"HelloFromPerl\";")
#!/usr/bin/perl
use Inline Python => <<'END';
print "Hello from python"
END
Any help will be appreciated.
Thanks, Stella
--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." -- Brian Kernighan
David Mertens
2012-04-22 20:59:54 UTC
Permalink
Stella,

Did you follow the link that I provided? From that page, I found a patched
version from about 2007:
http://www.felix-schwarz.name/files/opensource/pyperl/ as well as a
subversion repo for Mandriva.

As this module aims to actually embed a Perl interpreter in Python, one of
the recent patched versions is probably your best bet.

David
This module is unmaintained, the last version was on 2001.
*Sent:* Sunday, April 22, 2012 9:09 PM
*Subject:* Re: call perl from python code
Stella -
Did you have any luck using PyPerl? http://wiki.python.org/moin/PyPerl
David
Hi,
I have installed Inline::Python.
Manual says: "perl is a Python module bundled with Inline::Python that
gives you access to Perl from inside your Python code"- I cannot find this
perl module under installation package
#! /usr/bin/env python
import perl
perl.eval("printf \"HelloFromPerl\";")
#!/usr/bin/perl
use Inline Python => <<'END';
print "Hello from python"
END
Any help will be appreciated.
Thanks, Stella
--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." -- Brian Kernighan
--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." -- Brian Kernighan
Stella Levin
2012-04-22 20:01:01 UTC
Permalink
This module is unmaintained, the last version was on 2001.



________________________________
From: David Mertens <dcmertens.perl-***@public.gmane.org>
To: Stella Levin <stella_levin2003-/***@public.gmane.org>
Cc: "inline-***@public.gmane.org" <inline-***@public.gmane.org>
Sent: Sunday, April 22, 2012 9:09 PM
Subject: Re: call perl from python code


Stella -

Did you have any luck using PyPerl? http://wiki.python.org/moin/PyPerl

David


On Sun, Apr 22, 2012 at 5:21 AM, Stella Levin <stella_levin2003-/***@public.gmane.org> wrote:

Hi,
Post by Stella Levin
I have installed Inline::Python.
Manual says: "perl is a Python module bundled with Inline::Python that gives you access to Perl from inside your Python code"- I cannot find this perl module under installation package
#! /usr/bin/env python
import perl
perl.eval("printf \"HelloFromPerl\";")
#!/usr/bin/perl
use Inline Python => <<'END';
print "Hello from python"
END
Any help will be appreciated.
Thanks, Stella
--
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan
Loading...