Advanced Topics in Perl
Length: 3-5 days
Prerequisites: Students
in this class should already have been programming in Perl for at
least a year.
Description
Advanced Topics in Perl covers the construction and
operations of modules, the Exporter, Perl's namespace structure,
object-oriented programming, advanced use of subroutines, exception
handling, the debugger, and the Perl symbol table. It overlaps Intermediate Topics in Perl and Object-Oriented Programming. Longer versions incorporate
the short Regular Expression Mastery class.
The outline below takes four and a half days to complete. If
desired, section V , XIII, or both may be omitted, to produce a
shorter class; Regular Expression
Mastery can be added toward the end, to produce a longer
class; and a sped-up, labless version of Hands-On Introduction to Perl can
be added at the beginning as a refresher for programmers whose Perl is
rusty.
As with all my classes, Advanced Topics in Perl can be
custom-tailored to suit your students and your schedule. I will work
with you to develop a curriculum that meets the goals of your
training.
Advanced Topics in Perl was designed for intermediate
and experienced Perl programmers who want to take the next step and
become experts.
Outline
- I. Exporting Modules
- Why Modules?
- Example Module: Socket.pm
- use
- Encapsulation; namespaces; packages
- Extended package names
- Lexical variables
- Importation and Exportation
- Writing Modules; missing modules; missing function
- The Exporter
- Unexported functions
- @EXPORT and @EXPORT_OK
- Several modules in the same file
- carp
- Did Not Return a True Value
- Lab 1
- II. Introduction to CPAN
- What is CPAN?
- search.cpan.org
- III. Module Support Services
- Makefile.PL
- Installation; distribution
- Version numbers
- h2xs
- Testing; Test::Harness; Test::Simple; Test::More
- Lab 3
- IV. Useful Modules and OOP Syntax Introduction
- Email; mail transport; SMTP; envelopes
- Sending mail; Mail::Send
- Digression: OO Notation
- Net::SMTP
- LWP::Simple
- Serialization: FreezeThaw; Data::Dumper
- Parse::RecDescent: grammar; usage. results
- Caching; Memoizing; Memoize
- V. Review of references and coumpound data structures (if necessary)
- Why References?
- Make rules 1 and 2
- Use rules 1 and 2
- Two-dimensional arrays; arrow rule
- City-Country Problem
- Hash of arrays
- Printing out a reference
- Symbolic references; strict refs
- Finding the type of a reference
- Copying vs. aliasing
- Code references
- Schwartzian transform
- VI. Basic Object-Oriented Programming
- Why OOP?
- Methods
- Classes
- Typical OO Program
- Constructors
- Object methods; accessor methods
- Class vs. Object Methods
- "Indirect object" style
- Change of implementation; Broken encapsulation boundaries
- Review of OO Concepts
- Lab 6
- VII: Inheritance
- Summary of OOP
- Inheritance; jargon
- Setting up inheritance in Perl; @ISA
- Multiple Inheritance
- Exporter Again
- Constructors revisited
- Empty subclass test
- Overridden methods; partial inheritance
- Delegation
- Refactoring
- Abstract classes; HTML::Parser example
- Lab 7
- VIII: Advanced Techniques
- Memory management in perl
- Reference counts; reference loops
- DESTROY
- UNIVERSAL Methods
- Polymorphism
- Encapsulation strategies:
- Flyweight scalars
- Anonymous subroutines as objects; closures
- Tie::SecureHash; public, private, and protected data; key collisions
- Class::Struct
- Lab 8
- IX: Subroutines
- Subroutine arguments; pass by reference
- Hashes as lists; reverse trick
- Named parameter style
- Dispatch tables
- State machines; NNTP example
- Lab 9
- X: The Perl Symbol Table
- Globs
- Operations with globs
- Aliasing; exportation; inheritable exportation
- Forced importing / aliasing
- Passing filehandles; lexically scoped filehandles
- Miscellaneous applications of globs; read-only constants
- Glob objects
- Extended example: Templating system
- Lab 10
- XI: Error Handling
- The Perl builtin debugger
- $!
- Exceptions; exception handling; CPAN exception modules
- strict; 'strict vars'; 'strict subs'
- Warnings; perldiag
- XII: Autoloading
- What is Autoloading?
- Magic goto
- Case-insensitive function calls
- Function call caching
- Typical AUTOLOAD use: Accessor Methods; direct emulation of accessors; caching accessor methods
- Autoloading from a file
- Import.pm module
- Shell.pm
- XIII: Network Programming
- Addresses; host names; DNS; gethostbyname; gethostbyaddr
- IP; UDP; TCP
- Sockets
- Setting up a Network Client
- Buffering; typical buffering problem; disabling buffering
- Using a Network Client
- Setting up a Network Server
- select
- Other Utilities
- Lab 13a
- Net::FTP
- Net::Telnet
- ident Service
Return to:
Universe of Discourse main page |
Perl Paraphernalia |
Other Classes and Talks
mjd-perl-yak+@plover.com