Perl to Python

Richard Jones Richard.Jones at fulcrum.com.au
Wed Dec 15 17:11:38 EST 1999


[Amber Shao]
> Does anyone know if there is a way to call  Python module from a Perl
> script?

   Look up http://mini.net/pub/ts2/minotaur.html

   It - with some mucking around getting the appropriate libraries compiled - 
will let you load pretty much any shared library and call functions within 
them. You can then use that to load up Python (or Perl or Tcl) from Perl (or 
Python or Tcl) and call functions that do stuff like execute code.

   State is preserved within the loaded library's runtime, of course.

   The one major drawback is that since you're just calling some arbitrary C 
function, you have to understand what is being returned and deal with it 
accordingly. It's entirely possible (as long as your computer's architecture 
allows it) to have Python object references returned from the calls into the 
Python library and then have them passed back into the Python runtime.

   I found it interesting, but it needs work to handle at least the basic types 
that might be transferred between the various languages. Then it would be very, 
very powerful.


       Richard






More information about the Python-list mailing list