9

A Google search yields a number of results - but which ones are the best?

The Perl site appears to contain two - perlboot and perltoot. I'm reading these now, but what else is out there?

Note: I've made this community wiki to attempt to produce something better than Google, which appears to have mediocre tutorials that are more about object-oriented programming than object-oriented Perl style and techniques and the two on the Perl site. One tutorial per post + a summary of the good/bad things about the tutorial would be best so we can let the best tutorials float to the top.

Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
Thomas Owens
  • 114,398
  • 98
  • 311
  • 431

11 Answers11

8

Since this is community wiki and in the spirit of your note:

perlboot is now deprecated, and re-directs to:

perlootut - Object-Oriented Programming in Perl Tutorial

perlobj - Perl object reference

If you are new to Perl, this tutorial also suggests that you read about subroutines, references, and modules.

jLGawtrox
  • 15
  • 4
innaM
  • 47,505
  • 4
  • 67
  • 87
8

Damian Conway's Object Oriented Perl has two essential chapters and all the source code online.

Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
  • It would help if you specified which two chapters are essential (in your opinion). In an interesting post on the Manning forum for the book, someone paraphrases Conway's opinion (as of 2007) as to what parts of the book are still valid or useful and which parts aren't (or are less good for some reason): http://www.manning-sandbox.com/thread.jspa?threadID=18227&tstart=0 – Telemachus Nov 09 '09 at 22:19
  • 1
    @Telemachus: I am referring to the chapters posted on the page I linked to as *essential*. The state of the art in terms of encapsulation might have moved on, but I still think Conway's treatment is a good resource to understand whence the state of the art moved. See also my other link on inside-out objects. Studying both of these resources will, IMHO, help the reader understand why Moose exists ;-) – Sinan Ünür Nov 09 '09 at 22:45
6

The Conway book is a classic.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
5

Moose::Manual

zoul
  • 102,279
  • 44
  • 260
  • 354
  • 2
    Moose is great, but also new and quite chunky. It might not be suitable if you want to learn how to work with most existing OO-Perl code. – Quentin Nov 09 '09 at 14:56
  • 3
    I would strongly recommend *not* reading the Moose tutorial right away, until one is familiar with how Perl natively does OO. Moose is confusing enough as it is without understanding how it's put together under the hood. See http://stackoverflow.com/questions/980751/should-i-learn-perl-5-oo-or-moose-first – Ether Nov 09 '09 at 17:38
  • @David: chunky? Do you have in mind the amount of code that Moose loads or its syntax or ? – Telemachus Nov 09 '09 at 22:21
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. – gevorg Jun 09 '16 at 11:48
5

While not a tutorial, I'd suggest have a read and work through the examples of Learning Perl Objects, References & Modules which is the second book in the Randal Schwartz's "Learning Perl" series.

This book is an excellent intro to Perl objects.

BTW I prefer this version over the later edition which has also been given the more generic title of "Intermediate Perl". And, as an added bonus, a second-hand copy of the older version is much less than the new edition. (-:

Edit: I forgot to add a pointer to the excellent OOP meta-tutorial over at Perl Monks which gives you pointers to what you need to know to start OOP in Perl and then points you towards several other tutorials on OOP at several levels of difficulty.

Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
Rob Wells
  • 36,220
  • 13
  • 81
  • 146
  • 4
    Learning Perl Objects, References, and Modules is old. We retitled the latest edition as "Intermediate Perl". It's updated and has more stuff. – brian d foy Nov 09 '09 at 18:01
  • Still prefer the older, not "written by a committee", versions. Don't know why. It's the same for Learning Perl after edition 3. The style of writing changes. Much better to forget that book and just dive into The Camel book instead IMHO. – Rob Wells Nov 10 '09 at 10:45
5

I'm a big fan of the materials available on the Perl Training Australia website.

They have an introductory tutorial available as well as a full-sized book-length treatment:

All their course materials and tips are well-worth looking at.

Telemachus
  • 19,459
  • 7
  • 57
  • 79
2

Moose::Manual::Unsweetened helped me a ton.

Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
Oesor
  • 6,632
  • 2
  • 29
  • 56
  • 2
    Moose::Manual has already been posted. This is just a subsection of that tutorial. – Thomas Owens Nov 09 '09 at 15:05
  • Moose::Manual::Unsweetened is fantastic for showing the "why" of Moose but still good as an introduction to the "how" of Moose. – neniu Aug 03 '13 at 18:36
2

Inside-out Objects by Randal Schwartz.

Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
1

There are a couple of object-oriented tutorials in the perl documentation. Check out the perltoc documentation. perldoc.perl.org has a page that list all of the Perl tutorials in the documentation.

brian d foy
  • 129,424
  • 31
  • 207
  • 592
1

There's a pretty good prestentation at tobez.org. It doesn't cover Moose, but it has a good overview of "classical" methods, and also goes into CPAN modules and techniques like blessing unusual references and inside-out objects.

daotoad
  • 26,689
  • 7
  • 59
  • 100
0

Starting Object Oriented Programming with Perl at Suite 101 is bad for a number of reasons and should be avoided.

Why the tutorial is bad:

  1. Shows non-inheritable constructors, but uses them in an example for inheritance
  2. Uses indirect method call syntax
  3. Does weird, buggy stuff to access arguments in code samples
  4. This is a minor niggle, but the author uses a big string of concatenation with a print where a list of arguments would work better (or better yet a join).
Sinan Ünür
  • 116,958
  • 15
  • 196
  • 339
daotoad
  • 26,689
  • 7
  • 59
  • 100
  • 1
    I don't know if I should upvote this because it's a suggestion of one to avoid and provides good reasons why or downvote it because it's not supposed to bubble up to the top... – Thomas Owens Nov 10 '09 at 12:47