Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Reason given by maintainers: buggy

perl-subroutine-wrapper

A Python wrapper for Perl subroutines.

This module makes it easy to call your Perl subroutines from Python. It is perfect for recycling old Perl code that you are not going to translate to Python.

It makes it possible to comunicate objects between the two languages through JSON object representations.

Valid Python objects passed as parameters are: dict, list, str, int, float, True, False, None.

Valid Perl objects returned are: SCALAR, ARRAY, HASH.

Installation

You can install this module from Pypi:

pip install perlsub

Requirements

In order to use this python module you will need to install jinja2, which will help us with generate the Perl intermediary wrapper dinamically when calling subroutines:

pip install jinja2

You also need Perl installed in your computer. You can check if it is installed and the version with the command:

perl -v

Example of usage

example.py and example.pm show us how to use the module. In example.pm we have a Perl subroutine such as join that we want to use in our Python script.

sub join { 
     my ($list1, $list2)=@_; 
     my @list3; 
     push @list3, @$list1; 
     push @list3, @$list2; 
     print "Joined :)"; 
     return @list3;
}

To wrap this subroutine and use it in Python we have to import the module, create a new Module instance passing the path of the Perl module, and call the call function passing the name of the subroutine, the parameters and the expected Perl object returned like I did in example.py. parameters and returned_type can be None.

from perlsub import Module


example = Module('example.pm')

join = example.call(
  subroutine='join', 
  parameters=[[2, 3], [1, 1]], 
  return_type='array'
)
print(join)
Output:

PerlCallResult(returned=[2, 3, 1, 1], stdout='Joined :)', error=None)

Release files for perlsub 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for perlsub 0.0.2
File Size Uploaded
perlsub-0.0.2.tar.gz 4.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for perlsub 0.0.2
File Interpreter ABI Platform
perlsub-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / perlsub-0.0.2.tar.gz

Download URL perlsub-0.0.2.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4022a375aa9c868c51253ea2bacc70e3cf0831ded349cd6239b58ee10cc007f1
BLAKE2b-256 checksum
How to use checksums
c5bb1dd58764351cfd7a9381e24d3ab958d35ebc06d2850dced7c53792afa46d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release files / perlsub-0.0.2-py3-none-any.whl

Download URL perlsub-0.0.2-py3-none-any.whl
Size 5.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
74e411605f9d68c61e0e6918ea2249ae84bb1c1a6e4be4f9967ddc2e3f353aa4
BLAKE2b-256 checksum
How to use checksums
084a8cec8f39c0e285c4b0d4da61be42d2dd55b80c308c3fe8f6a719387122ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page