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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access