< Python Programming

It is possible to call Perl functions and modules in Python. One way to do that is the PyPerl Module. It is not developed actively any more and for it to work in newer versions, one has to use this version and apply the patches.

import perl
perl.eval( "use lib './' ")
perl.require( 'Module::ModuleName' )

obj = perl.callm("new", 'Module::ModuleName'  )
obj[ '_attr1' ] = 9
obj[ '_attr2' ] = 42
obj.fxn1()

It is thus possible to handle Perl objects, change their attributes and call their methods.

See also

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.