Advanced Perl 5 Programming

4 Day Course
Hands On

Book Now - 1 Delivery Method Available:

Classroom Virtual Classroom Private Group - Virtual Self-Paced Online


This course takes delegates beyond the basic syntax and structure of Perl. It answers questions like how do Perl variables really work, and what tools are available to improve my code, or the code I have inherited? It delves into details such as UNIX and Windows file directory structures, and how to exploit them, how to store complex Perl data structures in files and databases, and the strengths and weaknesses of different techniques.

Object Orientation techniques are the norm now, yet many Perl programmers have lagged behind.  This course gives a through grounding of OOP techniques in Perl, including inside-out objects and an overview of the future of Perl OO – Moose.

Interfacing with low-level 3rd-party products usually requires a C interface, but Perl has XS which enables C – Perl communications.  Perl XS requires a deep understanding of how Perl and Perl variables work and are manipulated – all covered in this course (an understanding of C really will help here).

Finally we take a look at multi-threading, its concepts, and Perl specifics.

Every effort is made to maintain the course material at the very latest release of Perl, and new features will be discussed.


Delegates will learn how to:

  • Use advanced features of the Perl 5 programming language
  • Use tools and techniques to improve existing Perl 5 code
  • Understand the impact of Perl 5 variable types, and how they are stored
  • Write robust modules installation packages with tests
  • Use and choose appropriate Perl Object Orientation techniques for large projects
  • Appreciate the depth and advantages of Moose
  • Understand and interfaces between Perl and a C API
  • Understand multi-threading in Perl 5.

Training Partners

We work with the following best of breed training partners using our bulk buying power to bring you a wider range of dates, locations and prices.


Hide all

Revision (19 topics)

  • Course objectives
  • Perl documentation
  • Perl history
  • Modern Perl
  • What is Perl 6?
  • Interpreter environment
  • Running a perl script
  • Anatomy of a perl script
  • Perl variables
  • Reminder: variable definitions
  • Some short-cut operators
  • Arrays and lists
  • Lexical variables
  • Controlling the interpreter - Pragmas
  • Always use strictures
  • Lexical pragmas
  • Creating references
  • Using references
  • Dereferencing array and hash references

The Perl 5 Language Environment (13 topics)

  • Some useful literal constants
  • Perl debugging
  • The Devel namespace
  • Profiling perl code
  • Benchmark
  • Warnings and diagnostics
  • Controlling warnings
  • Compiler back ends
  • De-compiler
  • Perl::Tidy
  • Perl::Critic
  • Perl Archive Toolkit - PAR
  • Data::Dumper

Files and Directories (20 topics)

  • The role of the directory on UNIX
  • The role of the directory on Windows
  • Perl functions for directories
  • Get current working directory
  • Working with directory entries - UNIX
  • Perl functions for directory entries
  • Monitoring directory changes - Linux
  • Adding a watch and reading events
  • Monitoring directory changes - Windows
  • Win32::Notify - example
  • Detailed file information
  • Stat converstion
  • UNIX symbolic links
  • Perl functions for UNIX symbolic links
  • Altering UNIX access permissions
  • Windows access validation
  • Access permissions on Windows
  • Reading directories
  • Positioning in directories
  • Windows Alternative Data Streams

Data Persistence (17 topics)

  • Perl file handling - revision
  • Scalar variables with handles
  • Alternative IO functions
  • So I have a variable, how do I save it?
  • The tie interface
  • Using tied modules
  • Implementing your own tie
  • Copying references - problem
  • Data::Dumper - writing data
  • Data::Dumper - get the data
  • YAML - YAML Ain't a Markup Language
  • YAML - get the data
  • Storable
  • Storable - managing our own IO
  • Storable - getting the data stream
  • Storable to the rescue - dclone
  • Other persistence packages

Modules (16 topics)

  • Splitting into modules
  • Using modules
  • Conditional use
  • The library directories
  • Removing directories from @INC
  • @INC hooks
  • Use versus require
  • Namespaces
  • Using subroutines from modules
  • Example of unconditional export
  • Example of on-demand export
  • Symbol export using tags
  • Conditionally exporting at run-time
  • Creating a module
  • Multiple packages per module
  • Writing tests

Overview of Perl 5 Object Orientation (9 topics)

  • Review of Object Oriented Programming
  • To OO, or not to OO?
  • Basic object usage
  • Objects are references
  • Implementing Objects
  • Accessing object fields
  • Constructors
  • Implementing object methods - details
  • Method calls

Constructors and Destructors (10 topics)

  • Object constructors
  • Object destructors
  • Reference counting
  • Object data types - pre 5.10
  • Object data types - post 5.10
  • Named constructors
  • Virtual constructors
  • Virtual constructors - exemplar registry
  • Virtual constructors - base class
  • Singletons

Inheritance and Overloading (9 topics)

  • Method inheritance
  • The parent pragma - 5.10.1 or later
  • Constructor inheritance
  • Multiple inheritance order
  • SUPER class - which one?
  • UNIVERSAL class
  • Alternatives to UNIVERSAL
  • Operator overloading
  • Operator overloading - the details

Encapsulation (8 topics)

  • Defining object layout
  • The fields pragma
  • Implementing methods with strong typing
  • Perl encapsulation?
  • Inside-out objects
  • Inside-out object destructors
  • Access method: shared or separate?
  • Inside-out accessors

Introduction to Moose (12 topics)

  • Moose is the new camel
  • Moose or Mouse?
  • Basic Moose
  • Attributes
  • Further attribute options
  • Constructors and Destructors
  • Example BUILDARGS
  • Methods
  • Inheritance
  • Overriding the super class
  • Derived class BUILDARGS
  • Roles and delegation

Embedding and Extending Perl 5 (19 topics)

  • UNIX specific syscall
  • Converting between Perl and C
  • syscall and unpack examples
  • Interfacing with Perl internals
  • Typeglobs and stashes
  • Decoding Devel::Peek
  • Primitive data types
  • How are lexical variables held?
  • Extensions - the principle
  • What is XS?
  • XS code entry points
  • The BOOT section and globals
  • Passing arguments
  • Creating Perl variables
  • Getting Perl variable values
  • Returning scalars
  • Returning lists by value
  • Error handling
  • Alternative to XS - Inline

Multi-threaded Programming (12 topics)

  • Review of threads
  • Review of thread concepts
  • Threads in Perl
  • Perl threads example
  • Sharing data between threads
  • Using subroutine attributes
  • Synchronisation
  • Caveats and bugs
  • Thread safety
  • Double-check
  • Threads, processes and applications


Students should be familiar with Perl to the level of the Intermediate Perl 5 Programming course and have recent experience of programming in Perl. Ideally that would be obtained by attending the course; if self-taught then the delegate should have experience at least to the level of the O’Reilly book ‘Intermediate Perl’. It is assumed that delegates are familiar with references, subroutines, and using modules; although in all cases some revision is offered. Knowledge of C would be an advantage, and is assumed for the chapter “ Embedding and Extending Perl 5”

Additional Learning

The courses below may help you meet the knowledge level required to take this course. If you are unsure please ask a training advisor .

Course PDF


Share this Course


Recommend this Course