Advanced Perl 5 Programming

4 Day Course
Hands On
Code QAPLADV

This course has been retired. Please view currently available Perl Training Courses.

Modules

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
  • CLONE
  • Threads, processes and applications

Prerequisites

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”

Course PDF

Print

Sections