Beginning Perl - Table of Contents

Because people keep asking for it, I asked Wrox if it was OK to share the table of contents and they said "sure!".

Please note that this is in flux. Chapters 1 through 7 are written, along with most of Chapter 8. Everything after that is very much subject to change (which is why the TOC isn't even formatted for those chapters). Also, you'll note the lack of Unicode. That was going to be in Chapter 7, but I've moved it to Chapter 9 and haven't update the table of contents yet.

Here's the rough outline:

Chapter 1: What's Perl? (20pp)
    What is Perl?
        The History
        Perl Today
    Getting Perl
        System Perl
        Perlbrew
        Windows
            Cygwin
            ActiveState Perl
            Strawberry Perl
    The Community
        IRC
        PerlMonks
        Perl Mongers
        StackOverflow
    Try it out: Register for a free account at PerlMonks
    Perldoc
        The Structure of perldoc
        Getting Started with perldoc
        Tutorials and FAQs
        perldoc -f function
    Using a terminal
        The Command Line
            Linux
            Mac OS X
            Windows
        Creating a Work Directory
    Try it out: Getting used to perldoc.
    Hello, World!
        You First Program
        Shebang lines

Chapter 2: Understanding the CPAN (15 pp)
    CPAN and METACPAN
        Finding and evaluating modules
        Downloading and installing
    Cpan Clients
        CPAN.pm
        cpanm A new and popular CPAN client is cpanm, also known as App::cpanminus.
        PPM
        CPAN::Mini
    Try it out  Configure a CPAN client and install File::Find::Rule

Chapter 3: Variables  (30pp)
    A Few Things to Note Before Getting Started
        strict, warnings, and diagnostics
        The my builtin
        Sigils
        Identifiers
    Scalars
        Strings
            Quotes and quote operators 
            Escape characters
    Numbers
        int/float
        Octal, hex, and exponential notation
    Try it out: Interpolating scalars in strings
    Arrays
        Accessing elements
        Iterating
    Hashes
        Accessing elements
        Iterating
        Adding Data to Hashes
    Slices
        Array Slices
        Hash Slices
    Context
        Scalar Context
        Arrays in Scalar Context
        Lists in Scalar Context
        Hashes in Scalar Context
    Try it out: Printing arrays and hashes
    Scope
        my Variables 
        Package Variables
            The vars Pragma
            Declaring Package Variables with our
            Using Local Variables
    strict, warnings, and diagnostics
        strict
        warnings
        diagnostics
        Working Without a Net
    Try it out: Understanding Uninitialized Variables
    Perl's Built-in Variables
        $_
        @ARGV
        Other Special Variables

Chapter 4: Working with data (20 pp)
    Builtins
        Scalar
            String
            String operators
            Numeric
            Bitwise
            Boolean
            Assignment operators
            Precedence and associativity
        Array and list functions
        Hash functions
    Try it out  Printing your name in various cases
        Scoping keywords

Chapter 5: Control structures and conditionals (15 pp)
    The if statement
        Basic conditionals
        else/elsif/unless
        The Ternary Operator ?:
    for/foreach loops
        Arrays
        Lists
        C-Style
    Try it out  Finding duplicate array elements
    Try it out  Splitting an array
    while/until loops
        Lists
        last/next/redo/continue
        Labels
    Statement Modifiers
        Types of Statement Modifiers
        do while/do until
    Try it out: while versus do {} while
    given/when (Perl's switch statement)
        Basic syntax
        The Switch Module

Chapter 6: References (20 pp)
    References 101
        Array references
        Hash references
        Anonymous references
            Anonymous Arrays
            Anonymous hashes
        Other references
    Try it out: Walking complex data structures
    Working with References
        Debugging
        Copying
        Slices

Chapter 7: Subroutines (25 pp)
    Subroutine Syntax
        Argument handling
        Multiple Arguments
        Named Arguments
        Aliasing
        state variables (pre- and post-5.10)
        Passing a list, hash, or hashref?
    Returning data
        Returning true/false
        Returning single and multiple values
        wantarray
    FAIL!
        "Wake up! It's time to die!"
        carp and croak
        eval (block and string)
            String eval
            Block eval
        eval gotchas
        Try::Tiny
    Subroutine references
        Existing subroutines
        Anonymous subroutines
        Closures
    Prototypes: Just say "no". Unless you mean "yes".
        Argument coercion
        More Prototype Tricks
        Mimicking builtins
        Forward Declarations
        Prototype Summary
    Recursion
        Basic recursion
        Divide and Conquer
        Memoization
    Things to watch for
        Argument aliasing
        Scope issues
        Doing too much
        Too many arguments

Chapter 8: Regular expressions  (25 pages)
    Basic matching
        Quantifiers (*+?)
        Escape Sequences
        Extracting Data
        Modifiers and Anchors
        Character Classes
        Grouping
        Escape characters
    Try it out    Rewrite the $name_and_age code using /g and [[:alpha:] ]
    Advanced matching
        Substitutions
    Try it out  US to European Dates
        Regexp::Common
        Email addresses
        HTML
        Look ahead/ look behind
        Named subexpressions (5.10)
        Composing regular expressions

# Everything after this point is still very speculative

Chapter 9: Files and directories  (15 pp)
    Basic file handling
    Opening and reading a file
    Slurping a file
    Opening many files
    Writing to files
    Temporary files
    DATA as a file
    Locking files
    Directories
    Reading directories and why you don't want to
    File test operators
    Useful Modules
    File::Find
    File::Find::Rule
    File::Map

Chapter 10: Sort, map and grep (15 pp)
    Basic sorting
    Sorting numerically
    Reverse sorting { $b <=> $a } instead of reverse
    Writing a sort subroutine
    Try it out: sort an array of array refs by first element and then second element.
    Map and grep
    Aliasing issues
    Trying to do too much
    Try it out: write a grep to only find even elements in a list.
    Try it out: rewrite an array with map to convert Fahrenheit  to Celsius.
    Putting it all together
    Schwartzian transform (a.k.a., decorate, sort, undecorate)

Chapter 11: Packages and Modules (25 pp)
    Namespaces and packages
    Package variables and why they're dangerous
    Adding functions to your packages
    Returning "true"
    Scope
    Subroutines in other packages
    Exporting
    Naming conventions
    Try it out: think of a clever package to write.???
    Creating and Installing
    File layout
    Module::Build or Makefile.PL?
    BEGIN, UNITCHECK, CHECK, INIT and END

Chapter 12: Object Oriented Perl (40 pp)
    What is OO?
    Objects are merely experts about a subject
    Encapsulation
    Polymorphism
    Inheritance (boo hiss)
    Controversy
    "Safe" usage
    Gotchas
    Unnecessary accessors
    Unnecessary methods
    "Reaching inside"
    Inheritance
    3 rules of Perl OO
    Class is a package
    An object is just a reference that knows its class
    Method is a sub that expects a class/object as its first argument
    Class versus Instance data
    A basic class
    Television::Episode
    Subclassing
    Television::Episode::Broadcast
    Television::Episode::OnDemand
    Containers
    Television::Season
    Private methods
    Overloading
    Try it out: Create a Television::Actor class and modify Television::Episode to require one or more actors

Chapter 13: Moose (45 pp)
    What is Moose?
    Basic Syntax
    Attributes
    Constructors
    Inheritance
    Try it out: write a canonical "Person" class.
    Advanced Syntax
    Type constraints
    Method modifiers
    Roles
    Converting Television::* classes to Moose
    Try it out: modify the "Television::Episode" class to have a type constraint for the actors.

Chapter 14: Testing (30 pp)
    The great testing debate (is over)
    Why we test
    The technical debt tradeoff
    Why bugs are OK!
    Testing fallacies
    Behavior versus specifications
    100% coverage
    TDD and other religions
    Basic tests
    ok
    is, isnt
    like, unlike
    cmp_ok
    is_deeply
    isa
    diag
    eval {}
    use_ok and require_ok (and why you don't want them)
    Try it out: I'll provide a function for someone to write tests against.
    Other testing modules
    Test::Differences
    Test::Exception
    Test::Deep
    Test::Warn
    Test::Most
    Test::Class::Most
    xUnit style testing
    Test::Class
    Effective testing
    Unit, integration, or both?
    Process isolation or integration
    Test file naming
    Try it out: Write tests for the Television::Episode class
    What happens if you have no actors?

Chapter 15: The Interwebs (30 pp)
    A simple Web request
    GET and POST
    <p>Hello, World!</p>
    HTTP::Server::Simple
    CGI.pm (yeah, it's still out there)
    Handling parameters
    Getting/setting cookies
    Taint checking
    HTML::Entities
    Cookies
    Try it out: create a simple character generator for role-playing games.
    Web automation
    WWW::Mechanize
    HTML::TokeParser::Simple
    HTML::SimpleLinkExtor
    REST vs. SOAP (shudder)
    Try it out: Fetch a Web page and print all of the image links.

Chapter 16: Databases (15 pp)
    What's a database?
    DBI
    DBD::SQLite
    Basic data selection
    Bind Params versus SQL Injection (Bobby Tables)
    Binding output variables
    Inserting and updating data
    Transactions
    Error handling
    Try it out: Add a new table, joined to the first and select some joined data from them. Try updating the new table.

Chapter 17: Working with other programs (15 pp)
    Exec
    System
    Fork
    Piped open
    Try it out: We'll figure out a good case here

Chapter 18: Common tasks (35 pp)
    CSV data
    Reading
    Writing
    Basic XML
    Reading
    Writing
    Date handling
    DateTime
    Try it out: Write a program to determine a baby's age in weeks
    Debugger
    Profiling
    Devel::Dprof
    Devel::NYTProf
    Benchmark
    Perl::Critic
    Try it out: run Perl::Critic over some Perl you've written.
    Regexp::Common
    The command line

Chapter 19: Next Steps (35 pp)
    What we've covered
    DBIx::Class
    A quick sample
    Template Toolkit
    A quick sample
    Catalyst
    A quick sample
    Dancer example
    A quick sample
    Try it out: update the Dancer example to include shortcuts to your favorite sites

Appendix A: Answers to Exercises

Appendix B: Basic SQL (25 pp)
    What's a database?
    SELECT
    ORDER BY
    WHERE
    Aggregates and GROUP BY
    JOIN
    INSERT
    UPDATE
    Normalization
    Appendix B: POD (10 pp)
    Headings
    Paragraphs
    Lists
    Linking
    Verbatim
    Encoding
    Formatting codes

Appending C: Perldelta (10 pp)
    Important changes you'll need to know

And yes, many reviewers told me to dump the SQL intro in the appendix. My rationale was that I have interviewed many programmers and have been astonished by how many of them never new basic SQL. Without that, there are large sections later in the book which are meaningless. Some argue that people can "look it up". I'm still debating this.

And yes, I know $yourfavoritetopic is not included. The book is estimated to be around 600 pages. There comes a point when you have to say "enough"!

8 Comments

I'd leave out IRC as "community" for beginners. There's little more toxic to the beginner.

I suggest that the very first thing that should show up in the community section would be one's local Perl Mongers group.

I notice you have Scalar Context but no List Context. Would it be important? I'm assuming you're going to be talking about the English module under "Other Special Variables". You have Perl::Critic but no Perl::Tidy. Perhaps you should add it.

It looks quite thorough and I'm looking forward to seeing it. :)

I've been writing Perl for more than a decade, and this TOC sounds like the best, most encompassing intro to Perl ever written.

Are you going to use CGI.pm for the web chapter, or are you going to introduce Plack there?

If I were writing a completely new book on learning Perl, I wouldn't have a Unicode chapter. It would be throughout the book. In the latest Learning Perl, we're using Unicode at the first mention of strings, in the chapters on reading files, and in the regex chapters. It's not a bolt-on subject.

Please don't refer (in Chapter 8) to the DMY date format as "European". Not unless you consider South America, and most of Asia, Africa and the Pacific to be within Europe.

Europe is not even the most populous place to use DMY - India's population exceeds it significantly.

http://en.wikipedia.org/wiki/Date_format_by_country

Sounds like the definitive guide, can't wait to see it e-published. Are you planning to translate the content in other languages? Greets from Spain.

Very good work, a will take this links to all my work friends. Regards

If I were writing a completely new book on learning Perl, I wouldn't have a Unicode chapter. It would be throughout the book. In the latest Learning Perl, we're using Unicode at the first mention of strings, in the chapters on reading files, and in the regex chapters. It's not a bolt-on subject.

About Ovid

user-pic Freelance Perl/Testing/Agile consultant and trainer. See http://www.allaroundtheworld.fr/ for our services. If you have a problem with Perl, we will solve it for you. And don't forget to buy my book! http://www.amazon.com/Beginning-Perl-Curtis-Poe/dp/1118013840/