# Ny fortsättningskurs om Perl Modules & UDT

18 mars 2024 | https://www.ribomation.se/blog/2024/ny-fortsattningskurs-om-perl-modules-and-udt/

Precis som med C++, så blir man aldrig fullärd i programspråket Perl — det finns alltid en ny infallsvinkel på ett visst programmeringsproblem. Vår nya kurs om _Perl Modules och user-defined data-types_, tar vid där vår grundkurs slutar. Du får lära dig allt om hur man skapar moduler i Perl och använder det för att designa funktions-bibliotek eller datatyper baserade på _välsignade hash referenser_.

Vi går grundligt igenom hur du designar klasser, subklasser och överlagrar operatorer, baserad på etablerad metodik hos Perl programmerare. Du får också lära dig att skriva API documentation i POD formatet och använda det populära biblioteket `Moose` för att slippa skriva _boiler-plate_ kod, samt skapa professionella moduler med `Build::Module`.

* * *

Varför ska man lära sig Perl, kanske du frågar? Svaret är att, precis som för C++, så används Perl för många affärskritiska system. Dels, givetvis för många sysop / devops uppgifter, men också för att hålla reda på våra pensioner, hantera transaktioner med kreditkort på bank-sidan och mycket mera.

Orsakerna till detta är att språket är kolossalt effektivt och flexibelt. Ett Perl program kör cirklar runt ett motsvarande program skrivet i Python och är väsentligt mycket kortare än motsvarande program skrivet i Java och antagligen också snabbare.

* * *

Här kan du se innehållsförteckningen för våran fortsättningskurs i Perl:

### Course Introduction

What the course is about and how to get started.

#### Quick Recap of Perl

Just to ensure all participants are in line with the prerequisites for the course.

#### Perl Pragmas

*   What is a Perl pragma
*   `use strict`
*   Writing an unsafe program vs. a safe program
*   `use warnings`
*   `use diagnostics`
*   `use version`
*   `use Modern::Perl`

### Perl Package

The essentials of packages and how to import modules.

#### User-Defined Modules

*   How to invoke a function in another file?
*   Simple implementation
*   Refined implementation
*   Understanding `require`
*   Understanding `@INC`
*   Different ways to amend `@INC`
*   Defining a package
*   What is a Perl module and how is it related to package
*   Namespaces
*   Compile-time module import
*   Using the Exporter module
*   How to write hidden functions

#### Using Bundled Modules

Discussion of core modules.

#### Using Remote Modules

Discussion of CPAN modules.

#### Unit Testing

How to write unit tests for Perl modules.

### Reference Structures

Everything you need to know about references in Perl.

#### References

*   The problem of passing composite data to a function
*   Using the reference operator
*   Using the de-reference operator
*   Syntax rules for de-reference expressions
*   The `ref` operator
*   How to copy a reference
*   Reference counting
*   The danger of cyclic reference chains

#### Anonymous Data-Structures

*   What is anonymous data?
*   Syntax for anonymous composite data-structures
*   Designed complex data-structures
*   Reference to a functions

### Object-Oriented Perl

How to define classes and creating objects in Perl.

#### User-Defined Data-Types

*   What is a UDT?
*   How to invoke a function in another package
*   Call-by `::` vs. call-by `->`
*   What is a blessed reference?
*   UDT within a module file
*   Sample Perl class and instantiated objects

#### Object-Oriented Inheritance

*   What is OOP inheritance?
*   How to create a subclass in Perl
*   Understand `use parent`
*   What is `@ISA`
*   What is `SUPER::`

#### Operator-Overloading

*   What is operator-overloading?
*   Usage of `use overload`
*   Overloadable operators
*   How to implement an overloaded operator
*   Sample code

### Professional UDT

How to write production-strength UDT modules.

#### Introduction to Moose

*   Overview of the CPAN package-group Moose
*   Defining a simple class
*   Usage of a Moose class
*   Type constraints
*   Defining properties
*   Generated constructor
*   Generated accessor methods
*   Defining subclasses
*   Alternatives to Moose

#### Writing Module API Documentation

*   What is POD?
*   How to read POD documentation
*   How to write your own POD
*   POD syntax
*   How to generate API documentation
*   POD to HTML

#### Using Build::Module

*   Requirements for a professional module
*   Overview of package Build::Module
*   Module implementation
*   Module unit tests
*   Module documentation
*   Module packaging
*   Module deployment
