MODULES

In Perl, modules have been the main way to extend code and make the code reusable. They have also become the primary way of supporting object classes and inheritance. However, to create a proper Perl module that supports both entire and selective export of functions and variables you must place the functions or class definitions into a special file and add suitable header information. Without this information it's impossible for Perl to explicitly export entities correctly, or to support the class inheritance system.

Python's approach

In theory every Python script you create has the potential to be a module – unlike Perl, you do not need to explicitly create a Python module, you can import the contents from a file automatically into its ...

Get Perl To Python Migration now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.