nadim [24/05/04 18:43 +0200]:
> Inline allwos me to write extention to perl but only in one direction. For 
> example, I can write a function in python to be called from perl but I 
> can't call any perl function from within the inlined python code.

Actually, you can. I::Py exposes a 'perl' object in the global
namespace. You can call methods on it. Check out t/01testpl.t in the
Inline-Python distribution. Here's the Python code:

----8<----
perl.use("Data::Dumper";)
perl.f()
print perl.Dumper({'neil': 0, 'laura': 1}), # suppress extra \n
perl.ok(1)
print perl.CORE
perl.ok(1)
print dir(perl)
perl.ok(1)
t = get_sub('f')
t.flags = t.G_EVAL | t.G_KEEPERR
t()

perl.py_eval("print 'Wow. Now that is weird'")
perl.ok(1)
---->8----

Look for "Using Perl inside Python (inside Perl)" in L<Inline::Python>.

Cheers,
Neil

Reply via email to