Where can I find object-oriented Perl tutorials? [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Imp开发者_开发知识库rove this questionA 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.
Damian Conway's Object Oriented Perl has two essential chapters and all the source code online.
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.
The Conway book is a classic.
Moose::Manual
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:
- Shorter intro: http://perltraining.com.au/tips/2005-01-10.html (and http://perltraining.com.au/tips/2005-01-18.html)
- Book: http://perltraining.com.au/notes/perloo.pdf
All their course materials and tips are well-worth looking at.
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.
Inside-out Objects by Randal Schwartz.
Moose::Manual::Unsweetened helped me a ton.
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.
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.
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:
- Shows non-inheritable constructors, but uses them in an example for inheritance
- Uses indirect method call syntax
- Does weird, buggy stuff to access arguments in code samples
- 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 ajoin
).
精彩评论