pyPerl by David W. Schere davidws@csmctmto.interpoint.net This was a weekend effort to make an extension module so Python can manipulate Perl. Currently, there are 1 million Perl programmers in the world. I don't know what the numbers are for Python but its safe to say that there are at least 20 perl programmers for every Python programmer. I think Python is a better language, but the fact is that the foundation of the internet lies with Perl and I am sick of seeing Python bindings in alpha while Perl bindings are at 1.0 or better. I wrote this extension for me and my work. It is the bare bones nessessary to execute perl scripts and evaluate results from within Python. This should be good enough to harness the Perl libraries that I want from within Python. ============= Build and install ================================ Pre-requisites: o SWIG o Perl and the 'ExtUtils::Embed' library which can be found in the CPAN modules/by-module on www.perl.org Build: Edit the make.sh with the path for your Python include files just execute the make.sh script DO NOT GO make. I had a difficult time builing this thing Install: Be sure to place the perlIntermodule.so in your PYTHONPATH. ============== pyPerl API ===================================== perlInter supports that following API: # Creates a new perl interpreter and/or increments a # reference count perl_create() # Destroys a perl interpreter and/or decrements a reference count perl_destroy() # Executes aperl script as a python string perl_eval( script ) #-- After execution of script use the below methods to fetch the #-- values within the script # return and integer value of a perl scalar python_int = perl_IntFromName( scalar_name ) # return a floating point value of a perl scalar python_float = perl_FloatFromName( scalar_name ) # return a string value of a perl scalar python_string = perl_StringFromName( scalar_name ) # returns a copy of the name perl list into a python list python_list = perl_ListFromName( list_name) # return a copy of the contents of a perl hash table into # a python dictionary python_dict perl_DictFromName( hash_name ) # if any call returns an error than we return an error message python_string = perl_error() ======================= For the lawyers ========================= Author: David W. Schere Copyright (C) 1998 DIDX llc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ===============================================================